`apply_patch` fails on Windows after first write in sandbox-owned directory in VS Code Extension
Resolved 💬 18 comments Opened Mar 20, 2026 by TenofHearts Closed May 18, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the IDE extension are you using?
26.318.11754
What subscription do you have?
Plus
Which IDE are you using?
VS Code
What platform is your computer?
windows
What issue are you seeing?
On Windows, apply_patch succeeds when writing into a brand new directory, but subsequent apply_patch calls targeting the same existing directory fail before patch parsing/execution.
The failure happens during sandbox ACL refresh, not during patch application itself.
The first patch into a fresh directory succeeds:
*** Begin Patch
*** Add File: .codex-tmp/fresh-lab/probe.txt
+fresh
*** End Patch
A second patch against the same directory fails:
*** Begin Patch
*** Update File: .codex-tmp/fresh-lab/probe.txt
@@
fresh
+again
*** End Patch
Tool error:
execution error: Io(Custom { kind: Other, error: "windows sandbox: setup refresh failed with status exit code: 1" })
What steps can reproduce the bug?
- Create a patch that writes into a new directory under
.codex-tmp. - Run
apply_patchonce. It succeeds. - Run
apply_patchagain against a file in that same directory. - Observe failure before patch application.
What is the expected behavior?
apply_patch should continue to work on files inside an existing writable directory.
Additional information
ACL/owner inspection shows:
- Workspace root owner is the real Windows user.
.codex-tmpand subdirectories created during the test are owned byTEN-OF-HEARTS\CodexSandboxOffline.- The failure is reproducible for both:
.codex-tmp\fresh-lab.codex-tmp\apply-patch-lab- even
.codex-tmpitself onceapply_patchtries to refresh it as a write root
This suggests the issue is tied to sandbox-owned directories whose DACL is later re-written by sandbox setup.
18 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
@TenofHearts I am seeing similar behavior in the Codex App for Windows! For what its worth, the only "workaround" / fix for now is using the Codex CLI directly and rolling back to v0.113. See my comment here in another similar gh issue: https://github.com/openai/codex/issues/14675#issuecomment-4092786776
Can't use the Codex App or the VScode extension, but can at least use the Codex CLI directly for now.
@TenofHearts I was able to get a little further in debugging the issue. Here is a workaround that should work with current version of Codex: https://github.com/openai/codex/issues/14675#issuecomment-4101350142
Thanks a lot. Apparently there's some issue with files in directories created by codex entirely by itself. I think it must be some bug in the authority managing of the sandbox users
That was my original hunch but I did some testing and Codex was able to create new directories and files and apply edits no problem. I wonder if it was a previous version of Codex that was creating directories incorrectly, and now it is fixed but those legacy created directories are still a problem 🤷🏻♂️ Or there may be other ways Codex creates directories and a certain way causes the issue. Not sure. I was not able to reproduce after I fixed the current directory structure by re-creating.
@GitMurf I'll settle for recreating the directories for now. Haven't encountered any problem yet. Thanks for letting me know what you found
@TenofHearts glad my workaround is working for you, but please keep this issue open until we hear from the codex team. Thanks!
@GitMurf Sure thing. I don't understand what's taking them so long to at least address the problem
I’ve been stuck with this problem for three weeks now, and I still haven’t seen any official fix or response from the Codex team. I’m really curious what the current status is, because on Windows the extension is basically unusable at the moment. Could someone from the team please clarify whether this is being investigated or if a patch is planned?
This problem needs high priority. It still hasnt been fixed in the latest release today.
Codex is practically unusable for actual tasks because of this issue. I dont understand this can be left in the current state it is for this long.
Codex is UNUSABLE right now
Should be ACL related. The root directory has write access for the windows user, any (possible nested) sub-directory created by codex only grants read permissions to the windows user. apply_patch seems to be working fine once the windows user is given higher permissions.
A real shame we aren't getting any responses from the OpenAI team. Very frustrating. I haven't used Codex in a week because of this.
Has anyone tried t3code? How is their Windows support?
Still an issue with latest 0.118 release.
Why is OpenAI not working on this. This is the sort of critical bug u address FIRST. Should be affectings majority of windows users to make codex unusable
hey all - we are working on it. I have a fix that I've made recently that should hit the production app soon
Any moment now...
It's been well over a month
@n00mkrad this should have been fixed in early April. Are you still seeing this issue?
marking as closed for now, but please re-raise if you still see it
Yes.