apply_patch fails with a windows sandbox related error

Open 💬 24 comments Opened Jun 25, 2026 by TheCrake
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.616.81150 • Released Jun 23, 2026

What subscription do you have?

pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

On Windows, file edits through apply_patch are broken in my session.

I’ve seen these errors/messages:

  • failed to prepare windows sandbox wrapper
  • windows unelevated restricted-token sandbox cannot enforce split writable root sets directly
  • refusing to run unsandboxed

I tried changing it from unelevated to elevated, and when I did, a tiny apply_patch test did not fail fast — it hung for about 2 minutes until I manually canceled it.

So the bug seems to be one of these two behaviors:

  1. sandbox wrapper setup fails with the messages above, or
  2. apply_patch hangs instead of returning a clean error

What steps can reproduce the bug?

On my session, any attempt to patch a file results in sandbox wrapper setup failure

What is the expected behavior?

it should be able to write to files without resorting to other methods

Additional information

This looks related to the Windows sandbox path, not the repo itself.

A similar public issue may be related:

  • #10601 Sandbox setup error on Windows

The session/workspace was using a workspace-write style sandbox with mixed writable roots / restricted filesystem policy.

The failure appears to happen before the patch is actually applied, during sandbox/wrapper setup.

View original on GitHub ↗

24 Comments

github-actions[bot] contributor · 25 days ago

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

  • #29200
  • #29072
  • #29938

Powered by Codex Action

TheCrake · 25 days ago

I searched and there was a weird sized copy of codex-windows-sandbox-setup.exe. Solved the issue by deleting AppData\Local\OpenAI\Codex\bin and AppData\Local\Packages\OpenAI.Codex\LocalCache\Local\OpenAI\Codex\bin

TheCrake · 25 days ago

Ok, still getting the issue with "windows unelevated restricted-token sandbox cannot enforce split writable root sets directly" when it uses apply_patch to delete a file.

himhn7 · 25 days ago

I can confirm this issue on my setup as well. And I think we are being forced to pay about 2x because of this. (No numbers , just personally observed pre and post usage percentages before and after this bug)

Environment

Windows 11
VS Code Extension
Codex CLI 0.142.2 (installed via npm)
ChatGPT Plus
GPT-5.5
Approval: OnRequest
Filesystem sandbox: restricted

apply_patch consistently fails with messages such as:

"apply_patch is blocked by the Windows sandbox wrapper in this session, so I'm using the approved PowerShell path..."

My config.toml already contains:

[windows]
sandbox = "unelevated"

and codex doctor reports that the configuration is loaded correctly.

The functional workaround (PowerShell edits) allows work to continue, but I believe it has another significant side effect. as mentioned at the top it increases used credits/tokens on each request by approximately 2X.

TheCrake · 25 days ago

Yeah, my usage has also tanked, single commands that seem like they would have used 10% before now seem to use 50% of my usage, with what looks like the same or higher token usage per day on the profile, so it's possible there's something burning through context compared to before, not sure if it's this.

As a temporary solution, it does seem like instructing codex to use the Codex CLI apply-patch path instead of the 'WindowsApps' version might sometimes help, but when I tried that it still burned through context. Weirdly, it seemed like it went from like 60 to 50 percent usage remaining, but then a minute later without sending any commands it jumped down to only 8 percent remaining.

himhn7 · 24 days ago

I haven't see that magnitude of change, for me its just about double, i think because when apply_patch is not available it needs to figure out he exact old code and new code to replace it using string replace or a similar thing.

That is just a high level understanding based on my observations on what it does during thinking and executing when i juxtapose that against token usage.

Arcnor · 22 days ago

I'm also hitting this issue, but on codex CLI. Seems to be a regression, as I've tested 0.142.3, 0.142.0 and 0.141.0, but only the last one (0.141.0) works.

EthanRodrigues001 · 22 days ago

Additional Windows Desktop reproduction from my machine.

Environment:

  • Windows: Windows 11 Pro / Microsoft Windows NT 10.0.26200 x64
  • Codex Desktop package seen in sandbox log: OpenAI.Codex_26.623.5546.0_x64__2p2nqsd0c76g0
  • Desktop/local Codex binary: C:\Users\Ethan Rodrigues\AppData\Local\OpenAI\Codex\bin\codex.exe -> codex-cli 0.142.0
  • npm Codex CLI after manual update: @openai/codex@0.142.3, codex-cli 0.142.3
  • Current Codex process admin check: IsAdmin = false
  • Workspace mode: workspace-write / restricted filesystem / restricted network

