Windows sandbox applies DENY ACLs to .git directories in writable_roots, breaking git commits
What version of Codex CLI is running?
0.122.0
What subscription do you have?
PRO
Which model were you using?
gpt-5.4
What platform is your computer?
Windows 11 PRO
What terminal emulator and version are you using (if applicable)?
Gitbash/Powershell
What issue are you seeing?
Summary
After updating to the version released ~2026-04-20, Codex applies DENY ACEs to .git directories inside any path listed
in writable_roots, permanently breaking git commit (and any operation requiring .git/index.lock) for the sandboxed
process.
Root Cause
PR #18443 changed sandbox ACL setup to expand USERPROFILE into its direct children rather than granting the root. For
users whose repos live under a USERPROFILE child (e.g. C:\Users\me\OneDrive\...), those repos are now in scope for
sandbox ACL grants. The sandbox applies DENY ACEs to the repo's .git directory — presumably to protect git history —
but those DENY ACEs are not cleaned up and persist after Codex exits, reapplied on every startup.
Observed Behavior
fatal: Unable to create '.../.git/index.lock': Permission denied
icacls .git shows explicit DENY ACEs for the sandbox SID:
.git S-1-5-21-<sandbox-domain>-<id>:(DENY)(W,D,Rc,DC)
S-1-5-21-<sandbox-domain>-<id>:(OI)(CI)(IO)(DENY)(W,D,Rc,GW,DC)
- The DENY SID is the Codex sandbox identity (different domain from the local machine SID)
- Removing the ACEs manually with icacls /remove:d works temporarily
- Codex reapplies the DENY ACEs on next startup
- The user's own account (vasan) retains full control and is unaffected — only the sandboxed process is blocked
Environment
- OS: Windows 11 Pro
- Codex version: updated ~2026-04-20 (post-PR #18443)
- sandbox_mode = "workspace-write", [windows] sandbox = "elevated"
- Repo path: under C:\Users\<user>\OneDrive\... (OneDrive is a direct USERPROFILE child, so it falls into the expanded
roots after #18443)
Expected Behavior
.git directories inside writable_roots should be excluded from DENY ACE grants, consistent with how .ssh is excluded.
Git operations must work from within the sandbox.
Suggested Fix
In codex-windows-sandbox, add .git to the same exclusion list used for .ssh, .tsh, .brev. Apply the same pattern PR
#18493 uses for SSH config scanning — just statically exclude .git at any depth within a writable root, since the
sandbox has no legitimate reason to DENY-lock version control internals.
// alongside .ssh, .tsh, .brev exclusions:
".git",
What steps can reproduce the bug?
create .git under onedrive and have codex commit to it -- was working flawlessly till this upgrade.
What is the expected behavior?
"• I found the root cause: ACL on .git has an explicit DENY write entry for the Codex sandbox SID, so this
session cannot create index.lock (staging/commit blocked). I’ll try removing that deny ACE and then
finish commit/issue closeout." -- per codex itself
Additional information
_No response_
11 Comments
@whyrv this made windows sandbox consistent with behavior on macos and linux. in
workspace-writesandbox mode, writes to.gitare not allowed.What is the workaround to restore old behavior: sandbox = "unelevated" doesn't seem to help either. The original behavior was working for months until this breaking change.
same issue here.
Additional Windows desktop repro details from my setup, in case this helps narrow it down.
Environment:
D:\Develop(so not underC:\Users\.../ not under OneDrive)sandbox_mode = "workspace-write"[windows] sandbox = "elevated"What I observed before switching to full access:
whoami->popke-dell-pc\paltewhoami->popke-dell-pc\codexsandboxonline.git, but the autonomous backend tool path could not.New-Item -Path D:\Develop\.git\index.lock -ItemType File -ForceRemove-Item D:\Develop\.git\index.lock -Force.gitwith:Set-Content D:\Develop\.git\tool-check.tmp okAccess to the path 'D:\Develop\.git\tool-check.tmp' is denied.danger-full-accessimmediately changed the backend tool behavior:whoamibecamepopke-dell-pc\palte.gitSo there seem to be two useful data points here:
C:\Users\..., at least in the desktop app.workspace-write, there is a Windows desktop identity split where the visible terminal can access.git, but autonomous backend tool execution still runs as the sandbox user and cannot.Workaround on my machine:
sandbox_mode = "danger-full-access"That is the only setting that restored autonomous Git writes for me.
@paltenburg , danger-full-access is exactly that... CODEX now has unrestricted access to do anything on your system. @viyatb-oai , I'll say the same thing I said in the other thread: Confirming that a change which made the product unusable is not an acceptable response to a bug report
sandbox_mode = "danger-full-access" works for me. So the fix from open-ai is to make the sandbox less secure by the user to go back to a working state,
They use LLM to develop a feature, that development breaks something that worked before introducing a new set of bugs. They fix them and introduce again a new set of bugs. Their process repeats and we see thousands of bugs reported in this repo, claude code etc. at the same time. The whole process is a joke. Devs do much better job than those modern AI agents everyone is worshipping so much. I have never seen so many issues in the apps developed by humans.
This particular issue works well with Claude Code, Kimi-cli, etc. So, it is specific to Codex’s over-protection and requires the user to keep the backdoor unlocked in this scenario.
This is still happening to me.
I’m seeing the same thing on Windows in Codex app.
The UI says Full access, and Codex can edit normal files, but
git addfails with:fatal: Unable to create '<repo>/.git/index.lock': Permission denied
There is no existing
index.lock. The.gitACL has explicit Deny entries for Write/Delete, so this looks like the same DENY ACL issue.The confusing part is that Full access is selected, but
.gitstill isn’t writable.I am experiencing what appears to be the same underlying bug in Codex Desktop on Windows 11, with two additional details: the repository is outside
USERPROFILE, and the failure occurs in a linked Git worktree.Sanitized setup
workspace-writesandbox.gitfile resolves to the main repository’s.git/worktrees/<worktree>directoryObserved behavior
fatal: Unable to create '.../.git/worktrees/<worktree>/index.lock': Permission denied
DENYentries on.gitor the resolved linked-worktree Git directory for sandbox-created identities.git addandgit commitcommands succeed immediately in regular, non-administrator PowerShell..gitpaths in the Codex workspace configuration does not overcome the Windows ACL denial..git.This forces Codex to ask the user to stage and commit changes outside the app.
Expected behavior
.git/worktrees/<worktree>directory.The current workaround is running Git mutations in ordinary PowerShell. Administrator privileges are not required.