diff --git a/src/main/pty/codex-shell-launch-preflight.test.ts b/src/main/pty/codex-shell-launch-preflight.test.ts index 67fe01f041a..be8d84537c9 100644 --- a/src/main/pty/codex-shell-launch-preflight.test.ts +++ b/src/main/pty/codex-shell-launch-preflight.test.ts @@ -343,26 +343,23 @@ describe('Codex shell launch preflight command', () => { ).toBe(launcherPath) }) - it.skipIf(process.platform !== 'win32')( - 'carries the packaged Windows launcher as a guest-absolute WSL path', - () => { - const { userDataPath, resourcesPath } = makeCliRoot() - const launcherPath = join(resourcesPath, 'bin', 'orca.exe') - writeExecutable(launcherPath, '#!/bin/sh\nexit 0\n') + it('carries the packaged Windows launcher for WSLENV path translation', () => { + const { userDataPath, resourcesPath } = makeCliRoot() + const launcherPath = join(resourcesPath, 'bin', 'orca.exe') + writeExecutable(launcherPath, '#!/bin/sh\nexit 0\n') - expect( - resolveCodexShellLaunchPreflightCommand({ - hooksEnabled: true, - isPackaged: true, - isWsl: true, - managedHomePath: '/home/jin/.local/share/orca/codex-runtime-home/home', - userDataPath, - resourcesPath, - platform: 'win32' - }) - ).toMatch(/^\/mnt\/[a-z]\//) - } - ) + expect( + resolveCodexShellLaunchPreflightCommand({ + hooksEnabled: true, + isPackaged: true, + isWsl: true, + managedHomePath: '/home/jin/.local/share/orca/codex-runtime-home/home', + userDataPath, + resourcesPath, + platform: 'win32' + }) + ).toBe(launcherPath) + }) it('never returns an unqualified command name that a profile-rewritten PATH could hijack', () => { const { userDataPath, resourcesPath } = makeCliRoot() diff --git a/src/main/pty/codex-shell-launch-preflight.ts b/src/main/pty/codex-shell-launch-preflight.ts index 5de44c9941d..537933fcdba 100644 --- a/src/main/pty/codex-shell-launch-preflight.ts +++ b/src/main/pty/codex-shell-launch-preflight.ts @@ -1,6 +1,5 @@ import { accessSync, constants, statSync } from 'node:fs' import { join } from 'node:path' -import { toLinuxPath } from '../../shared/wsl-paths' import { getBundledLauncherPath } from '../cli/bundled-cli-launcher-path' const DEV_LAUNCHER_DIR = ['cli', 'bin'] @@ -49,8 +48,8 @@ export function resolveCodexShellLaunchPreflightCommand( if (!options.isWsl) { return candidate } - // Why: WSL executes the verified Windows launcher through interop; its guest path crosses WSLENV untranslated. - return platform === 'win32' && options.isPackaged ? toLinuxPath(candidate) : null + // Why: WSLENV /p translates the verified Windows launcher with the distro's configured automount root. + return platform === 'win32' && options.isPackaged ? candidate : null } function isExecutableFileOnDisk(path: string, platform: NodeJS.Platform): boolean { diff --git a/src/main/pty/wsl-orca-env.test.ts b/src/main/pty/wsl-orca-env.test.ts index a011a547ce9..0a501b5d220 100644 --- a/src/main/pty/wsl-orca-env.test.ts +++ b/src/main/pty/wsl-orca-env.test.ts @@ -84,7 +84,7 @@ describe('addOrcaWslInteropEnv', () => { expect(env.WSLENV).toContain('ORCA_TERMINAL_HANDLE/u') expect(env.WSLENV).toContain('ORCA_USER_DATA_PATH/p') expect(env.WSLENV).toContain('ORCA_CLI_COMMAND/u') - expect(env.WSLENV).toContain('ORCA_CODEX_LAUNCH_PREFLIGHT/u') + expect(env.WSLENV).toContain('ORCA_CODEX_LAUNCH_PREFLIGHT/p') expect(env.WSLENV).toContain('ORCA_OMP_STATUS_EXTENSION/p') expect(env.WSLENV).not.toContain('ORCA_PRIME_AGENT_STATUS_EXTENSION') expect(env.WSLENV).toContain('ORCA_PANE_KEY/u') diff --git a/src/main/pty/wsl-orca-env.ts b/src/main/pty/wsl-orca-env.ts index 0869bd9db22..522b5b70e0a 100644 --- a/src/main/pty/wsl-orca-env.ts +++ b/src/main/pty/wsl-orca-env.ts @@ -77,7 +77,7 @@ export function addOrcaWslInteropEnv(env: Record): void { // and it cannot derive the hash segment from ORCA_USER_DATA_PATH alone. 'ORCA_SHELL_READY_ROOT/p', 'ORCA_CLI_COMMAND/u', - 'ORCA_CODEX_LAUNCH_PREFLIGHT/u', + 'ORCA_CODEX_LAUNCH_PREFLIGHT/p', 'ORCA_PANE_KEY/u', 'ORCA_TAB_ID/u', 'ORCA_WORKTREE_ID/u',