Observed behavior:

  1. With [windows] sandbox = unelevated, apply_patch can add a new file, but update/delete fails while preparing the fs sandbox:
apply_patch verification failed: Failed to read C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that\work\apply_patch_sandbox_probe.txt: failed to prepare fs sandbox: failed to prepare windows sandbox wrapper: windows unelevated restricted-token sandbox cannot enforce split writable root sets directly; refusing to run unsandboxed
  1. After switching to [windows] sandbox = elevated, the original split-root error is gone, but update/delete now fails because the setup helper requires elevation:
apply_patch verification failed: Failed to read file to update C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that\work\apply_patch_sandbox_probe.txt: fs sandbox helper failed with status exit code: 1: windows sandbox failed: orchestrator_helper_launch_failed: setup refresh failed to launch helper: helper=C:\Users\Ethan Rodrigues\AppData\Local\OpenAI\Codex\bin\codex-windows-sandbox-setup.exe, cwd=C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that, log=C:\Users\Ethan Rodrigues\.codex\.sandbox\sandbox.2026-06-28.log, error=The requested operation requires elevation. (os error 740)

Relevant sandbox log excerpt:

[2026-06-28 20:45:19.008 codex.exe] setup refresh: spawning C:\Users\Ethan Rodrigues\AppData\Local\OpenAI\Codex\bin\codex-windows-sandbox-setup.exe (cwd=C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that, payload_len=4568)
[2026-06-28 20:45:19.706 codex.exe] setup refresh: setup refresh failed to launch helper: helper=C:\Users\Ethan Rodrigues\AppData\Local\OpenAI\Codex\bin\codex-windows-sandbox-setup.exe, cwd=C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that, log=C:\Users\Ethan Rodrigues\.codex\.sandbox\sandbox.2026-06-28.log, error=The requested operation requires elevation. (os error 740)

Other checks:

  • codex-windows-sandbox-setup.exe exists at C:\Users\Ethan Rodrigues\AppData\Local\OpenAI\Codex\bin\codex-windows-sandbox-setup.exe.
  • Authenticode signature is valid: signer OpenAI OpCo, LLC; status Signature verified.
  • This does not look like Defender/SmartScreen quarantine. It looks like either the unelevated split-root limitation, or the elevated helper launch path not requesting/obtaining elevation cleanly from the Desktop/apply_patch flow.

Expected behavior:

  • apply_patch should be able to update/delete normal files inside the workspace, or the app should request/setup elevation cleanly once and then proceed.
  • If elevated setup is required, the error should be surfaced as an actionable setup/UAC step rather than failing inside apply_patch.
himhn7 · 21 days ago

so should i just use on CLI , with version 0.141.0 to save my tokens ?

this is getting to a point where i am not able to work when using VS Code extension, and in CLI i can not provide images to the agent.

but at this point i think it is wiser to move to CLI v0.141.0 if that will save my tokens.

Has anyone tried that ?

Arcnor · 21 days ago

Not sure if that will save your tokens or not, but you can still use images in the cli version, you can even drag and drop them, but it might also depend on your terminal.

mafina-one · 20 days ago

I am seeing what looks like the same Windows sandbox issue on a new Windows 11 Home PC.

Extra details:

  • Fresh Codex Desktop login on the new PC
  • Old PC Codex session fully closed/logged out
  • Fresh workspace under C:\Projects\Local AI
  • Codex reports workspace-write
  • Writable root shown as C:\Projects\Local AI
  • Working directory confirmed as C:\Projects\Local AI

Writes are still blocked inside the writable root:

  • .\sandbox-test.txt fails
  • C:\Projects\Local AI\sandbox-test.txt fails
  • explicit permission request for the exact file does not fix it
  • file does not exist afterward

This happens outside Documents/OneDrive, so it does not appear to be a protected-folder issue.

In my case the failure affects direct file creation as well as patch/edit operations.

mafina-one · 19 days ago

Resolution in my case was switching Windows sandbox mode in C:\Users\<you>\.codex\config.toml:

[windows]
sandbox = "elevated"

TheCrake · 19 days ago

I tried sandbox = "elevated" and it caused commands to freeze and not respond until I cancelled the chat and sent a new command.

LeandroJF · 19 days ago

I'm also having this problem.

Here is what Codex told me to post here:

Codex Desktop Windows apply_patch hangs only with [windows] sandbox = "elevated"

