apply_patch fails for nested files under src/** with sandbox refresh error
Open 💬 15 comments Opened Mar 14, 2026 by pzarzycki
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
apply_patch fails for nested files under src/** on Windows with:
windows sandbox: setup refresh failed with status exit code: 1
Observed behavior:
apply_patchworks for root-level files insidesrcapply_patchworks for nested files outsidesrcapply_patchfails for nested files undersrc/**- normal shell/file writes succeed in the same failing directories
This suggests a Windows sandbox/path-handling bug in the patch flow rather than a filesystem permission problem.
Expected behavior:
apply_patchshould work for writable nested files undersrc/**the same way it works elsewhere in the workspace
15 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional sanitized details:
Reproduction boundary observed on Windows:
apply_patchsucceeds for root-level files directly undersrc, for examplesrc/App.cssapply_patchfails for nested files undersrc/**, for examplesrc/core/hopfield.ts,src/features/hopfield/ControlPanel.tsx, andsrc/workers/hopfield.worker.tsapply_patchsucceeds for nested files outsidesrc, such as files underscripts/**,public/**, and another synthetic nested directory outsidesrcsrc/**directories succeed, including create/edit/deletesrc/**This was also reproduced in Codex CLI on Windows with the same exact error:
In the CLI reproduction, a root-level
src/numeric.d.tspatch succeeded while a nestedsrc/workers/hopfield.worker.tspatch failed with the same sandbox refresh error.This suggests the issue is not desktop-app-specific. It appears to be a shared Windows sandbox / patch-application bug affecting nested files under
src/**.Can easily reproduce:
<details>
<summary>Log</summary>
</details>
This seems to be a regression in
0.114.0; as a workaround, you can downgrade to the previous version of@openai/codex.Pinging some related issues since there seem to be many similar reports:
Adding to this. Here is below the troubleshooting and reporting that I had Codex put together for me on what I am running into (similar to OP).
I can confirm that the regression/issue happened at
0.114as @apkd mentioned above. When I roll the Codex CLI back to0.113I no longer have these issues.The problem is that I use the Codex App and with that it appears I cannot roll back to a previous version so I cannot use the Codex App until this is fixed.
@apkd have you tried with the Codex App to get it to use an older version under the hood?
~~I have tried, but I haven't found a way. The workarounds to allow write access to Windows Store app files no longer seem to work. The entire Windows platform seems increasingly annoying and locked down. I am literally this close to switching to Linux today.~~
🐧 SEEYA SUCKERS 🐧
cc @apkd @pzarzycki
Ok, I found a bit of a solution! Still don't know the cause of how/why certain subdirectories were created in a certain way that created issues but below is the write-up that I came up with via Codex based off our intense debug/troubleshooting/repro session:
TLDR Workaround / Solution
Have Codex move the affected top-level directories out of the way, recreate those directories fresh at the repo root, then recreate the same subdirectory structure and COPY (do not move) the tracked files back into the fresh directories. Do not move the old files/directories back in-place, because moves can preserve the old ACLs; copying into the fresh directories is what made
apply_patchstart working again for us.Codex Detailed Write-Up
We were hitting
apply_patchfailures on Windows with:windows sandbox: setup refresh failed with status exit code: 1What we found:
apply_patchfailed specifically in certain existing subtrees, while root-level and some freshly created paths worked.apps/orpackages/,apply_patchworked there. But old existing subtrees underapps//packages/still failed.Workaround that fixed it for us:
apps,packages,scriptsin our case).Important: copy files, do not move them back in-place, because moves can preserve the old ACLs.
apply_patchon both disposable temp files and real tracked files.apply_patchnow works throughout the repo again.Hunch:
hey @GitMurf @pzarzycki @apkd sorry it took me a while to get to this.
I'm not able to reproduce this locally, so what would be really helpful would be if you could send me your sandbox.log file located at
%USERPROFILE%\.codex\.sandbox\sandbox.logor at least the parts of it around when the bug occurred.Also a dump of ACLs on the affected directories would help, something like
icacls "C:\path\to\repo\root"
icacls "C:\path\to\working\dir"
icacls "C:\path\to\failing\dir\.."
@iceweasel-oai
https://cpaste.de/raw/iminerotat
@Brokkonaut thanks - that is helpful. Would you mind running a few commands locally to help me debug this?
@iceweasel-oai I just submitted with
/feedbackanother similar issue that hopefully can help with the troubleshooting. I am not sure if others usepnpmand if that is part of the issue with howpnpmworks with its "symlinking" etc. but I ran into another ACL / access issue with Electron build process because it was running with the codex sandbox account. Details are in the /feedback report but also I pasted below for quick reference.Feedback ID: 019d306f-186b-7710-9213-8a01bfc463bf
TLDR /feedback report
On Windows, the Codex sandbox account can’t reliably run
pnpm package:desktopbecause the sandbox user ends up unable to read a hoisted dependency undernode_moduleseven afterpnpm install/pnpm install --force. In our case, Electron Forge failed withError: Cannot find module 'chalk'from@electron-forge/cli, while the same command succeeded when run outside the sandbox with elevated permissions under the host account.How to reproduce
pnpm install.pnpm package:desktop.Error: Cannot find module 'chalk'node_modules\@electron-forge\cli\dist\electron-forge.jsObserved behavior
pnpm package:desktopfails with module resolution/ACL issues.pnpm package:desktopsucceeds and completes Electron Forge packaging.Workaround
Run the command outside the sandbox / with elevated permissions so it uses the host account permissions instead of the Codex sandbox account. In our case, that made
pnpm package:desktopcomplete successfully.Notes
@iceweasel-oai https://cpaste.de/raw/iqefozoliy
@iceweasel-oai any updates?
@iceweasel-oai any updates?
Still reproducible on Codex CLI 0.144.6, Windows 11 build 26200, with
[windows] sandbox = "unelevated".The session root was
C:\Users\<user>, with the repository nested under it.apply_patchsuccessfully created a new file, but two attempts to update an existing file returned empty output with no patch completion event. Normal shell-based edits worked, and the existing/new files had identical ACLs.A separate sandboxed command also failed with:
SetTokenInformation(TokenDefaultDacl) failed: 1344This appears related to the same path-sensitive Windows sandbox/ACL issue.