diff --git a/src/chatgpt/app-server-shim/launcher.ts b/src/chatgpt/app-server-shim/launcher.ts index 629633373ef..53142ddafbf 100644 --- a/src/chatgpt/app-server-shim/launcher.ts +++ b/src/chatgpt/app-server-shim/launcher.ts @@ -1,6 +1,6 @@ import { accessSync, chmodSync, constants, mkdirSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs"; import { randomBytes } from "node:crypto"; -import { join } from "node:path"; +import { join, posix } from "node:path"; import { getConfigDir } from "../../config/paths"; import { selfLaunchArgv } from "../../lib/self-launch-argv"; @@ -32,7 +32,7 @@ export function resolveChatgptCodexBinary( isExecutable: (path: string) => boolean = isExecutableFile, ): string | null { for (const layout of BUNDLED_CODEX_LAYOUTS) { - const candidate = join(bundleRoot, ...layout); + const candidate = posix.join(bundleRoot, ...layout); // macOS bundle paths are POSIX on every host if (isExecutable(candidate)) return candidate; } return null; diff --git a/tests/clients/desktop-app-server-shim-launcher.test.ts b/tests/clients/desktop-app-server-shim-launcher.test.ts index 4baaaa1d9fe..fa16a29364a 100644 --- a/tests/clients/desktop-app-server-shim-launcher.test.ts +++ b/tests/clients/desktop-app-server-shim-launcher.test.ts @@ -62,6 +62,16 @@ describe("experimental app-server launcher", () => { expect(resolveChatgptCodexBinary(root, () => false)).toBeNull(); }); + test("every probed bundle path stays POSIX, so a Windows host builds the same candidates", () => { + const probed: string[] = []; + resolveChatgptCodexBinary("/Users/example/Applications/ChatGPT.app", path => { probed.push(path); return false; }); + expect(probed.length).toBeGreaterThan(0); + for (const path of probed) { + expect(path).not.toContain("\\"); + expect(path.startsWith("/Users/example/Applications/ChatGPT.app/Contents/")).toBe(true); + } + }); + test("the writer embeds the binary it is given", () => withDir(dir => { const real = "/Volumes/Apps/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex"; const path = writeChatgptShimLauncher(dir, real);