diff --git a/src/main/ipc/preflight-wsl-agent-detection.test.ts b/src/main/ipc/preflight-wsl-agent-detection.test.ts index a1f9d7cfda5..1853540d8db 100644 --- a/src/main/ipc/preflight-wsl-agent-detection.test.ts +++ b/src/main/ipc/preflight-wsl-agent-detection.test.ts @@ -78,11 +78,11 @@ describe('detectWslCommandsOnPath', () => { it('ignores commands whose resolved path is not absolute', async () => { execFileAsyncMock.mockResolvedValue({ - stdout: '__ORCA_AGENT_PATH__claude\tclaude\n', + stdout: '__ORCA_AGENT_PATH__claude\tclaude\n' + '__ORCA_AGENT_PATH__codex\tC:\\spoof\n', stderr: '' }) - const found = await detectWslCommandsOnPath({ distro: 'Ubuntu' }, ['claude']) + const found = await detectWslCommandsOnPath({ distro: 'Ubuntu' }, ['claude', 'codex']) expect(found).toEqual(new Set()) }) diff --git a/src/main/ipc/preflight-wsl-agent-detection.ts b/src/main/ipc/preflight-wsl-agent-detection.ts index be1f216ed9c..b5eff064325 100644 --- a/src/main/ipc/preflight-wsl-agent-detection.ts +++ b/src/main/ipc/preflight-wsl-agent-detection.ts @@ -114,7 +114,9 @@ function parseWslDetectedCommands(stdout: string): Set { } const command = payload.slice(0, separatorIndex) const resolvedPath = payload.slice(separatorIndex + 1) - if (path.posix.isAbsolute(resolvedPath) || path.win32.isAbsolute(resolvedPath)) { + // Why: a real guest executable always resolves to a POSIX-absolute path, so + // a Windows-style C:\ path here is spoofed/non-guest output, not an install. + if (path.posix.isAbsolute(resolvedPath)) { found.add(command) } }