Codex app version: 26.623.9142.0
Codex CLI version: 0.142.4
OS: Windows 11 CoreSingleLanguage, 10.0.26200
Project path: C:\Codex\bfd
Config:
default_permissions = ":workspace"
[windows]
sandbox = "elevated"

Observed:

  • apply_patch Add File sometimes succeeds, but Update File hangs indefinitely.
  • In one repro, Add File succeeded, then Update File hung for 110.9s.
  • No patch_apply_end event was emitted.
  • Switching only [windows] sandbox to "unelevated" makes apply_patch create/update/delete succeed.

Diagnostics:

  • codex doctor --summary reports 17 ok, 0 warn, 0 fail.
  • C:\Users\Leandro\.codex\.sandbox\sandbox.2026-06-30.log shows elevated sandbox setup refresh with errors=[].
  • codex sandbox with windows.sandbox="elevated" can create/edit/delete files normally, so this appears specific to apply_patch + elevated Windows sandbox.

Relevant session id:
019f1ae1-3219-79b0-b65c-40239dc55ed7

alexzhuustc · 18 days ago

How to Fix Codex Windows Sandbox apply_patch failure

Problem

On Windows, Codex Desktop may fail when running sandboxed tools. Common symptoms include:

  • apply_patch sandboxed file reads fail
  • COM+ Error SID Error
  • Simple commands such as rg may still work
  • The same file operation may succeed when run externally or with elevated execution

This can happen when Codex itself needs a network proxy, but the Windows sandbox helper also inherits proxy environment variables.

Root Cause

The sandbox helper can inherit these environment variables:

HTTP_PROXY
HTTPS_PROXY
ALL_PROXY
http_proxy
https_proxy
all_proxy

When that happens, Codex may write a local proxy port into:

%USERPROFILE%\.codex\sandbox\setup_marker.json

For example:

"proxy_ports": [4780]

Later, when apply_patch or another sandboxed tool triggers codex-windows-sandbox-setup.exe, the helper may try to refresh Windows sandbox or firewall state for that proxy port and fail.

Clearing setup_marker.json alone may not persist, because old Codex or launcher processes can still have the proxy variables in their process environment and write the port back.

Fix

Edit the Codex config file:

%USERPROFILE%\.codex\config.toml

Add or merge the following configuration:

[features]
network_proxy = true

[shell_environment_policy]
inherit = "all"
exclude = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "all_proxy"]

This keeps Codex network proxy support enabled while preventing sandboxed tools and shell commands from inheriting proxy environment variables.

Apply the Change

  1. Fully exit Codex Desktop.
  2. Make sure all Codex, OpenAI.Codex, and launcher processes are stopped.
  3. Start Codex Desktop again so it reads the updated config.toml.
  4. Open:
%USERPROFILE%\.codex\sandbox\setup_marker.json
  1. Change:
"proxy_ports": [4780]

to:

"proxy_ports": []

If the port is not 4780, still clear the array.

The order matters: restart Codex first, then clear proxy_ports. If old Codex processes are still running, they may write the proxy port back.

Verification

First, confirm the sandbox shell no longer sees proxy environment variables:

Get-ChildItem Env:HTTP_PROXY, Env:HTTPS_PROXY, Env:ALL_PROXY, Env:http_proxy, Env:https_proxy, Env:all_proxy -ErrorAction SilentlyContinue

Expected result: no output, or empty values.

Then confirm:

"proxy_ports": []

in:

%USERPROFILE%\.codex\sandbox\setup_marker.json

Finally, verify that patching works.

Patch Tool Test Case

Run this as a single prompt inside Codex:

Create a file named `foo.txt` with content `aaa`, then use the patch tool to update its content to `bbb`.

After the patch, foo.txt should contain:

bbb

If this succeeds, the sandbox helper is no longer failing during apply_patch.

Reference

Solution Source

