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
{{ message }}
Repository navigation
VS CODE Codex extension : Apply_patch is failing #14744
bugSomething isn't workingextensionIssues related to the VS Code extensiontool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems
The error code the AI tells me it's getting when I ask why the edits are rejected; windows sandbox: setup refresh failed with status exit code: 1
It seems to be able to edit files in the root of my project. But fails on any sub-folders.
If I change the Permissions from Default Permissions to Full Access, the it works without errors. Though, I'd rather not give the AI access to my whole system.
Codex CLI and Codex Windows app suffers the same way. apply_patch is failing in Default sandbox for some files (often in /src/**). Forces to allow codex full permission.
Codex is borderline unusable on Windows because of the patch tool issue. Wastes loads of tokens trying the tool and going on direct file edits, then failing those edits and trying again.
It's slow, it's wasteful and just a broken product. The customers paying for the most tokens on your most expensive models should probably have this fixed in a timely manner.
@jvvilar et al, I agree! 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: #14675 (comment)
Can't use the Codex App for the VScode extension, but can at least use the Codex CLI directly for now.
Can confirm that @GitMurf 's suggestion works. Installed codex v0.113.0 and the patch tool works perfectly in VScode's integrated terminal. Thanks for the tip.
@jvvilar 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)
Has this been fixed?
How can codex windows be left without this unpatched / fixed?
This issue makes it practically unusable because i , along with majority of people dont want to risk giving full unabated access to all my PC . Without full access, codex is practically useless for any actual work in VS Code or even using Codex app, for which i believe this bug is also present, and i find that working with it has been untenable
Codex sandbox on Windows works terribly. It forces the user to turn on dangerous full permissions often.
Example: I have gh command authenticated. Codex from sandbox is unable to run it, doesn't request user permissions, even in "auto-guardian" mode.
At the same time messes with user permissions on the NTFS. There are files in .git/ and node_modules/ I don't have permission to. Forces to run administrative cleanup, etc.
Example: I have gh command authenticated. Codex from sandbox is unable to run it, doesn't request user permissions, even in "auto-guardian" mode.
Agree... but what I have found is gh (and most other tools that have issues) will work if you tell Codex whenever there is a CLI tool / permission issue to try running using the elevated permissions "tool". I have it in my agents md and it has actually been fairly reliable to follow it. Then when it runs gh for example it is authenticated as my user and works fine.
Very annoying though. And my latest frustration is trying to use worktrees in Codex App because it has git issues and has to add each worktree folder to git config (and they use uuids so has to happen with every worktree).
If the codex command runs, this is your problem. (If the Codex is not found, ask the chat itself to run the command, and it will figure out the path.
Then fix the problem
Create an AppArmor rule for Codex:
sudoedit /etc/apparmor.d/codex-bwrap
paste (change the YOURUSERNAME to your user name, of course):
abi <abi/4.0>,
include <tunables/global>
profile codex-bwrap /home/YOURUSENAME/.vscode-server/extensions/openai.chatgpt-*-linux-x64/bin/linux-x86_64/codex-resources/bwrap flags=(unconfined) {
userns,
include if exists <local/codex-bwrap>
}
bugSomething isn't workingextensionIssues related to the VS Code extensiontool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Mar 15, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Mar 15, 2026
Please provide the version number of the app that you have installed.
Kingwolf123 commentedon Mar 15, 2026
VS CODE: 1.111.0
Codex extension for VS CODE : 26.311.21342
Norway174 commentedon Mar 15, 2026
Can confirm, I have the same issue as well.
VSCode:
1.111.0Codex extension:
26.5311.21342The error code the AI tells me it's getting when I ask why the edits are rejected;
windows sandbox: setup refresh failed with status exit code: 1It seems to be able to edit files in the root of my project. But fails on any sub-folders.
If I change the Permissions from Default Permissions to Full Access, the it works without errors. Though, I'd rather not give the AI access to my whole system.
pzarzycki commentedon Mar 16, 2026
Codex CLI and Codex Windows app suffers the same way.
apply_patchis failing in Default sandbox for some files (often in /src/**). Forces to allow codex full permission.Shen commentedon Mar 17, 2026
Also the same problem:
Codex extension: 26.5313.41514
VSCode: 1.111.0
Wangningsen commentedon Mar 17, 2026
My codex extension 26.313.41514 is also still having this bug
jvvilar commentedon Mar 20, 2026
Codex is borderline unusable on Windows because of the patch tool issue. Wastes loads of tokens trying the tool and going on direct file edits, then failing those edits and trying again.
It's slow, it's wasteful and just a broken product. The customers paying for the most tokens on your most expensive models should probably have this fixed in a timely manner.
GitMurf commentedon Mar 20, 2026
@jvvilar et al, I agree! 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: #14675 (comment)
Can't use the Codex App for the VScode extension, but can at least use the Codex CLI directly for now.
jvvilar commentedon Mar 20, 2026
Can confirm that @GitMurf 's suggestion works. Installed codex v0.113.0 and the patch tool works perfectly in VScode's integrated terminal. Thanks for the tip.
GitMurf commentedon Mar 20, 2026
@jvvilar 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)
Kingwolf123 commentedon Mar 27, 2026
Has this been fixed?
How can codex windows be left without this unpatched / fixed?
This issue makes it practically unusable because i , along with majority of people dont want to risk giving full unabated access to all my PC . Without full access, codex is practically useless for any actual work in VS Code or even using Codex app, for which i believe this bug is also present, and i find that working with it has been untenable
This needs to be fixed ASAP.
pzarzycki commentedon Mar 28, 2026
Codex sandbox on Windows works terribly. It forces the user to turn on dangerous full permissions often.
Example: I have
ghcommand authenticated. Codex from sandbox is unable to run it, doesn't request user permissions, even in "auto-guardian" mode.At the same time messes with user permissions on the NTFS. There are files in .git/ and node_modules/ I don't have permission to. Forces to run administrative cleanup, etc.
Really frustrating.
GitMurf commentedon Mar 28, 2026
Agree... but what I have found is gh (and most other tools that have issues) will work if you tell Codex whenever there is a CLI tool / permission issue to try running using the elevated permissions "tool". I have it in my agents md and it has actually been fairly reliable to follow it. Then when it runs gh for example it is authenticated as my user and works fine.
Very annoying though. And my latest frustration is trying to use worktrees in Codex App because it has git issues and has to add each worktree folder to git config (and they use uuids so has to happen with every worktree).
franzbischoff commentedon Aug 17, 2026
I had this problem on my Linux, and Codex helped me solve it.
First, diagnose the problem
First, test if this resolves the problem temporarily:
If the codex command runs, this is your problem. (If the Codex is not found, ask the chat itself to run the command, and it will figure out the path.
Then fix the problem
Create an AppArmor rule for Codex:
paste (change the YOURUSERNAME to your user name, of course):
Validate the syntax
If no error, load the policy:
Confirm:
sudo aa-status | grep codex-bwrapReactivate the AppArmor if you had it disabled:
Try again and see if Codex runs (or try in the IDE):