Skip to content

fix(codex): start sidecars in requested cwd#309

Open
danshapiro wants to merge 1 commit intoexact-durable-session-contractfrom
codex/rootcause-codex-startup-20260423-pr
Open

fix(codex): start sidecars in requested cwd#309
danshapiro wants to merge 1 commit intoexact-durable-session-contractfrom
codex/rootcause-codex-startup-20260423-pr

Conversation

@danshapiro
Copy link
Copy Markdown
Owner

Summary

  • pass the requested launch cwd into the Codex app-server sidecar
  • normalize WSL path input before spawning the app-server child
  • add regression coverage for planner input threading and runtime child cwd

Root cause

The sidecar-owned Codex app-server was always spawned in Freshell's own cwd instead of the requested launch directory. That caused Codex sessions to boot against the wrong project context, which in turn surfaced the trust warning and incorrect startup directory behavior.

Testing

  • npm run test:vitest -- --config vitest.server.config.ts test/unit/server/coding-cli/codex-app-server/runtime.test.ts test/unit/server/coding-cli/codex-app-server/launch-planner.test.ts test/integration/server/codex-session-flow.test.ts test/server/ws-terminal-create-reuse-running-codex.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1af9510bb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

'--listen',
wsUrl,
], {
...(this.cwd ? { cwd: this.cwd } : {}),
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 Handle spawn errors when applying requested sidecar cwd

Passing cwd into spawn allows startup to fail with ENOENT when the requested directory is missing (for example, a stale/deleted project path), and this runtime still has no child.on('error') handler. In Node, that emits an unhandled error event and crashes the process instead of surfacing a normal launch failure/retry; this became reachable with the new cwd threading in this commit.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant