Repository navigation
Windows sandbox: command execution fails with CreateProcessWithLogonW failed: 5 #9062
Description
What version of Codex is running?
codex-cli 0.80.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.2 (reasoning medium, summaries auto)
What platform is your computer?
Microsoft Windows NT 10.0.17763.0 x64
What issue are you seeing?
After upgrading to Codex CLI v0.80.0 on native Windows, agent mode started prompting for approval for almost every command, including simple read-only commands inside the workspace (for example cmd.exe /c type AGENTS.md). In addition, command execution inside the Windows sandbox fails with:
windows sandbox: CreateProcessWithLogonW failed: 5
This prevents apply_patch and even basic commands from running. The behavior persisted even after downgrading to v0.79.0, until I forced a sandbox re-onboarding flow (disable experimental_windows_sandbox, restart, then accept the “Enable experimental sandbox” onboarding prompt). After that re-onboarding, sandbox execution worked again and the patch could be applied.
Also, release notes mention /elevate-sandbox, but the command is not recognized and is not present in the slash command list in my TUI session.
Finally, approval mode appears inconsistent during onboarding: /status showed Approval: on-request even though config.toml had approval_policy = "on-failure". After codex resume, /status returned to on-failure.
What steps can reproduce the bug?
Repro (high level)
-
Install/run Codex CLI v0.80.0 on native Windows (no WSL).
-
Ensure agent mode is enabled and sandbox is
workspace-write. -
Run any prompt that needs to read files and apply a patch.
-
Observe repeated approval prompts for in-workspace commands and/or failures:
windows sandbox: CreateProcessWithLogonW failed: 5
Notes
- Even after downgrading to v0.79.0 the failure persisted, until the sandbox was re-onboarded via the UI prompt.
Workaround that recovers the sandbox
-
Set
experimental_windows_sandbox = falsein~\.codex\config.tomland restart Codex. -
Accept the “Enable experimental sandbox” onboarding prompt.
-
After this re-onboarding, sandbox process creation works again and
apply_patchsucceeds.
Uploaded thread: 019baafa-08a3-72b0-8595-7588471ad5d1
What is the expected behavior?
Expected behavior
-
On native Windows, with sandbox
workspace-write, Codex should be able to run read-only commands inside the workspace without per-command approvals (unless accessing outside workspace or network). -
approval_policyshould be consistently reflected by/status, and should followconfig.tomlunless explicitly overridden. -
Windows sandbox should be able to create processes reliably, so
apply_patchand basic commands do not fail withCreateProcessWithLogonW failed: 5.
Additional information
Environment
-
OS: Windows 10 Enterprise LTSC 2019 (1809), build 17763.7792 (native, no WSL)
-
Codex CLI: v0.80.0 (problem), v0.79.0 (problem persisted after downgrade)
-
Install: npm global (@openai/codex)
-
Shell: Windows PowerShell 5.1 and cmd.exe
-
Workspace: D:\Downloads\LTSC clean\win10-ltsc-2021-clean-quiet-baseline
-
Config (
~\.codex\config.toml):-
sandbox_mode = "workspace-write" -
approval_policy = "on-failure" -
[features] experimental_windows_sandbox = true -
[features] elevated_windows_sandbox = false(also tested true/false)
-
Activity
openresearchtools commentedon Jan 12, 2026
Exactly same issue on VS code extension!! Impossible to work!
openresearchtools commentedon Jan 12, 2026
Try a totally brand new instance, it works again for me. Old threads are just looping with sandboxing issues loop with constant PowerShell syntax errors/ rechecking sandboxing thinking/bash command loop.
tagorr commentedon Jan 12, 2026
I got it working by forcing a sandbox re-onboarding/reset: in
~\.codex\config.tomlI temporarily setexperimental_windows_sandbox = false, restarted Codex, then accepted the “Enable experimental sandbox” onboarding prompt. After that, the sandbox started creating processes normally again, and the agent stopped spamming approvals (especially withapproval_policy = "on-failure").But the bug still exists, this looks like a workaround that reinitializes the sandbox state. Old threads can still get stuck in
CreateProcessWithLogonW failed: 5and go back to asking for approvals on trivial in-workspace commands.dylan-hurd-oai commentedon Jan 12, 2026
@tagor-sian sorry to hear that - we're investigating this issue. Could you check your ~/.codex/.sandbox/sandbox.log and share any notable failure logs?
tagorr commentedon Jan 12, 2026
Thanks a lot! I attached the requested file (~/.codex/sandbox/sandbox.log) to the issue (“sandbox.log”). If it's not readable for any reason I'll upload it again gladly.
Important nuance: the sandbox.log does NOT contain the
CreateProcessWithLogonW failed: 5error. In my case that error only shows up in the Codex TUI/terminal output (and should be present in the uploaded /feedback thread artifacts for this session).What sandbox.log contains is a single repeating pattern (hundreds/thousands of repeats with different timestamps), e.g.:
[2026-01-11 20:46:55.225 codex.exe] AUDIT: world-writable scan FAILED; cwd="D:\Downloads\LTSC clean\win10-ltsc-2021-clean-quiet-baseline"; checked=289; duration_ms=12; flagged:
If you want, tell me which additional log/source is best for capturing the
CreateProcessWithLogonW failed: 5error (Codex CLI main log, a specific diagnostics command output, or an excerpt from the uploaded thread), and I’ll provide it.Uploaded /feedback thread id: 019baafa-08a3-72b0-8595-7588471ad5d1FYI the failure persisted even after downgrading v0.80 → v0.79 until I forced a sandbox re-onboarding (set experimental_windows_sandbox=false, restart, then accept “Enable experimental sandbox” prompt). After that, process creation worked again and apply_patch succeeded.
fix(windows-sandbox-rs) bump SETUP_VERSION (openai#9134)
dylan-hurd-oai commentedon Jan 14, 2026
Reopening this issue until we're confident the issue has been fixed
Cooad commentedon Jan 20, 2026
All of my codex sessions start with "CreateProcessWithLogonW failed: 5" error, which results in the agent modifying files using powershell scripts, instead of the apply_patch functionality. It makes the edits impossible to view, and requires approval for each file modification.
I've checked the user/.codex/.sandbox/sandbox.log file, and I can see 2 errors there:
This failes because I have a polish version of Windows, and group names are localized. So for polish version of windows it's "Użytkownicy" instead of "Users", and "Administratorzy" instead of "Administrators".
I tried running
to see it there are any flags I can pass in order to provide polish names to these groups, but it looks like there's no human-friendly interface there
tagorr commentedon Jan 20, 2026
This looks like another manifestation of the same underlying issue.
The sandbox setup is resolving Users and Administrators by localized group names instead of using well-known SIDs.
This should be fixable with a very small patch: resolve these groups by well-known SIDs, not by localized names.
For reference, the relevant well-known SIDs are:
Administrators group:
S-1-5-32-544Users group:
S-1-5-32-545These SIDs are locale-independent and work consistently across all Windows language versions.
Switching the sandbox setup to use SID-based resolution instead of hardcoded group names (
Users, Administrators) should eliminate this entire class of failures on localized Windows installs and restore proper sandbox +apply_patchbehavior.12 remaining items
TenofHearts commentedon Apr 20, 2026
I just had an exactly same issue in the latest version of codex.
nicolasdemol commentedon Apr 23, 2026
Quick fix : Reinstall Codex App
TenofHearts commentedon Apr 23, 2026
@nicolasdemol Didn't work for me. I had to remove my .codex directory and re-initiate the app.
ruiheng commentedon Apr 24, 2026
I had the exact issue in the laest version of codex at that time (0.123). But codex cli fixed itself for me. Here is the report:
Here is the concise report for OpenAI:
Codex native Windows sandbox failed with:
The failure was reproducible when
windows.sandbox = "elevated"and the active shell resolved to the Microsoft Store / WindowsApps version of PowerShell:Sandbox setup itself was not always the failing step. In the later reproduction, logs showed:
But the command still failed before
codex-command-runner.exeloggedrunner start, with:This suggests the elevated sandbox runner could start, but failed when trying to launch the Store/WindowsApps
pwsh.exeinside the sandboxed user context.Installing the MSI version of PowerShell fixed the issue. After installing MSI PowerShell,
pwshresolved to the normal install path instead of WindowsApps:After that, Codex elevated Windows sandbox commands worked.
Likely root cause: Codex elevated sandbox has a compatibility issue when the configured shell is the WindowsApps / Store packaged
pwsh.exe. The packaged PowerShell has AppX/WindowsApps ACL and package identity constraints that do not work correctly with Codex’s elevated sandbox user /CreateProcessAsUserWlaunch path.Recommended improvement: detect when
pwshresolves toWindowsAppsand either warn clearly, automatically prefer a non-Store PowerShell installation if available, or fall back topowershell.exewith an actionable diagnostic.YdayangY commentedon Apr 24, 2026
I just changed the
sandbox = "elevated"tosandbox = "unelevated"then fixed. what's the different?hudrazine commentedon Apr 24, 2026
@ruiheng I can confirm that this workaround fixed the issue in my environment.
My setup was using the Microsoft Store / MSIX version of PowerShell, and sandboxed commands were failing with:
After uninstalling the Microsoft Store / MSIX version, I installed the MSI/WiX version of PowerShell with:
After that, Codex was able to run the same sandboxed commands successfully without requiring escalation.
Verified commands included simple
Get-Content,Get-ChildItem,git status --short, and a Node-based validation command. All worked normally after switching to the MSI-installed PowerShell.Thanks for the pointer!
yongzheJIN commentedon May 13, 2026
@YdayangY either.
Based the official website. Elevated is been suggested. But i cannot get what the different between them based on the https://developers.openai.com/codex/config-basic
Have you got any idaes?
HYP3R00T commentedon Jul 15, 2026
Any progress?
tagorr commentedon Jul 15, 2026
This issue was resolved a long time ago. In what form is it appearing for you now? And in which version of Codex?
HOS459 commentedon Jul 16, 2026
Also reproducing in Codex App 26.707.9981.0 on Microsoft Windows NT 10.0.26100.0 x64. The safe apply_patch helper repeatedly fails with CreateProcessWithLogonW failed: 5, including inside a permitted workspace. Read-only operations and separately approved elevated commands work. The failure persists across Codex restarts and tasks.
Feedback ID: 019f4ff5-7668-7e42-ad5f-e7b370fd9297
HOS459 commentedon Jul 16, 2026
Tested the documented unelevated sandbox fallback in Codex App 26.707.9981.0 on Microsoft Windows NT 10.0.26100.0 x64. Creating a new file with apply_patch succeeded, but ordinary sandboxed command execution and apply_patch updates to existing files still failed with CreateProcessWithLogonW failed: 5. Restored sandbox = "elevated" afterward. Feedback ID: 019f4ff5-7668-7e42-ad5f-e7b370fd9297
IDanielRosell commentedon Jul 18, 2026
Confirmed on current Codex Desktop for Windows.
Environment
26.715.4045.0codex doctor:0.145.0-alpha.1810.0.19045x64Repro
With this configuration:
every sandboxed command fails before the requested process starts, including
apply_patchand trivial read-only commands:The failure is independent of the project folder. I verified that:
CodexSandboxOfflineandCodexSandboxOnlineexist, are enabled, and havePasswordExpired = 0;The older sandbox re-onboarding workaround was not sufficient in my Desktop setup.
Working workaround
Changing only this setting fixes the issue:
After starting a fresh Codex process, I confirmed that it could successfully:
apply_patchto modify a file;git diffto verify the change.This looks closely related to the current elevated-vs-unelevated Windows sandbox failure family, including #24098.
Additional diagnostic
codex doctor --jsonreports the installation/config as healthy, but update/runtime download checks also fail on this machine with:That may be a separate Windows TLS/revocation issue, but the elevated sandbox failure is reproducible even though the sandbox accounts and workspace ACLs are healthy.
Feedback/thread ID:
019f75c0-8d55-7863-a9e1-89189ccd69e1LukasWillin commentedon Jul 20, 2026
This sadly seems to only work temporarely. After a few prompts it bugs out again.
sandbox = "unelevated" does the trick, but I don't like it (I assume it's less secure?)