Windows sandbox setup refresh failures despite healthy doctor
What version of Codex CLI is running?
codex-cli 0.133.0
Installed via npm as @openai/codex@0.133.0.
What platform is your computer?
Windows 11 Pro ARM64:
Microsoft Windows NT 10.0.26100.0
Microsoft Windows 11 Pro 10.0.26100 Build 26100, ARM 64-bit Processor
codex doctor reports the runtime as windows-x86_64 using the npm codex-win32-x64 package:
Codex Doctor v0.133.0 · windows-x86_64
runtime npm
executable C:\Users\samuel\AppData\Roaming\npm\node_modules\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe
13 ok · 1 idle · 0 warn · 0 fail ok
The bundled Windows sandbox helper exists:
C:\Users\samuel\AppData\Roaming\npm\node_modules\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\codex-resources\codex-windows-sandbox-setup.exe
Running that helper manually with --help exits successfully with code 0 and no output.
What terminal emulator and version are you using?
VS Code integrated terminal:
VS Code 1.121.0
TERM_PROGRAM=vscode
What issue are you seeing?
Sandboxed shell commands intermittently fail with:
execution error: Io(Custom { kind: Other, error: "windows sandbox: spawn setup refresh" })
The behavior persisted after:
- VS Code Developer: Reload Window
- Restarting the Codex session
- Fully restarting VS Code
- Checking security software exclusions
- Updating/checking Codex and VS Code versions
- Rebooting Windows
After reboot, behavior was still inconsistent:
Get-Location # sandboxed: passed
Get-ChildItem -Name package.json # sandboxed: failed with windows sandbox: spawn setup refresh
Get-Content -Path package.json -TotalCount 5 # sandboxed: failed with windows sandbox: spawn setup refresh
The same file listing/read works when run outside the sandbox with escalation, so the workspace and filesystem are reachable.
No persistent codex-sandbox/sandbox setup processes are visible in Task Manager or via Get-Process *codex*; only the main codex process is visible. If the sandbox helper is intended to be spawned per command and exit, this may be expected, but the user-visible failure makes it look like the sandbox service/setup never starts.
Relevant log lines
From C:\Users\samuel\.codex\log\codex-tui.log:
2026-05-23T19:13:34.533670Z ERROR codex_core::exec: exec error: windows sandbox: spawn setup refresh
2026-05-23T19:13:34.545152Z ERROR codex_core::tools::router: error=execution error: Io(Custom { kind: Other, error: "windows sandbox: spawn setup refresh" })
2026-05-23T19:34:25.157935Z ERROR codex_core::exec: exec error: windows sandbox: spawn setup refresh
2026-05-23T19:34:25.196875Z ERROR codex_core::tools::router: error=execution error: Io(Custom { kind: Other, error: "windows sandbox: spawn setup refresh" })
There is no C:\Users\samuel\.sandbox\sandbox.log on this machine.
Expected behavior
Sandboxed shell commands should consistently start the Windows sandbox helper and execute, or the error should include the underlying failure cause and remediation.
Notes
This may be related to Windows ARM64 running the x64 Codex package/helper under emulation, but codex doctor currently reports no warning or failure for that setup.
15 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional local findings:
process.arch, so it choosesx86_64-pc-windows-msvcwhen launched through this x64 Node.doctorreportswindows-aarch64:The MSI log shows:
Temporary workaround being tested: set VS Code
chatgpt.cliExecutableto the side-by-side native ARM64 binary:Follow-up correction: launching the native ARM64 binary directly does not fix the sandbox failure.
In a new session launched with:
Get-Locationsucceeded, but the same file reads still failed without escalation:The ARM64 binary's
doctor --allis clean:Local config includes:
So the issue is not only x64-on-ARM64. It reproduces with the native ARM64 runtime as soon as the Windows filesystem sandbox tries to refresh for file access. Direct
codex sandbox windowstesting also currently asks for a permissions profile and fails withdefault_permissions requires a [permissions] tableforworkspace-write/read-only, so I don't yet have a lower-level error thanspawn setup refresh.🔧 Complete Solution Submitted
Root Cause
On Windows 11 ARM64, the Codex CLI runs as an x64 process via WoW64 emulation (Node.js x64 on ARM64 Windows). The sandbox setup helper (
codex-windows-sandbox-setup.exe) is an x64 native binary. The intermittentspawn setup refreshfailures occur because:1. WoW64 File System Redirection Race
When the x64 Node process spawns the x64 sandbox setup binary, Windows WoW64 file system redirection can cause a race condition where:
Sysnativev...Key Fixes
Testing Strategy
Files
Full solution document:
codex-24259-sandbox-spawn-refresh-arm64-fix.md---
Submitted via automated solution pipeline. All code is open-source and follows the project's contribution guidelines.
Thanks for looking at this, but the proposed root cause does not fit the evidence from this machine.
The explanation says the failure is caused by an x64 Node/Codex process and x64
codex-windows-sandbox-setup.exerunning under WoW64 on Windows ARM64. That may still be one contributing path, but it cannot be the complete root cause for this issue because I reproduced the same failure after bypassing the x64 npm launcher entirely and launching the native ARM64 Codex binary directly.Reproduction that falsifies the WoW64-only explanation:
That runtime reports native ARM64:
In that same native ARM64 session:
So the failure happens even when the Codex process and bundled sandbox helper are native
aarch64-pc-windows-msvc, not x64 under WoW64.Also, the comment mentions a full solution document named
codex-24259-sandbox-spawn-refresh-arm64-fix.md, but there is no linked PR, branch, patch, gist, or attached file here. Without concrete code changes or a runnable reproduction, I cannot validate the proposed fix.A plausible fix still needs to explain both cases:
windows sandbox: spawn setup refresh.The only confirmed workaround so far is launching with sandbox disabled for this trusted workspace:
That makes
Get-ChildItem -Name package.jsonandGet-Content -Path package.json -TotalCount 5succeed, which further points to the Windows sandbox refresh path rather than PowerShell, the workspace, or the executable architecture alone.Same failure mode on a slightly different ARM64 config — may help narrow root cause.
codex-win32-arm64(native ARM64, NOT x64 under emulation —codex doctorshowswindows-aarch64)codex execshell spawn fails identically:``
``exec error: Io(Custom { kind: Other, error: "windows sandbox: spawn setup refresh" })
read-onlyandworkspace-writeboth fail with the same error.--dangerously-bypass-approvals-and-sandboxworks.codex review's internal file-read path is unaffected — only shell spawns through the sandbox helper break. So the bug appears localized to the Windows sandbox spawn helper, not Codex's broader file infrastructure.So the ARM64-emulating-x64 theory in the original report isn't the sole cause — native ARM64 hits this too, deterministically. Combined with #24133 (reverting to 0.132.0 restores functionality), this looks like a 0.133.0 regression in the Windows sandbox spawn helper on ARM64 hardware regardless of x64 emulation.
Reproducing this on Windows 11 Pro x86_64 (not ARM64), Codex CLI 0.133.0 (npm-installed), non-intermittent — 100% reproducible on
read-onlyANDworkspace-writemodes. Onlydanger-full-accessworks.Minimal repro (any directory, no project state required):
Identical failure with
--sandbox workspace-write. Every PowerShell exec the model tries dies in 0 ms; the model gives up and reports "I could not inspect the working tree."codex doctor(relevant excerpt):Title scope: the existing title says "Windows 11 ARM64" and "intermittently." This reproducing 100% on x86_64 across two sandbox modes suggests the underlying Windows sandbox layer is broader than ARM64 / intermittent.
Downstream impact: This silently breaks the official
openai/codex-plugin-ccCodex plugin for Claude Code on Windows — its runtime hard-codessandbox: "read-only", so/codex:reviewand/codex:rescuereturn empty reviews. Filing a separate plugin-side issue with a proposed defensive workaround.Is there a fix being worked on for this issue? This is making cli unusable for me
Look at my proposed workaround at https://github.com/openai/codex-plugin-cc/issues/349
Update after retesting on 2026-06-01:
I updated to Codex CLI 0.135.0 and re-ran the original sandboxed shell checks.
The original user-facing
spawn setup refreshfailure no longer reproduces in this session:Get-Locationsucceeds.Get-ChildItem -Name package.jsonsucceeds.Get-Content -Path package.json -TotalCount 5succeeds.So the original 0.133.0 symptom appears improved or resolved for normal shell tool usage on this machine after updating to 0.135.0.
I also tried lower-level Windows sandbox smoke tests from inside this Codex-controlled terminal/session:
codex -c windows.sandbox="elevated" sandbox windows cmd /c echo CODEX_ELEVATED_SANDBOX_TEST_OKcodex -c windows.sandbox="unelevated" sandbox windows cmd /c echo CODEX_UNELEVATED_SANDBOX_TEST_OKwindows sandbox failed: CreateRestrictedToken failed: 87I would treat those lower-level results as less conclusive than the original repro commands, because they were run as nested sandbox probes from within the Codex session and may be affected by this machine's local terminal/user-context/sandbox setup. They may overlap with related
CreateRestrictedToken failed: 87reports, but I cannot say from this retest alone that they are the same root cause as the originalspawn setup refreshfailure.codex doctorreports Codex Doctor v0.135.0 onwindows-x86_64from an npm install. The doctor output also reports Windows 11 Professional and a restricted filesystem/network sandbox in this session.Current conclusion: the original
spawn setup refreshrepro is no longer current on this machine with 0.135.0 for normal shell tool usage. The separate nestedcodex sandbox windowsresults may still be worth tracking, but they should not be treated as proof that the original issue remains unresolved.Update after retesting on 2026-06-02 with Codex CLI 0.136.0:
The issue appears to still reproduce, including with the native ARM64 runtime.
I updated the side-by-side ARM64 runtime to Codex CLI 0.136.0.
doctorreports:The explicit Windows sandbox smoke test still fails:
Result:
In the interactive session, normal sandboxed commands are also failing again before PowerShell starts. This affects
/review: filesystem/git inspection fails with:The same filesystem and Git commands work outside the sandbox, so the repo, Git, PowerShell, and filesystem are reachable. The failure still appears isolated to the Windows sandbox setup/refresh path.
This updates my previous 0.135.0 retest: the original failure looked improved in that session, but it is reproducible again on this machine with 0.136.0, and it also reproduces with native ARM64 Codex rather than only x64-on-ARM64.
Current workaround remains launching trusted local workspaces with sandbox disabled, for example:
Updated to version 26.601.21317 • Released on June 3, 2026
The problem still exists
Still reproduces intermittently on 0.142.2 (winget install, Windows 11 ARM64) under
-s read-only/-s workspace-write;danger-full-access(no sandbox) is unaffected.Root cause is well analyzed in #24050: the sandbox helper
codex-windows-sandbox-setup.exeships without arequestedExecutionLevelmanifest, so Windows' UAC installer-detection heuristic (the filename contains "setup") intermittently flags it as an installer and forces elevation →os error 740→spawn setup refresh.Reliable per-user workaround until a manifest ships upstream — a
RUNASINVOKERAppCompat shim on the helper (no admin, reversible):After applying it,
codex sandbox -- cmd /c verandcodex exec -s read-onlyhave run reliably in my testing. Re-apply if a major winget upgrade changes the package path. (The real fix is an embeddedasInvokermanifest on the helper, per #24050.)I can reproduce this on Codex Desktop for Windows, on native x86_64 hardware.
Environment
OpenAI.Codex 26.707.9981.010.0.26200, build26200, 64-bitD:\...)Behavior
The problem persists after fully restarting Codex Desktop and rebooting Windows.
A minimal
apply_patchsequence is inconsistent:Add Filesucceeds.Observed error:
Normal read-only PowerShell commands also fail before execution:
The same commands succeed when explicitly run outside the sandbox, so the workspace and files are accessible.
The failure also prevents the bundled Browser plugin / node runtime from starting. Its diagnostic output is:
This suggests the impact is broader than shell commands: it affects
apply_patchreads/updates and bundled plugin processes as well.Expected
Sandbox setup refresh should succeed consistently after app/OS restart. If setup cannot complete, the error should expose the underlying Windows/helper failure and an actionable remediation.
Update after retesting on 2026-07-18:
I revalidated this on the same Windows 11 ARM64 machine against the current local CLI and the latest npm CLI.
Environment / versions:
Current results on this machine:
I also checked the bundled setup helpers with a bounded byte-string scan. Both helpers I tested now contain the expected manifest marker:
That was true for:
@openai/codex-win32-arm64@openai/codex-win32-x64So, on this machine, the original ARM64 CLI /
spawn setup refreshrepro from 0.133.0 no longer reproduces with current CLI bits, and the missing-asInvokermanifest branch appears fixed for the helpers I inspected.Two caveats from the newer thread activity:
codex sandbox windows ...examples are stale for the current CLI syntax.codex sandbox --helpnow treats the command as positional args directly, so includingwindowsmakes Codex try to execute a program namedwindowsand fails with Windows error 2. The current smoke form iscodex sandbox cmd /c ...orcodex sandbox powershell ....#24098has a 0.144.5 report where forced elevated mode fails withCreateProcessWithLogonW failed: 2while unelevated works.#24098also has a 2026-07-17 Codex Desktop report for26.715.2305.0/ bundledcodex-cli 0.145.0-alpha.18where elevated mode hangs with lingeringcodex-windows-sandbox-setup.exeprocesses after ACL work starts.helper_unknown_error: setup refresh had errors, affecting shell,apply_patch, and bundled plugin processes.Current conclusion: the original missing-manifest /
os error 740path appears fixed in current CLI helpers and does not reproduce on this ARM64 machine with 0.144.0/0.144.5. The remaining actionable issue seems to be a broader Windows elevated-sandbox reliability/diagnostics problem, especially for Desktop/bundled CLI and elevated mode.codex doctorshould probably run a real sandbox setup-refresh/spawn probe, because helper readability alone does not catch the newer failure modes reported in the linked comments.