`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?

  1. Create a patch that writes into a new directory under .codex-tmp.
  2. Run apply_patch once. It succeeds.
  3. Run apply_patch again against a file in that same directory.
  4. 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-tmp and subdirectories created during the test are owned by TEN-OF-HEARTS\CodexSandboxOffline.
  • The failure is reproducible for both:
  • .codex-tmp\fresh-lab
  • .codex-tmp\apply-patch-lab
  • even .codex-tmp itself once apply_patch tries 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.

View original on GitHub ↗

18 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14585
  • #14675
  • #14409

Powered by Codex Action

GitMurf · 4 months ago

@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.

GitMurf · 4 months ago

@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

TenofHearts · 3 months ago
@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: #14675 (comment)

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

GitMurf · 3 months ago
Apparently there's some issue with files in directories created by codex entirely by itself.

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.

TenofHearts · 3 months ago

@GitMurf I'll settle for recreating the directories for now. Haven't encountered any problem yet. Thanks for letting me know what you found

GitMurf · 3 months ago

@TenofHearts glad my workaround is working for you, but please keep this issue open until we hear from the codex team. Thanks!

TenofHearts · 3 months ago

@GitMurf Sure thing. I don't understand what's taking them so long to at least address the problem

victor21813 · 3 months ago

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?

Kingwolf123 · 3 months ago

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

stupidhero · 3 months ago

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.

GitMurf · 3 months ago

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?

Kingwolf123 · 3 months ago

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

iceweasel-oai contributor · 3 months ago

hey all - we are working on it. I have a fix that I've made recently that should hit the production app soon

n00mkrad · 2 months ago
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

iceweasel-oai contributor · 2 months ago

@n00mkrad this should have been fixed in early April. Are you still seeing this issue?

iceweasel-oai contributor · 2 months ago

marking as closed for now, but please re-raise if you still see it

n00mkrad · 2 months ago
@n00mkrad this should have been fixed in early April. Are you still seeing this issue?

Yes.

$ rg -n "def normalize_luma|normalize_luma\(" -S vapoursynth

execution error: Io(Custom { kind: Other, error: "windows sandbox: setup refresh failed with status exit code: 1" })
$ if (Test-Path notes/history.md) { Get-Content notes/history.md } else { "__MISSING__" }

execution error: Io(Custom { kind: Other, error: "windows sandbox: setup refresh failed with status exit code: 1" })