`elevated_windows_sandbox` causing all agent commands to fail with `(no output)` (logs show `CreateProcessAsUserW failed: 5`)
What version of Codex is running?
codex-cli 0.92.0
What subscription do you have?
Business
Which model were you using?
gpt-5.2-codex
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
WezTerm (version 20240203-110809-5046fc22) running PowerShell-7.5.4
What issue are you seeing?
Here is an example from ~\.codex\.sandbox\sandbox.log - it seems like every occurrence follows this same pattern, terminating with CreateProcessAsUserW failed: 5 (even including some extremely similar errors from 1-2 weeks ago)
[2026-01-28 23:52:44.536 codex.exe] START: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-ChildItem -Force
[2026-01-28 23:52:44.542 codex.exe] sandbox setup required: sandbox setup marker missing or incompatible
[2026-01-28T13:52:50.266862700+00:00] ensuring sandbox users offline=CodexSandboxOffline online=CodexSandboxOnline
[2026-01-28T13:52:50.679248100+00:00] firewall rule configured name=codex_sandbox_offline_block_outbound protocol=256 LocalUserAuthorizedList=O:LSD:(A;;CC;;;S-1-5-21-xxxxx)
[2026-01-28T13:52:50.690563400+00:00] granting write ACE to D:\repo\subdir for sandbox group and capability SID
[2026-01-28T13:52:50.719824400+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:52:50.721659100+00:00] read ACL run completed
[2026-01-28 23:52:50.962 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28 23:52:50.975 codex.exe] setup refresh: spawning X:\scoop\persist\nodejs\bin\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex-windows-sandbox-setup.exe (cwd=D:\repo\subdir, payload_len=668)
[2026-01-28T13:52:51.005385400+00:00] setup refresh: processed 3 write roots (read roots delegated); errors=[]
[2026-01-28 23:52:51.005 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28T13:52:51.029863800+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:52:51.032045+00:00] read ACL run completed
[2026-01-28 23:52:51.615 codex-command-runner.exe] runner start cwd=D:\repo\subdir cmd=["C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\\pwsh.exe", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\nGet-ChildItem -Force"] real_codex_home=C:\Users\username\.codex
[2026-01-28 23:52:51.618 codex-command-runner.exe] runner: effective cwd=D:\repo\subdir (requested D:\repo\subdir)
[2026-01-28 23:52:51.628 codex-command-runner.exe] runner: spawn failed: CreateProcessAsUserW failed: 5
[2026-01-28 23:52:51.633 codex.exe] FAILURE: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-ChildItem -Force (exit code 1)
[2026-01-28 23:52:55.612 codex.exe] START: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-Location
[2026-01-28 23:52:55.623 codex.exe] setup refresh: spawning X:\scoop\persist\nodejs\bin\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex-windows-sandbox-setup.exe (cwd=D:\repo\subdir, payload_len=668)
[2026-01-28T13:52:55.651159600+00:00] setup refresh: processed 3 write roots (read roots delegated); errors=[]
[2026-01-28 23:52:55.651 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28T13:52:55.676336500+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:52:55.679250100+00:00] read ACL run completed
[2026-01-28 23:52:55.734 codex-command-runner.exe] runner start cwd=D:\repo\subdir cmd=["C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\\pwsh.exe", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\nGet-Location"] real_codex_home=C:\Users\username\.codex
[2026-01-28 23:52:55.736 codex-command-runner.exe] runner: effective cwd=D:\repo\subdir (requested D:\repo\subdir)
[2026-01-28 23:52:55.745 codex-command-runner.exe] runner: spawn failed: CreateProcessAsUserW failed: 5
[2026-01-28 23:52:55.749 codex.exe] FAILURE: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-Location (exit code 1)
[2026-01-28 23:53:00.397 codex.exe] START: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-Location
[2026-01-28 23:53:00.407 codex.exe] setup refresh: spawning X:\scoop\persist\nodejs\bin\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex-windows-sandbox-setup.exe (cwd=D:\repo\subdir, payload_len=668)
[2026-01-28T13:53:00.434565+00:00] setup refresh: processed 3 write roots (read roots delegated); errors=[]
[2026-01-28 23:53:00.434 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28T13:53:00.460019700+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:53:00.462272800+00:00] read ACL run completed
[2026-01-28 23:53:00.514 codex-command-runner.exe] runner start cwd=D:\repo\subdir cmd=["C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\\pwsh.exe", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\nGet-Location"] real_codex_home=C:\Users\username\.codex
[2026-01-28 23:53:00.516 codex-command-runner.exe] runner: effective cwd=D:\repo\subdir (requested D:\repo\subdir)
[2026-01-28 23:53:00.526 codex-command-runner.exe] runner: spawn failed: CreateProcessAsUserW failed: 5
[2026-01-28 23:53:00.530 codex.exe] FAILURE: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
Get-Location (exit code 1)
[2026-01-28 23:53:05.709 codex.exe] START: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
pwd
[2026-01-28 23:53:05.719 codex.exe] setup refresh: spawning X:\scoop\persist\nodejs\bin\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex-windows-sandbox-setup.exe (cwd=D:\repo\subdir, payload_len=668)
[2026-01-28T13:53:05.753275800+00:00] setup refresh: processed 3 write roots (read roots delegated); errors=[]
[2026-01-28 23:53:05.753 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28T13:53:05.777629900+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:53:05.779460600+00:00] read ACL run completed
[2026-01-28 23:53:05.825 codex-command-runner.exe] runner start cwd=D:\repo\subdir cmd=["C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\\pwsh.exe", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\npwd"] real_codex_home=C:\Users\username\.codex
[2026-01-28 23:53:05.827 codex-command-runner.exe] runner: effective cwd=D:\repo\subdir (requested D:\repo\subdir)
[2026-01-28 23:53:05.836 codex-command-runner.exe] runner: spawn failed: CreateProcessAsUserW failed: 5
[2026-01-28 23:53:05.840 codex.exe] FAILURE: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
pwd (exit code 1)
[2026-01-28 23:53:10.704 codex.exe] START: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
cmd /c dir
[2026-01-28 23:53:10.714 codex.exe] setup refresh: spawning X:\scoop\persist\nodejs\bin\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex-windows-sandbox-setup.exe (cwd=D:\repo\subdir, payload_len=668)
[2026-01-28T13:53:10.741790300+00:00] setup refresh: processed 3 write roots (read roots delegated); errors=[]
[2026-01-28 23:53:10.741 codex-windows-sandbox-setup.exe] setup binary completed
[2026-01-28T13:53:10.767054+00:00] read-acl-only mode: applying read ACLs
[2026-01-28T13:53:10.769115900+00:00] read ACL run completed
[2026-01-28 23:53:10.819 codex-command-runner.exe] runner start cwd=D:\repo\subdir cmd=["C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\\pwsh.exe", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\ncmd /c dir"] real_codex_home=C:\Users\username\.codex
[2026-01-28 23:53:10.821 codex-command-runner.exe] runner: effective cwd=D:\repo\subdir (requested D:\repo\subdir)
[2026-01-28 23:53:10.832 codex-command-runner.exe] runner: spawn failed: CreateProcessAsUserW failed: 5
[2026-01-28 23:53:10.837 codex.exe] FAILURE: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe -Command [Console]::OutputEncoding=[System.Text.Encoding]::UTF8;
cmd /c dir (exit code 1)
What steps can reproduce the bug?
See uploaded thread: 019c04d8-9c59-7222-
I believe I first encountered this error immediately after updating to the version where the elevated_windows_sandbox feature was shipped 1-2 weeks ago. Since then, I have noticed it occur in/with multiple different:
- repos/locations
- models
- sandbox/approval settings
- various other
config.tomlkeys/values
The only thing that has consistently worked as a temporary fix has been disabling the elevated_windows_sandbox feature using command line flag/config.toml, and relying on the previous experimental_windows_sandbox feature instead.
What is the expected behavior?
Commands executed by the agent should follow whatever sandbox/policy settings are configured, i.e. read-only commands within the workspace should proceed without first requiring explicit approval and/or failing with (no output).
Additional information
I thought I would mention that, when I was doing some testing to try to find the root cause, I had this interaction with the model - and I am almost certain that I remember something very similar occurring a week or two ago, when I was troubleshooting the exact same sandbox issues:
╭───────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.92.0) │
│ │
│ model: gpt-5.2-codex xhigh /model to change │
│ directory: D:\repo\subdir │
╰───────────────────────────────────────────────────╯
› try running a simple cmd like get-childitem
• *Preparing to run shell command*
$ Get-ChildItem -Force
✗ (1) • 655ms
• *Preparing to rerun with escalated privileges*
$ Get-ChildItem -Force
Directory: D:\repo\subdir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 28/01/2026 5:19 AM .ruff_cache
...
...
✓ • 1.21s
─ Worked for 16s ───────────────────────────────────────────────────────────────────────
• Ran Get-ChildItem -Force successfully. I can proceed with whatever you want next.
› why did the first attempt fail
• *The sandbox required escalation and produced no output with exit code 1, indicating a likely failure or blocked
execution to address next.*
• The first run was blocked by sandbox permissions. It needed escalated access to list the workspace, so it exited with
code 1 and no output. I re-ran it with escalated permissions and it succeeded.
Very much makes me wonder if perhaps the issue is with the model itself, or at least how it interacts with the harness/sandbox.... Though, judging by the system prompt's description of the on-request option for approval_policy, maybe there actually is an issue with the sandbox, as it doesn't sound like simple read-only commands, e.g. gci, should require escalation ? specifically wrt to below (apologies if I am looking at some unrelated piece of the framework lol):
... Here are scenarios where you'll need to request approval:\r\n- You need to run a command that writes to a directory that requires it (e.g. running tests that write to /var)\r\n- You need to run a GUI app (e.g., open/xdg-open/osascript) to open browsers or files.\r\n- You are running sandboxed and need to run a command that requires network access (e.g. installing packages)\r\n- If you run a command that is important to solving the user's query, but it fails because of sandboxing, rerun the command with approval. ALWAYS proceed to use the `sandbox_permissions` and `justification` parameters - do not message the user before requesting approval for the command.\r\n- You are about to take a potentially destructive action such as an `rm` or `git reset` that the user did not explicitly ask for. ...
21 Comments
Hi there @i4TsU - thanks for the detailed report and I'm sorry you're running into issues with the elevated sandbox. It appears that the sandbox is unable to execute your version of powershell. Can you run the following commands and let me know their output? That will help further diagnose the issue and lead me towards an appropriate fix:
No worries! :)
thank you for the quick reply. I'm still working to reproduce/diagnose the issue. In the meantime, I think you have two options
experimental_windows_sandboxfeature instead of the elevated one. For nearly all use cases, it is just as goodpwshthat was installed via the Windows Store, and re-installing usingwinget. Totally optional, but if you go this route let me know if it works. It will provide some useful debugging information:Reinstalling pwsh seems to have solved the issues with the sandbox :) I was able to do a little testing between other things - I just uploaded a "post-fix" session (Thread ID: 019c0d0d-f58f-7160-bbbe-9a0bf0364ce8), and linked this GitHub Issue in the feedback notes too, but I will try to summarise what I observed below, along with some additional info from before reinstalling pwsh:
---
pwsh.exeasCodexSandboxOfflineuser via PsExec resulted in a similar failure:```powershell
> psexec64 -u CodexSandboxOffline -p codex cmd /c "C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe" -Command "Get-ChildItem -Force"
PsExec v2.43 - Execute processes remotely
Copyright (C) 2001-2023 Mark Russinovich
Sysinternals - www.sysinternals.com
cmd exited with error code 1.
```
scoop install pwsh --global).Get-AppxPackage -Name Microsoft.PowerShell | Remove-AppxPackageas suggested.```powershell
> where.exe pwsh
X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe
X:\ProgramData\scoop\shims\pwsh.exe
> where.exe powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
> Get-Command pwsh, powershell | Select-Object Name, Source, Path
Name Source Path
---- ------ ----
pwsh.exe X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe
powershell.exe C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
> Get-AppxPackage -Name Microsoft.PowerShell -AllUsers | Select-Object Name, PackageFullName, InstallLocation
> icacls 'X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe'
X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe BUILTIN\Administrators:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
NT AUTHORITY\Authenticated Users:(I)(M)
BUILTIN\Users:(I)(RX)
Successfully processed 1 files; Failed processing 0 files
> X:\ProgramData\scoop\apps\pwsh\current\pwsh.exe -NoProfile -Command '$PSVersionTable.PSVersion'
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
7 5 4
> scoop info pwsh
Name : pwsh
Description : Cross-platform automation and configuration tool/framework, known as Powershell Core, that works well with existing tools and is optimized for dealing with structured data.
Version : 7.5.4
Source : main
Website : https://github.com/PowerShell/PowerShell
License : MIT
Updated at : 21/10/2025 6:29:25 AM
Updated by : github-actions[bot]
Installed : 7.5.4 global
Binaries : pwsh.exe
Shortcuts : PowerShell Core
Notes : Since Scoop uses pwsh.exe internally, to update PowerShell Core itself,
run
scoop update pwshfrom Windows PowerShell, i.e. powershell.exe.Add PowerShell Core as a explorer context menu by running: '<root>\install-explorer-context.reg'
For file context menu, run '<root>\install-file-context.reg'
```
---
This morning, I then tried running the same tests in a new codex session, using the same location + config as before:
elevated_windows_sandbox = trueandexperimental_windows_sandbox = truefrom myconfig.tomland launching a new session + reenabling the elevated sandbox when prompted, everything worked as expected with no further issues (except for an "Access denied" error related to theoh-my-poshinit in my$PROFILE)/feedbackunfortunately, but hopefully you have enough info from everything else to determine whether or not any further action is warranted :)on-request/workspace-writepermissions):Get-ChildIteminside workspace: now executes successfully inside of the sandbox (model no longer needs to escalate/request approval)apply_patchtool behaved exactly as expected, requiring manual approval when modifying files outside of the workspace, and applying changes successfully and without approval---
Hopefully that helps with repro/identifying the issue and whether or not it is worth safeguarding against lol - and, if not, hopefully you did not waste too much time on it :). Thanks for your help in any case, and let me know if you want me to share any other details/run any tests etc.!
I am experiencing the same issue here. Any PowerShell command that Codex attempts to run gives no output. It started with some of the latest codex updates. I can confirm that disabling
elevated_windows_sandboxand enablingexperimental_windows_sandboxfixes the issue.What version of Codex is running?
codex-cli 0.94.0
Which model were you using?
gpt-5.2-codex
What platform is your computer?
Windows 11 25H2 10.0.26220.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal running PowerShell-7.5.4
Here's the output of the commands you requested above:
C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe
C:\Users\chris\AppData\Local\Microsoft\WindowsApps\pwsh.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
S-1-15-3-3474344596-1361774275-169937050-1715369765-655753896-4292765343-1302149271:(I)(RX)
VORDEFINIERT\Benutzer:(I)(R)
NT SERVICE\TrustedInstaller:(I)(F)
S-1-15-3-1024-3635283841-2530182609-996808640-1887759898-3848208603-3313616867-983405619-2501854204:(I)(RX)
NT-AUTORITÄT\SYSTEM:(I)(F)
NT-AUTORITÄT\Lokaler Dienst:(I)(RX)
NT-AUTORITÄT\Netzwerkdienst:(I)(RX)
NT-AUTORITÄT\EINGESCHRÄNKTER ZUGRIFF:(I)(RX)
S-1-19-512-4096:(I)(RX,D,WDAC,WO,WA)
For anyone has problem, codex run without std output, i have success case to fix it fine.
It is dll windows missing. install
https://download.visualstudio.microsoft.com/download/pr/7ebf5fdb-36dc-4145-b0a0-90d3d5990a61/CC0FF0EB1DC3F5188AE6300FAEF32BF5BEEBA4BDD6E8E445A9184072096B713B/VC_redist.x64.exe
Then restart, it should work for you.
@jastranlove2020, thanks for sharing your solution. Much appreciated!
Don't think this is the root cause in my case. I already had the latest version of the VC++ x64 Redistributable installed. In my case, it's probably related to PowerShell being installed via the Windows Store (see the earlier comments by @i4TsU).
This is still an issue with Codex 0.116. I can confirm the issue disappears when uninstalling pwsh via the Microsoft Store and installing it instead via the MSI (https://github.com/PowerShell/PowerShell/releases/download/v7.6.0/PowerShell-7.6.0-win-x64.msi).
True. The same sandbox issue can be solved by updating powershell to 7.6.0.
Today, it was announced that the MSI installer of PowerShell has been deprecated and will no longer be available for future PowerShell releases: https://devblogs.microsoft.com/powershell/powershell-msi-deprecation/
This might mean that the workaround presented here will not be feasible in the future anymore.
I can confirm that uninstalling powershell from store and installing it from msi fixed the issue.
Installing pwsh via
scoopfinally fixed it for me.Installing via winget did not work - had the same permissions issue as powershell from store
I can also confirm that uninstalling the PowerShell from m store and installing the MSI version was the right fix for me.
I ahad Powershell 5 and tried to update to 7 using winget, that is when I got the sandbox error.
The msi fix did it.
Additional affected user report from Codex Desktop on Windows.
Codex Desktop is unusable for local project work because every shell command fails before PowerShell starts.
Error:
Minimal repro command attempted from a Codex Desktop project session:
Workspace path:
What was tried:
This is a dead-end user experience: the app presents shell/workspace access, but the runner fails globally before invoking the shell. The surfaced message is not actionable for an end user.
CreateProcessAsUserW failed: 5may be meaningful internally, but Codex Desktop does not show a diagnosis, log path, helper executable path to allowlist, user/elevation context, or next remediation step.Requested improvements:
As-is, reinstalling, running as Administrator, confirming Secondary Logon, and checking Windows Security do not resolve it or reveal the next diagnostic step.
Codex Desktop Windows 26.429.3425.0
Browser Use / in-app browser cannot open google.com.
Initial failure:
failed to execute Node: Access is denied. (os error 5)
Confirmed:
C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\resources\node.exe
→ Access is denied
C:\Program Files\WindowsApps\OpenAI.Codex_26.429.3425.0_x64__2p2nqsd0c76g0\app\resources\rg.exe
→ Access is denied
Confirmed working:
C:\Users\mmggr\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe
→ v24.14.0
Workaround tried:
Copied the working node.exe into recent:
C:\Users\mmggr\.codex\tmp\...\codex-arg*
Result:
node_repl minimal calls started working and Browser Use could detect an about:blank tab.
New failure:
Trying to open https://www.google.com causes node_repl/kernel to close and Codex falls back to:
windows sandbox failed: runner error: CreateProcessAsUserW failed: 5
Also tried:
[windows]
sandbox = "unelevated"
Result:
Does not fix Browser Use. node_repl / Browser Use still fail.
Tried enabling runCodexInWindowsSubsystemForLinux manually in:
C:\Users\mmggr\.codex\.codex-global-state.json
Result:
Codex hangs indefinitely when running pwd, so WSL agent mode is not usable from this build/UI.
Conclusion:
This appears to combine the WindowsApps packaged helper execution failure with the Windows sandbox CreateProcessAsUserW failed: 5 issue. Browser Use remains unusable on this Windows Desktop build.
I reproduced a closely related elevated sandbox failure where setup completed, but command launch failed with:
CreateProcessAsUserW failed: 5
In my case the root cause appeared to be PowerShell resolution through a Microsoft Store/App Execution Alias path.
Relevant details:
C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe
Then I uninstalled Store PowerShell and the failure changed to:
CreateProcessAsUserW failed: 2
That matched the now-missing pwsh path.
Installing PowerShell 7 via the x64 MSI fixed this part:
C:\Program Files\PowerShell\7\pwsh.exe
<machine>\CodexSandboxOffline
Adding a current Codex Desktop Windows data point where this same PowerShell / WindowsApps alias failure was fixed by installing the real MSI/WiX PowerShell and making PATH precedence deterministic.
Environment:
OpenAI.Codex_26.527.7698.0_x64__2p2nqsd0c76g0codex-cli 0.136.0-alpha.2workspace-writetool execution.Initial symptom:
pwshresolved to the WindowsApps app-execution alias instead of a normal executable:That matches the failure family in this thread: sandbox runner/setup may be healthy enough to start, but the actual shell process path is the WindowsApps/MSIX alias path that does not behave like a normal executable for the Codex sandbox users.
What I changed:
PathsoC:\Program Files\PowerShell\7appears beforeC:\Users\<user>\AppData\Local\Microsoft\WindowsApps.The user PATH after the fix was shaped like:
One detail: before restarting Codex Desktop, the running Codex process still had a stale environment snapshot, so
where.exe pwshstill showed the WindowsApps alias. After a full Codex Desktop restart, the new process inherited the fixed PATH.Post-restart verification:
A sandboxed PowerShell write/read in the workspace also succeeded:
Result:
So for this machine, the durable fix was not just installing PowerShell via MSI/WiX; it was also ensuring
C:\Program Files\PowerShell\7wins PATH resolution over the WindowsApps app-execution alias, then fully restarting Codex Desktop. After that, sandboxed PowerShell tool execution worked again.PR-ready fork branch updated after local Codex app repair.
Fork PR: https://github.com/Nicolas0315/codex/pull/1
Upstream compare: https://github.com/openai/codex/compare/main...Nicolas0315:codex/doctor-windows-pwsh-alias-warning?expand=1
Latest branch commit: 1b3c6a5
Clarify rollout inventory recovery in doctorWhat this now covers:
pwshdetection incodex doctorfor Windows sandbox shell failures.logs_2.sqlite/ WAL / SHM detection incodex doctor.threadsstate DB.Local repair evidence from the affected Windows installation:
notifyhook after backup; this stopped newos error 206hook failures.defaultPromptconstraints.logs_2.sqliteshrank from ~729 MB to ~5.8 MB.codex doctor --summary --no-color --ascii: 16 ok, 1 idle, 3 notes, 1 warn, 0 fail. Remaining warn is rollout/thread inventory drift and now has explicit safe recovery guidance in the branch.Validation on the branch:
cargo test -p codex-cli --bin codex windows_shell_check: passed 2 tests.cargo test -p codex-cli --bin codex large_sqlite_log_issue: passed 1 test.cargo test -p codex-cli --bin codex thread_inventory_check_warns_for_missing_stale_and_mismatched_rows: passed 1 test.git diff --check: passed.just fmt: Rust/Python formatting completed; Bazel/Starlark buildifier still fails on this Windows host with[WinError 2].Upstream PR creation blocker is still repo policy, not branch/auth/body:
openai/codexreportspull_request_creation_policy: collaborators_only, and this account only haspull:true. A maintainer needs to inviteNicolas0315as collaborator or open/cherry-pick the fork branch.Same root problem (
elevated_windows_sandboxunusable on Windows 10.0.26200), but I'm seeing several distinct failure signatures across two builds, so adding data in case it helps triage.Environment
CodexSandboxOnline,CodexSandboxOffline, groupCodexSandboxUsersall presentmodel_reasoning_effort = xhigh,sandbox = workspace-writeObserved signatures (all with
features.elevated_windows_sandbox = true)``
`exec_command failed ... CreateProcess { message: "Rejected(\"Failed to create unified exec process:
orchestrator_helper_exit_nonzero: setup helper exited with status Some(-1073741502)\")" }
-1073741502=0xC0000142(**STATUS_DLL_INIT_FAILED**). Note this differs from theCreateProcessAsUserW failed: 5` in the original report — here the child is created but fails during DLL init.codex-windows-sandbox-setup.exehangs in a CPU spin-loop: 4 instances accumulating 260–350 CPU-seconds whilecodexblocks behind them. Had to kill them manually.status Some(143)).~/.codex/.sandbox/sandbox.log) — 38× over prior weeks:``
``setup refresh: failed to spawn ...\codex-windows-sandbox-setup.exe:
The requested operation requires elevation. (os error 740)
i.e. non-elevated Codex cannot launch the elevated setup helper at all.
Extra diagnostics
helper_request_args_failed: failed to decode payload b64) — so signature (1) is a DLL-init failure of the spawned-as-sandbox-user process, consistent with a missing window-station/desktop grant for theCodexSandbox*users rather than a corrupt binary.elevated_windows_sandbox = false, commands run and out-of-workspace writes are still blocked (e.g. write toC:\→ access denied). So this is isolated to the elevated layer.Net effect / workaround
With
elevated_windows_sandbox = true, all agent commands fail (crash / spin / stall depending on build & elevation). Settingelevated_windows_sandbox = falserestores a working agent while keeping restricted-token write-confinement; you lose only the separate sandbox-user identity and per-user firewall egress. That's the only usable configuration here today.I can reproduce this in Codex Desktop on Windows, and I isolated the behavior by testing the relevant settings separately.
Environment:
26.707.31428Microsoft Windows NT 10.0.26200.07.6.3Reproduction/result:
[windows] sandbox = "elevated", even a minimalWrite-Output OKcommand never reaches command execution or an approval/escalation gate. No error, stdout, or stderr is returned; the tool call simply hangs indefinitely and must be terminated. The requested command timeout is not honored normally.[windows] sandbox = "unelevated", the identical command succeeds consistently in approximately 0.5 seconds.shell_environment_policy.inheritindependently does not determine the result. The behavior consistently follows the elevated versus unelevated sandbox setting.I encountered similar behavior a few Codex versions ago, but previously it would usually resolve after a Codex CLI update or reinstall. This occurrence persists despite the in-app reinstall.
Current workaround:
The most important distinction in this reproduction is that the command does not fail after reaching PowerShell or an approval gate: it never gets that far from the user's perspective. Codex returns no diagnostic at all and remains hung.