You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
› Move the last 2 commits to a branch called "codex-rackleave".
• Explored
└ List heads
• Ran git branch --show-current
└ master
• Ran git checkout codex-rackleave
└ failed in sandbox: fatal: Unable to create '/Users/morbo/git/scrax/.git/index.lock': Operation not permitted
• I'm exploring why git can't create the index.lock file, likely due to system-level restrictions such as immutable flags or
extended attributes on the .git directory or its files, which blocks changing branches or modifying the index. I'll check
further with xattr -l .git to see if any attributes prevent write operations despite chmod changes.
And so on, while the model tries to debug why it can't write things.
I suspect this decision was made because agents have been known to inadvertently blow away entire projects, and we probably don't want them to take the .git folder with it.
@chall37 is correct. Eventually we will have more fine-grained control over the sandbox, but for now if you want write access to .git you'll need to pass --dangerously-bypass-approvals-and-sandbox.
I was able to fix this problem by telling codex to escalate any write operations on Git. That disables the sandbox protection and allows the commits to go through.
Activity
chall37 commentedon Oct 10, 2025
This is probably functioning as intended, see:
80555d4
I suspect this decision was made because agents have been known to inadvertently blow away entire projects, and we probably don't want them to take the .git folder with it.
nornagon-openai commentedon Oct 10, 2025
@chall37 is correct. Eventually we will have more fine-grained control over the sandbox, but for now if you want write access to .git you'll need to pass
--dangerously-bypass-approvals-and-sandbox.gcp commentedon Oct 10, 2025
With the competition (ahem) this would generate a request for approval to the user, who can then sanity check the git command.
fortuna commentedon Nov 3, 2025
I was able to fix this problem by telling codex to escalate any write operations on Git. That disables the sandbox protection and allows the commits to go through.
Codex should add that to their system prompt.
dmahurin commentedon Nov 13, 2025
@nornagon-openai and others,
Instead of elevating permissions, we can create a separate shadow git directory for codex to commit changes to.
Here is a script that allows this.
https://github.com/dmahurin/git-shadow/blob/main/mk-git-shadow
This script creates a new git-dir using object alternates to inherit form the existing .git and a worktree which points back to the current directory.
Use:
mk-git-shadow .aigit
GIT_DIR=
pwd/.aigit npx @openai/codex ...Then review and pull:
git --git-dir .aigit log
git pull .aigit