Repository navigation
fix(codex): omit --sandbox on exec resume - #797
Conversation
Codex 0.152.0 accepts --sandbox on fresh exec but rejects it on resume, so every follow-up turn died with exit 2. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a0e106b34
ℹ️ 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".
| if (!sessionId) { | ||
| args.push("--sandbox", codexSandboxFor(permissionMode)); |
There was a problem hiding this comment.
Invalidate Codex sessions when the sandbox mode changes
When an existing Codex thread changes permission mode, Composer.pickMode and services.setPermissionMode update permissionMode without clearing sessionId; this branch then resumes the session while, as the preceding comment states, retaining its first-turn sandbox. A thread started with bypassPermissions therefore remains danger-full-access after the user selects Plan, even though the UI reports the read-only mode, and the inverse transition also remains unexpectedly restricted. Clear/restart the Codex session when the selected mode maps to a different sandbox, or otherwise ensure the resumed turn receives the newly selected policy.
Useful? React with 👍 / 👎.
Summary
--sandboxonexecbut rejects it onexec resume, so every follow-up turn died with exit 2 (unexpected argument '--sandbox').execstill passes--sandbox(issue Codex threads run in a read-only sandbox; Solenta never passes --sandbox #170). Resume inherits the first-turn sandbox.Test plan
node --test electron/test/providers.test.js— resume argv has no--sandbox; fresh exec still hasworkspace-writenode --test electron/test/codex.test.js— runner resume path omits--sandboxcodex updateifgpt-5.6-solstill asks for a newer CLI)Made with Cursor