allenxu09 · 18 days ago
# How to Fix Codex Windows Sandbox apply_patch failure ## Problem On Windows, Codex Desktop may fail when running sandboxed tools. Common symptoms include: apply_patch sandboxed file reads fail COM+ Error SID Error Simple commands such as rg may still work The same file operation may succeed when run externally or with elevated execution This can happen when Codex itself needs a network proxy, but the Windows sandbox helper also inherits proxy environment variables. ## Root Cause The sandbox helper can inherit these environment variables: `` HTTP_PROXY HTTPS_PROXY ALL_PROXY http_proxy https_proxy all_proxy ` When that happens, Codex may write a local proxy port into: ` %USERPROFILE%\.codex\sandbox\setup_marker.json ` For example: "proxy_ports": [4780] Later, when apply_patch or another sandboxed tool triggers codex-windows-sandbox-setup.exe, the helper may try to refresh Windows sandbox or firewall state for that proxy port and fail. Clearing setup_marker.json alone may not persist, because old Codex or launcher processes can still have the proxy variables in their process environment and write the port back. ## Fix Edit the Codex config file: ` %USERPROFILE%\.codex\config.toml ` Add or merge the following configuration: [features] network_proxy = true [shell_environment_policy] inherit = "all" exclude = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "all_proxy"] This keeps Codex network proxy support enabled while preventing sandboxed tools and shell commands from inheriting proxy environment variables. ## Apply the Change 1. Fully exit Codex Desktop. 2. Make sure all Codex, OpenAI.Codex, and launcher processes are stopped. 3. Start Codex Desktop again so it reads the updated config.toml. 4. Open: ` %USERPROFILE%\.codex\sandbox\setup_marker.json ` 5. Change: "proxy_ports": [4780] to: "proxy_ports": [] If the port is not 4780, still clear the array. The order matters: restart Codex first, then clear proxy_ports. If old Codex processes are still running, they may write the proxy port back. ## Verification First, confirm the sandbox shell no longer sees proxy environment variables: Get-ChildItem Env:HTTP_PROXY, Env:HTTPS_PROXY, Env:ALL_PROXY, Env:http_proxy, Env:https_proxy, Env:all_proxy -ErrorAction SilentlyContinue Expected result: no output, or empty values. Then confirm: "proxy_ports": [] in: ` %USERPROFILE%\.codex\sandbox\setup_marker.json ` Finally, verify that patching works. ### Patch Tool Test Case Run this as a single prompt inside Codex: ` Create a file named foo.txt with content aaa, then use the patch tool to update its content to bbb. ` After the patch, foo.txt should contain: ` bbb ` If this succeeds, the sandbox helper is no longer failing during apply_patch`. # Reference Solution Source

huge thanks! works for me.
btw, path should be `%USERPROFILE%\.codex\.sandbox\setup_marker.json` with "[dot] sandbox".

LeandroJF · 18 days ago

Thanks for the suggestion. I tried this, but it did not fix my case.

A few differences from the proxy/proxy_ports failure mode:

  • On my machine the marker path is:

``text
C:\Users\Leandro\.codex\.sandbox\setup_marker.json
``

not .codex\sandbox\setup_marker.json.

  • My setup_marker.json does not contain proxy_ports at all. It only contains:

``json
{
"version": 5,
"offline_username": "CodexSandboxOffline",
"online_username": "CodexSandboxOnline",
"created_at": "...",
"read_roots": [],
"write_roots": []
}
``

  • I tried adding the suggested config:

```toml
[features]
network_proxy = true

[shell_environment_policy]
inherit = "all"
exclude = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "all_proxy"]
```

Then I fully restarted Codex and tested again with:

``toml
[windows]
sandbox = "elevated"
``

The apply_patch update step still hung.

  • My sandbox log does not show COM+, SID, proxy_ports, or setup-helper failure errors around the repro. It repeatedly shows the setup helper completing successfully, for example:

``text
setup refresh: processed 2 write roots (read roots delegated); errors=[]
``

  • The issue is still specific to this combination:

``text
[windows]
sandbox = "elevated"
``

With sandbox = "elevated", apply_patch update hangs.
With sandbox = "unelevated", create/update/delete through apply_patch works.

So this may be a different Windows sandbox/apply_patch failure mode than the proxy-port issue. In my case the setup helper appears to complete cleanly, but apply_patch still hangs under the elevated Windows sandbox and never emits a clean completion/error.

