Unified exec broken on linux since 0.57.0
Resolved 💬 6 comments Opened Nov 10, 2025 by Szpadel Closed Nov 12, 2025
💡 Likely answer: A maintainer (jif-oai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.57.0
What subscription do you have?
Pro
Which model were you using?
any
What platform is your computer?
Linux 6.17.5-cachyos1.lto.fc43.x86_64 x86_64 unknown
What issue are you seeing?
When feature.unified_exec is enabled all execution commands fail (since alpha.5 I believe) with
error: unexpected argument '--sandbox-policy-cwd' found
What steps can reproduce the bug?
set feature.unified_exec to true
ask model to run any command
What is the expected behavior?
_No response_
Additional information
_No response_
6 Comments
Do you have any reference to
codex-linux-sandboxin yourPATH? Or multiple installation of codex?No, it's reproducible with simple
bunx @openai/codexwithout any other codex installation in the PATHThis should be fixed in the latest alpha.
I can still reproduce this on WSL2 with a current setup, and for me it appears to be the same underlying failure mode.
Environment:
0.122.00.122.0-alpha.13bubblewrap 0.11.1bwrap --helpincludes--argv0Without legacy landlock, even a minimal sandbox smoke test fails:
with:
With legacy landlock enabled, the equivalent minimal test succeeds:
I also checked the generated helper shim directly, and it does support the flag:
which shows:
So this does not look like the older
bwrap --argv0issue. It looks more like the non-legacy Linux sandbox re-exec path is landing in the normalcodexCLI parser instead of the sandbox-helper mode, causing--sandbox-policy-cwdto be rejected.Current workaround for me is:
That restores normal sandbox behavior, but it now emits a deprecation warning.
I can reproduce a closely related failure on Linux with Codex CLI 0.132.0 / 0.133.0.
It looks like
--sandbox-policy-cwditself is not a public CLI option. It is accepted only when the native Codex binaryis invoked with
argv[0] == "codex-linux-sandbox".This matches the linux-sandbox README:
https://github.com/openai/codex/blob/main/codex-rs/linux-sandbox/README.md
What I observed:
```bash
# Works: native binary sees argv0=codex-linux-sandbox and enters linux sandbox helper mode
bash -lc 'exec -a codex-linux-sandbox /path/to/native/codex --help'
# Fails: npm wrapper does not propagate argv0 to the native binary
bash -lc 'exec -a codex-linux-sandbox /path/to/npm/bin/codex --sandbox-policy-cwd /tmp -- /bin/true'
# error: unexpected argument '--sandbox-policy-cwd' found
In my current session, sandboxed tool execution is launched roughly as:
bwrap ... --argv0 codex-linux-sandbox -- /home/user/.local/bin/codex --sandbox-policy-cwd ... --command-cwd ...
--permission-profile ...
So if /home/user/.local/bin/codex points to the native binary, unified exec works. If it points to the npm wrapper, the
helper argv0 is lost and the command is parsed by the public CLI, causing the unexpected argument error.
This suggests the failure mode is not that --sandbox-policy-cwd was removed, but that the npm wrapper path does not
preserve argv0=codex-linux-sandbox when re-execing the native binary.
A possible fix would be for bin/codex.js to pass argv0: process.argv0 (or otherwise preserve the helper argv0) when
spawning the native binary.
Follow-up from my side: this is now resolved in my environment with Codex CLI 0.137.0.
I was previously able to reproduce a closely related failure on Linux with Codex CLI 0.132.0 / 0.133.0.
My current understanding is that
--sandbox-policy-cwdis not a public CLI option. It is accepted only when the native Codex binary is invoked withargv[0] == "codex-linux-sandbox".This matches the linux-sandbox README:
https://github.com/openai/codex/blob/main/codex-rs/linux-sandbox/README.md
What I observed: