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
Windows sandbox: apply_patch can add files but cannot update/delete existing files due to apply deny-read ACLs #31229
CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
What terminal emulator and version are you using (if applicable)?
Windows PowerShell 5.1.26100.8655
Codex doctor report
What issue are you seeing?
On Windows, apply_patch can create new files, but fails whenever it needs to read an existing file for Update File or Delete File. The failure happens even in a clean repro directory outside the main
project, so it does not appear related to project config, AGENTS.md, Git state, dependencies, symlinks, or file ACLs.
Error:
apply_patch verification failed: Failed to read file to update ...:
fs sandbox helper failed with status exit code: 1:
windows sandbox failed: helper_unknown_error: apply deny-read ACLs
What steps can reproduce the bug?
cd C:\data\javascript
mkdir codex-sandbox-repro
cd codex-sandbox-repro
git init
mkdir .scratch
"hello"|Set-Content .scratch\test.txt
Get-Content .scratch\test.txt
Then ask Codex to run:
*** Begin Patch
*** Update File: .scratch/test.txt
@@
-hello
+hello world
*** End Patch
Observed:
apply_patch Add File succeeds.
Get-Content can read the file.
icacls shows normal inherited permissions including CodexSandboxUsers modify rights.
apply_patch Update File fails with apply deny-read ACLs.
apply_patch Delete File fails with the same error.
Running shell commands with escalation works, so a workaround is to use PowerShell writes, but apply_patch has no escalation parameter.
What is the expected behavior?
apply_patch should be able to read and update/delete files inside the workspace when normal shell reads succeed and ACLs permit access.
Additional information
Starting Codex from the project root and using relative paths did not help.
Reading the target with Get-Content immediately before apply_patch did not help.
Switching to “Approve for me” did not help.
The same failure reproduced in a clean C:\data\javascript\codex-sandbox-repro git repo.
I think #30712 and the unelevated part of #31220 are closely related, but they do not look like the exact same failure mode as this issue.
This issue fails with:
windows sandbox failed: helper_unknown_error: apply deny-read ACLs
apply_patch Add File succeeds, but Update File / Delete File fail when the fs-helper tries to read an existing workspace file. Normal PowerShell reads succeed in the same clean repro directory.
By contrast, #30712 fails earlier while preparing the unelevated sandbox wrapper:
That looks like a split writable-root enforcement problem, while this issue looks like the helper launches but then incorrectly denies reading an existing file.
#31220 includes the same split-root failure as #30712, plus a separate elevated-mode CreateProcessAsUserW failed: 1312 problem.
#31086, #30964, and #29938 look related to Windows sandbox/setup-helper failures, but they center on codex-windows-sandbox-setup.exe, ShellExecuteExW failed to launch setup helper: 1223, module-not-found dialogs, or proxy/setup-marker mismatch. Those seem related but not exact duplicates of this apply deny-read ACLs repro.
I closed #31248 as likely related to this Windows sandbox read/ACL issue, but I want to preserve one additional data point.
In my reproduction, view_image failed with:
windows sandbox failed: helper_unknown_error: apply deny-read ACLs
This happened while using the elevated Windows sandbox. The local image existed on disk and was readable from PowerShell.
After changing:
[windows]
sandbox = "elevated"
to:
[windows]
sandbox = "unelevated"
view_image started working correctly.
So this may be useful evidence that the view_image failure is tied to the elevated Windows sandbox read/ACL path, not to image decoding or file existence.
I later encountered a different failure mode in unelevated mode:
This problem plagued me for far too long; I've now switched to running it under WSL.
The original installation has been uninstalled, and the previous logs are gone as well.
could you share the setup error: entry and following error lines from %USERPROFILE%\.codex\.sandbox\sandbox.YYYY-MM-DD.log after reproducing?
also, is .codex\.sandbox\deny_read_acl_state.json empty or valid json? no need to share its contents
I can reproduce this issue consistently on native Windows with codex-cli 0.156.0, in both Codex CLI and Codex Desktop.
I tested this while trying to enforce a company security policy that prevents Codex from reading sensitive configuration files while still allowing normal source-code editing.
Environment
Windows (native, not WSL)
codex-cli 0.156.0
Windows sandbox: elevated
What I observed
Without any filesystem deny rules:
Reading normal files works
Creating new files works
Editing existing files with apply_patch works
With sensitive files configured as deny under filesystem:
Reading normal files works
Reading denied sensitive files is correctly blocked
Creating new files still works
Editing existing normal files fails with Failed to apply patch
I reproduced the same behavior with the filesystem rules defined in:
the user config.toml
the managed requirements.toml
Removing only the filesystem deny configuration immediately makes apply_patch work again.
I also confirmed that the target normal files are not read-only and that the Windows user has normal modify permissions on them.
This makes it difficult to deploy Codex in our organization: we need to prevent Codex from reading files containing DB credentials, API keys, server information, etc., while still allowing developers to edit existing source files normally.
Could you please confirm whether this is a known limitation/bug in the native Windows sandbox, and whether a fix or supported workaround is planned?
I would be happy to provide additional reproduction details if needed.
CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Jul 6, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
apply_patchto fail before patching workspace files, forcing agents to fallback to bypass the sandbox and write files using powershell #30712Powered by Codex Action
pellorao commentedon Jul 10, 2026
I checked the suggested potential duplicates.
I think #30712 and the unelevated part of #31220 are closely related, but they do not look like the exact same failure mode as this issue.
This issue fails with:
apply_patch Add Filesucceeds, butUpdate File/Delete Filefail when the fs-helper tries to read an existing workspace file. Normal PowerShell reads succeed in the same clean repro directory.By contrast, #30712 fails earlier while preparing the unelevated sandbox wrapper:
That looks like a split writable-root enforcement problem, while this issue looks like the helper launches but then incorrectly denies reading an existing file.
#31220 includes the same split-root failure as #30712, plus a separate elevated-mode
CreateProcessAsUserW failed: 1312problem.#31086, #30964, and #29938 look related to Windows sandbox/setup-helper failures, but they center on
codex-windows-sandbox-setup.exe,ShellExecuteExW failed to launch setup helper: 1223, module-not-found dialogs, or proxy/setup-marker mismatch. Those seem related but not exact duplicates of thisapply deny-read ACLsrepro.So my suggestion would be:
apply_patchto fail before patching workspace files, forcing agents to fallback to bypass the sandbox and write files using powershell #30712 / Windows Desktop sandbox forces choice between CreateProcessAsUserW 1312 and apply_patch split-root failure #31220.apply deny-read ACLsfailure where the helper can run but cannot read an existing workspace file.pellorao commentedon Jul 10, 2026
I closed #31248 as likely related to this Windows sandbox read/ACL issue, but I want to preserve one additional data point.
In my reproduction,
view_imagefailed with:This happened while using the elevated Windows sandbox. The local image existed on disk and was readable from PowerShell.
After changing:
to:
view_imagestarted working correctly.So this may be useful evidence that the
view_imagefailure is tied to the elevated Windows sandbox read/ACL path, not to image decoding or file existence.I later encountered a different failure mode in unelevated mode:
I think that should be tracked separately from this
apply deny-read ACLsissue. The two failure modes appear different:apply deny-read ACLs: helper runs but denies reading an existing local file.split writable root sets: unelevated sandbox rejects the writable-root configuration before the tool can run.chess-oai commentedon Sep 18, 2026
could you share the
setup error:entry and following error lines from%USERPROFILE%\.codex\.sandbox\sandbox.YYYY-MM-DD.logafter reproducing?also, is
.codex\.sandbox\deny_read_acl_state.jsonempty or valid json? no need to share its contentspellorao commentedon Sep 21, 2026
This problem plagued me for far too long; I've now switched to running it under WSL.
The original installation has been uninstalled, and the previous logs are gone as well.
leeeunzzi commentedon Sep 23, 2026
I can reproduce this issue consistently on native Windows with codex-cli 0.156.0, in both Codex CLI and Codex Desktop.
I tested this while trying to enforce a company security policy that prevents Codex from reading sensitive configuration files while still allowing normal source-code editing.
Environment
Windows (native, not WSL)
codex-cli 0.156.0
Windows sandbox: elevated
What I observed
Without any filesystem deny rules:
Reading normal files works
Creating new files works
Editing existing files with apply_patch works
With sensitive files configured as deny under filesystem:
Reading normal files works
Reading denied sensitive files is correctly blocked
Creating new files still works
Editing existing normal files fails with Failed to apply patch
I reproduced the same behavior with the filesystem rules defined in:
the user config.toml
the managed requirements.toml
Removing only the filesystem deny configuration immediately makes apply_patch work again.
I also confirmed that the target normal files are not read-only and that the Windows user has normal modify permissions on them.
This makes it difficult to deploy Codex in our organization: we need to prevent Codex from reading files containing DB credentials, API keys, server information, etc., while still allowing developers to edit existing source files normally.
Could you please confirm whether this is a known limitation/bug in the native Windows sandbox, and whether a fix or supported workaround is planned?
I would be happy to provide additional reproduction details if needed.