himhn7 · 18 days ago
> # How to Fix Codex Windows Sandbox apply_patch failure > ## Problem > On Windows, Codex Desktop may fail when running sandboxed tools. Common symptoms include: > > apply_patch sandboxed file reads fail > COM+ Error SID Error > Simple commands such as rg may still work > The same file operation may succeed when run externally or with elevated execution > > This can happen when Codex itself needs a network proxy, but the Windows sandbox helper also inherits proxy environment variables. > ## Root Cause > The sandbox helper can inherit these environment variables: > `` > HTTP_PROXY > HTTPS_PROXY > ALL_PROXY > http_proxy > https_proxy > all_proxy > ` > > > > > > > > > > > > When that happens, Codex may write a local proxy port into: > ` > %USERPROFILE%\.codex\sandbox\setup_marker.json > ` > > > > > > > > > > > > For example: > "proxy_ports": [4780] > Later, when apply_patch or another sandboxed tool triggers codex-windows-sandbox-setup.exe, the helper may try to refresh Windows sandbox or firewall state for that proxy port and fail. > Clearing setup_marker.json alone may not persist, because old Codex or launcher processes can still have the proxy variables in their process environment and write the port back. > ## Fix > Edit the Codex config file: > ` > %USERPROFILE%\.codex\config.toml > ` > > > > > > > > > > > > Add or merge the following configuration: > [features] > network_proxy = true > [shell_environment_policy] > inherit = "all" > exclude = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "all_proxy"] > This keeps Codex network proxy support enabled while preventing sandboxed tools and shell commands from inheriting proxy environment variables. > ## Apply the Change > > 1. Fully exit Codex Desktop. > 2. Make sure all Codex, OpenAI.Codex, and launcher processes are stopped. > 3. Start Codex Desktop again so it reads the updated config.toml. > 4. Open: > > ` > %USERPROFILE%\.codex\sandbox\setup_marker.json > ` > > > > > > > > > > > > > 5. Change: > > "proxy_ports": [4780] > to: > "proxy_ports": [] > If the port is not 4780, still clear the array. > The order matters: restart Codex first, then clear proxy_ports. If old Codex processes are still running, they may write the proxy port back. > ## Verification > First, confirm the sandbox shell no longer sees proxy environment variables: > Get-ChildItem Env:HTTP_PROXY, Env:HTTPS_PROXY, Env:ALL_PROXY, Env:http_proxy, Env:https_proxy, Env:all_proxy -ErrorAction SilentlyContinue > Expected result: no output, or empty values. > Then confirm: > "proxy_ports": [] > in: > ` > %USERPROFILE%\.codex\sandbox\setup_marker.json > ` > > > > > > > > > > > > Finally, verify that patching works. > ### Patch Tool Test Case > Run this as a single prompt inside Codex: > ` > Create a file named foo.txt with content aaa, then use the patch tool to update its content to bbb. > ` > > > > > > > > > > > > After the patch, foo.txt should contain: > ` > bbb > ` > > > > > > > > > > > > If this succeeds, the sandbox helper is no longer failing during apply_patch. > # Reference > [Solution Source](https://www.reddit.com/r/codex/comments/1uccr76/codex_desktop_for_windows_2661666310_sandbox/) huge thanks! works for me. btw, path should be %USERPROFILE%\.codex\.sandbox\setup_marker.json` with "[dot] sandbox".

Thanks for sharing the workaround. I tested it on my machine, but it didn't resolve the issue.

My environment is Codex CLI/VS Code Extension v0.142.5 on Windows, with sandbox = "unelevated". I added the network_proxy and shell_environment_policy.exclude configuration, confirmed there are no HTTP_PROXY/HTTPS_PROXY environment variables, and verified the config is being loaded (codex doctor shows network_proxy overridden).

In my case, there is no setup_marker.json under .codex\.sandbox, and the sandbox logs don't show any COM+, SID, proxy, firewall, or setup-helper errors. All sandboxed PowerShell commands succeed. The failure is isolated to apply_patch, which reports a Windows sandbox wrapper/preparation error during the second patch operation.

This seems like a different Windows apply_patch failure mode than the proxy-related issue.

EthanRodrigues001 · 17 days ago

Follow-up from my Windows Desktop repro after testing the newer workaround comments.

I applied the proxy workaround suggested above and used the corrected marker path with dot-sandbox:

C:\Users\Ethan Rodrigues\.codex\.sandbox\setup_marker.json

Current relevant config now includes:

[windows]
sandbox = unelevated

[features]
network_proxy = true

[shell_environment_policy]
inherit = all
exclude = [HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, http_proxy, https_proxy, all_proxy]

I also checked/cleared the marker file. In my case it was already empty:

proxy_ports: []

I also checked the shell environment for these proxy variables:

HTTP_PROXY
HTTPS_PROXY
ALL_PROXY
http_proxy
https_proxy
all_proxy

No proxy env vars were visible in the shell I tested from.

After restarting/retesting, the result is still:

  • apply_patch Add File succeeds.
  • apply_patch Update File fails.
  • The failure is still the split writable roots error, not the proxy/firewall/setup-marker error:
