Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/chatgpt/app-server-shim/launcher.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the owned ChatGPT architecture document

This changes the path-construction invariant in the owned src/chatgpt/ area, but the commit does not update its mapped document, structure/clients/chatgpt-desktop.md. Document that bundle candidates must retain POSIX semantics even on non-macOS test hosts so the Windows-safe behavior remains part of the subsystem contract; repository ownership rules require an owned source change and its document update to land together.

AGENTS.md reference: AGENTS.md:L42-L43

Useful? React with 👍 / 👎.

if (isExecutable(candidate)) return candidate;
}
return null;
Expand Down
10 changes: 10 additions & 0 deletions tests/clients/desktop-app-server-shim-launcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading