Testing in sandbox is failing often on OSX (asking for running outside sandbox often).
What version of Codex is running?
codex-cli 0.3.0
Which model were you using?
codex-mini-latest
What platform is your computer?
Darwin 24.4.0 x86_64 i386
What steps can reproduce the bug?
I have a project that uses vitest, for example (package.json):
...
"scripts": {
"test": "vitest"
},
...
When I run npm run tests it works. However when codex tries to run tests, it tries many things like npx vitest run and it keeps failing and asking to run it outside the sandbox. I often run codex in full-auto and I find this adds friction.
What is the expected behavior?
vitest works in the sandbox the first time (it's not using the internet?)
What do you see instead?
I'm attaching a screenshot where codex suggests the problem is because my node binary is a MacOS build and the sandbox runs Linux, I will try to fix it following these lines, anyhow, if this is the case, I think this should be documented upfront, or better, detected and fixed when installing codex.
<img width="917" height="1584" alt="Image" src="https://github.com/user-attachments/assets/8d856c24-2d58-43bc-8a94-28ccf5d4f56b" />
<img width="914" height="903" alt="Image" src="https://github.com/user-attachments/assets/c5aaeb43-090f-4287-b4bd-96763a9e093a" />
<img width="927" height="660" alt="Image" src="https://github.com/user-attachments/assets/92093500-ba18-4bbb-8c3c-61e0082e49c3" />
<img width="915" height="967" alt="Image" src="https://github.com/user-attachments/assets/ec4539bd-9d8a-47ec-a0e9-5d99ffc34743" />
<img width="928" height="970" alt="Image" src="https://github.com/user-attachments/assets/13568d0d-bf92-4f16-a200-6967ff74d670" />
<img width="926" height="663" alt="Image" src="https://github.com/user-attachments/assets/ac2eaf46-7c3d-49af-9dad-4d9b1c2a476a" />
Additional information
I can test this by just asking codex if it can verify that it can run vitest
18 Comments
It seems to be solved by using the linux builds, here's how I did it (for reference):
Maybe it would be nice that if codex runs into this issue (it's often testing a lot during iteration and failing) it can suggest solution / pinpoint the problem?
Still getting this though:
I have the same issue. Codex is practically unusable on MacOS because of this.
@stellar-scottreed This works if you know what you're doing
$ codex --dangerously-bypass-approvals-and-sandboxIt works by allowing codex to run any commands it wants outside of sandbox. Would have to setup a docker sandbox for it because I certainly don't trust it to run any commands it wants on my host machine!
So it's acceptable that the only way to
codexrun shell commands in a way that works (like all similar tools can do) is to completely disable any prompts that would allow you to allow or deny a command before it runs?In my opinion, the intuitive behavior would be to respect the answer I give to the prompt and actually run it outside the sandbox. I'm not going to enable it to run any arbitrary command without any prompt, and neither should anyone.
It's not about allowing or denying commands, it's about the commands running in a sandbox. The reason it asks to allow/deny at all is because there is an error every time it tries to run a command within the sandbox.
@stellar-scottreed That's right, it's a temporary work-around, the real problem is getting the sandbox to "just work" identically to your shell. In my experience, as long as you don't tell the model anything that can make it upset 😆 , it won't just do anything dangerous out of nowhere, but the risk is there nevertheless.
What I said is correct if you ignore the implementation details and look at the current behavior. Since I was only trying codex while waiting for my Claude Code credits to recharge, I'm not exactly super invested in the implementation yet. I signed up for a 2nd claude account on a different email so problem solved. For me at least.
I do recommend fixing this problem, since having it be broken (regardless of the whys and hows) out of the box on MacOS may lead to lower adoption. Most people aren't going to look for github issues and leave a comment. I'm doing this for the project's benefit. You should know that for every person commenting there might be hundreds or thousands who will just move on.
Sandboxing on MacOS works like garbage:
1) grep is often timed out and getting repeated multiple times
2) calling build and test do not work most of the time so Codex can't even check if the generated of changed code compiles or works correctly
ATM Codex is the worst of agent CLIs and this should be fixed ASAP.
+1, most of the commands on MacOS just do not work, if they use stuff that is blocked by the sandbox. The thing is, it blocks almost everything, like using
psor killing script's child processes. It's not clear (for me) why it needs to restrict the commands I wrote myself and I already approved to run? Like with other coding agents, you approve a command, and then the agent runs it in your shell. If you don't trust the agent you can configure it to never run commands without approval. But once it's approved, what is the point of not allowing my own scripts to use my own host utilities just because they were started by the agent?It'd be great to disable sandboxing but still have an option to approve commands the agent wants to run.
I hit this on macOS running Jest integration tests in Codex CLI. By default, Jest runs tests in parallel, and the sandbox can’t keep up—jobs time out. Forcing serial execution avoids the timeouts, though it’s slower (my suite still takes \~5–6 minutes):
Not a true fix, but it keeps things moving within sandbox limits.
I'm no longer seeing this behavior in the latest version with GPT-5.
It works if you set sandbox mode to at least
workspace-writein your Codex config.I have my sandbox set to - workspace-write but still the sandbox commands just fail with Signal(11)
I'm failing to run tests inside codex, presumably due to some sandbox issues.
Why isn't
--yoloenough? Sigh.i basically create a task for the agent to create a script for npm installs and auto bash command to run once script is created...it therefore runs outside of sandbox for where its blocked (not ideal but just a workaround)
Still hitting this even on basic
yarn create next-appand even after tryingcodex --dangerously-bypass-approvals-and-sandbox