apply_patch verification failed: Failed to read file to update C:\Users\Ethan Rodrigues\Documents\Codex\2026-06-28\you-re-right-to-call-that\work\apply_patch_check_now_probe.txt: failed to prepare fs sandbox: failed to prepare windows sandbox wrapper: windows unelevated restricted-token sandbox cannot enforce split writable root sets directly; refusing to run unsandboxed

So for my setup, the proxy/proxy_ports workaround does not resolve the remaining failure mode. My current finding is that this looks closer to #30712: Windows Desktop is launching the session with a split writable-root shape that the unelevated restricted-token sandbox cannot enforce for the apply_patch read/update/delete path.

I also previously tried [windows] sandbox = elevated, but on my machine that moved the failure to the elevated helper path:

error=The requested operation requires elevation. (os error 740)

So neither current local workaround fully fixes my case:

  • Proxy workaround: no effect; proxy_ports already empty.
  • sandbox = elevated: hits elevation/helper launch failure.
  • sandbox = unelevated: normal shell commands work, but apply_patch update/delete fails with split writable roots.
JCapul · 17 days ago

The initial error mentioned (windows unelevated restricted-token sandbox cannot enforce split writable root sets directly) indicates that the unelevated sandbox cannot handle two writable folders. By default, the writable folders are the local one and the /tmp folder.

So I deactivated in config.toml the tmp dir from being wirtable and it worked.

[sandbox_workspace_write]
exclude_slash_tmp = true
exclude_tmpdir_env_var = true

Not sure about overall impact on usability though, I havn't tested this workaround extensively yet.

cemremengu · 14 days ago

Sad to see these sandbox issues are not getting the attention they deserve from the codex team. These have been around for maybe 2-3 months and no fixes yet.

himhn7 · 14 days ago

I tried using in CLI to see if this apply_patch works in there after updating to latest version this morning and wanted to drag and drop images , but it does not read from screenshots on windows and there is no way to let it read from what i understand right now, codex said i will paste in c;/tmp folder but pasted there and not able to see it there as well.

With so many models and tools and resources, they are not getting it right for paying customers.

rpelevin · 14 days ago

The useful way to separate the Windows sandbox reports is by the boundary that failed, not by the command that happened to reveal it.

I would split the diagnostic contract into three states:

  1. writable-root model invalid;
  2. sandbox helper launch or elevation failed;
  3. tool execution failed inside a valid sandbox.

For apply_patch specifically, a split-root failure should be terminal before patch execution and should return a no_patch_applied outcome with the rejected writable roots in a safe diagnostic record. Switching to elevated mode may be a workaround, but it is not the same class; if the elevated helper hangs, that is a launch or IPC failure, not a patch failure.

The regression test I would want is:

  • workspace plus temp writable root under restricted-token Windows sandbox must either be supported or rejected before execution;
  • excluding the temp root must produce an explicit capability delta;
  • no failed sandbox setup path may fall through to an unsandboxed write or partial patch;
  • diagnostics should preserve OS error code, configured roots, and effective roots, without leaking file contents.

That would make these reports easier to dedupe: users can tell whether they hit split-root enforcement, helper launch, proxy or marker mismatch, or actual apply_patch behavior.

Saru-github · 1 day ago

Additional controlled reproduction from Codex Desktop on Windows (2026-07-20).

Environment:

  • Codex Desktop: 26.715.4045.0
  • Windows: Microsoft Windows NT 10.0.26200.0 x64
  • Workspace: a normal local Git repository
  • Test target: a tiny temporary text file inside the workspace

Observed in the managed workspace-write / restricted-filesystem mode:

  1. apply_patch Add File did not return for about 60 seconds.
  2. The patch eventually returned {} and the file had actually been created with the expected content.
  3. A following apply_patch Delete File was still unresponsive after roughly 20 seconds and the task was manually interrupted.
  4. After interruption, the temporary file still existed.

I then changed only the task permission profile to danger-full-access / unrestricted and repeated the same smoke test in the same workspace:

  • Delete leftover file: 55 ms
  • Add file: 91 ms
  • Content verification: succeeded
  • Delete file: 413 ms
  • Final verification: file absent and no Git status residue

This A/B comparison strongly suggests the delay/hang is in the Windows sandbox/wrapper path, rather than in patch parsing, the target file, or the workspace filesystem. The restricted-mode behavior is especially problematic because it can eventually report success after a long silent stall, while another patch operation may remain stuck until the task is interrupted.