codex icon indicating copy to clipboard operation
codex copied to clipboard

Code review feature completely broken due to bad sandboxing

Open douglascamata opened this issue 11 months ago • 27 comments

What version of Codex is running?

v0.66.0

What subscription do you have?

Team

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

macOS 15

What issue are you seeing?

Any of the /review commands is not being able to run simple shell commands, like git status --short, even though I am executing with --yolo (skipping all permissions and such).

Errors look like this:

  └ git: warning: confstr() failed with code 5: couldn't get path of DARWIN_USER_TEMP_DIR; using /tmp instead
    git: error: couldn't create cache file '/tmp/xcrun_db-8dRHB1xN' (errno=Operation not permitted)
    git: warning: confstr() failed with code 5: couldn't get path of DARWIN_USER_TEMP_DIR; using /tmp instead
    git: error: couldn't create cache file '/tmp/xcrun_db-e13d9WWl' (errno=Operation not permitted)

What steps can reproduce the bug?

Install Codex version v0.66.0 on a macOS 15 machine, start it with --yolo and use the /review command.

What is the expected behavior?

It can run commands outside of the sandbox, because I started it with --yolo.

Additional information

No response

douglascamata avatar Dec 10 '25 10:12 douglascamata

Bumped to v0.69.0 (I install via brew, so sometimes it lags behind on versions a bit) and the same issue still occurs.

douglascamata avatar Dec 11 '25 10:12 douglascamata

Bumped to v0.71.0 hoping that this would be fixed already: still broken.

douglascamata avatar Dec 11 '25 22:12 douglascamata

@etraut-openai: I can only reproduce this issue in the CLI. Through the extension the /review command works fine. I think that CLI label makes sense here.

douglascamata avatar Dec 11 '25 22:12 douglascamata

I encountered the same issue in the CLI as well

PhilChen-6765 avatar Dec 12 '25 17:12 PhilChen-6765

@etraut-openai I'm facing the same issue, and it's really bothering me. When using the /review command in CLI, it prompts the following: git: warning: confstr() failed with code 5: couldn't get path of DARWIN_USER_TEMP_DIR; using /tmp instead git: error: couldn't create cache file '/tmp/xcrun_db-SQmI6uR4' (errno=Operation not permitted)

I reverted the codex version to v0.65.0 without any issues; all subsequent versions have this problem.

PhilChen-6765 avatar Dec 13 '25 20:12 PhilChen-6765

One more codex-cli release, 0.72.0 this time, the issue is still present. @etraut-openai, do you think you guys will fix this anytime soon? Kind of losing hope here.

douglascamata avatar Dec 15 '25 10:12 douglascamata

@etraut-openai I'd like to work on this. Is this still available?

anupammaurya6767 avatar Dec 16 '25 05:12 anupammaurya6767

@anupammaurya6767, you're welcome to investigate the root cause. Post anything you find here.

etraut-openai avatar Dec 16 '25 06:12 etraut-openai

@etraut-openai Found the root cause: review mode was hardcoding the sandbox policy to read-only, ignoring --yolo.

anupammaurya6767 avatar Dec 16 '25 06:12 anupammaurya6767

This was an intentional change. See this PR.

@jif-oai, thoughts?

etraut-openai avatar Dec 16 '25 06:12 etraut-openai

I think you are on a good lead, @anupammaurya6767, but you are focussed on the wrong thing.

git status is somehow trying to write files outside the project's folder (see the error git: error: couldn't create cache file '/tmp/xcrun_db-8dRHB1xN' (errno=Operation not permitted)). So a heavily constrained read-only sandbox won't work.

The read-only sandbox should allow a git status to run, even if that git status needs to write a file to /tmp.

douglascamata avatar Dec 16 '25 08:12 douglascamata

I am not sure if git changed the implementation of git status to write these temporary files or if just the read-only sandbox got so good that even writes to /tmp are now blocked.

This indicates that we might need a special "review" sandbox that will allow git commands to write to /tmp if they need.

douglascamata avatar Dec 16 '25 08:12 douglascamata

@etraut-openai @douglascamata Thanks both for the clarification and extra detail.

anupammaurya6767 avatar Dec 16 '25 09:12 anupammaurya6767

I first assumed this was a /review + --yolo regression, but given that the always‑read‑only review sandbox is intentional, the real issue is that it’s now too strict for normal git usage: git status (and likely other git commands) need to write temp/cache files under /tmp, and those writes are being blocked, so even a “read‑only” review sandbox needs some controlled write capability.

anupammaurya6767 avatar Dec 16 '25 09:12 anupammaurya6767

A possible path forward would be a dedicated “review” sandbox policy that still keeps the workspace and other sensitive paths read‑only, but explicitly allows safe transient writes (like git’s temp files under /tmp) so /review works as expected. If that direction sounds acceptable, I’m happy to help explore what that policy should look like and try a prototype once you’re okay with the approach. @etraut-openai

anupammaurya6767 avatar Dec 16 '25 09:12 anupammaurya6767

A dedicated sandbox policy for /review doesn't sound like the right solution. That adds too much complexity.

etraut-openai avatar Dec 16 '25 15:12 etraut-openai

Seems like we have more users reporting similar issues: #8105 and #8104.

douglascamata avatar Dec 16 '25 15:12 douglascamata

Understood, a dedicated review sandbox policy would add complexity.

anupammaurya6767 avatar Dec 16 '25 16:12 anupammaurya6767

@etraut-openai A simpler fix: use the existing WorkspaceWrite policy for review, but configure it so the workspace itself is read-only (via read_only_subpaths) while /tmp remains writable. This lets git commands write their temp files to /tmp without allowing writes to the workspace.

anupammaurya6767 avatar Dec 16 '25 16:12 anupammaurya6767

If that direction works, I can draft a small change to switch review from ReadOnly to WorkspaceWrite with the workspace marked as a read-only subpath.

anupammaurya6767 avatar Dec 16 '25 16:12 anupammaurya6767