Bug Report: Commands failed to run in sandbox in Codex CLI

Resolved 💬 6 comments Opened Oct 8, 2025 by Icarus603 Closed Oct 8, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.45.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

This kind of errors occurred a lot: I asked codex to run "git add ." and it failed immediately and returned stuff like "failed in sandbox". But when I asked it to run it again and ask for my approval, it succeeded easily. Other kinds of commands failed like this too. Seems that Codex tends to run commands (bash/python etc.) in sandbox but not locally... Could you fix this and make it more robust?

What is the expected behavior?

The agent already lives in the terminal so it shouldn't be running things in sandbox. Codex CLI should just run the commands locally. (Donno if this is right...)

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] contributor · 10 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #4928
  • #4915
  • #4859
  • #3140
  • #2940

Powered by Codex Action

dylan-hurd-oai contributor · 10 months ago

(Note: this comment was generated by Codex.)

Thank you for reporting this! This appears to be a duplicate of #4928. We’ll track the issue there to keep discussion in one place. If you think this is an incorrect diagnosis, please reply here and we’ll revisit.

ahernandezmiro · 3 months ago

this is still happening to me on latest codex versions

ffxsam · 3 months ago

This is incredibly annoying. pnpm type-check always hangs, and winds up creating a new .pnpm-store/ folder in my project folder due to pnpm running in some sort of sandbox.

fblgit · 3 months ago

when i git commit in another terminal, the codex sandbox stops working, the model goes for dirty-perl|python inline cmd edits instead of apply_patch due to sandbox failure: it doesnt recover.

ffxsam · 3 months ago

Solution/workaround found. Create ~/.codex/rules/pnpm.rules and paste this into it:

prefix_rule(
  pattern = ["pnpm"],
  decision = "allow",
  justification = "Allow all pnpm commands"
)