Windows sandbox 0.146.0: physical standalone package reaches SpawnChild but CreateProcessAsUserW fails with error 2

Open 💬 1 comment Opened Jul 31, 2026 by BorkBork81

Summary

On an official Windows standalone installation, the native sandbox cannot start even a harmless child process.

The PATH shim initially exhibits the helper-resolution problem already reported in #32655. However, unlike the reproductions in that issue, invoking the physical 0.146.0 release binary with its matching codex-resources directory available still fails later during SpawnChild:

CreateProcessAsUserW failed: 2

The setup helper, command-runner copy, and ACL setup all complete before the failure.

Environment

  • Codex CLI: 0.146.0
  • Installation: Windows standalone package
  • Package architecture: x86_64-pc-windows-msvc
  • Registry ProductName: Windows 10 Pro
  • DisplayVersion: 25H2
  • OS build: 26200.8973
  • Sandbox mode tested: unelevated
  • codex doctor: 17 checks OK, 0 failures

The failure occurs before model execution.

Minimal reproduction

Run from ordinary PowerShell:

$releaseRoot = Join-Path $env:USERPROFILE `
    '.codex\packages\standalone\releases\0.146.0-x86_64-pc-windows-msvc'

$codex = Join-Path $releaseRoot 'bin\codex.exe'
$resources = Join-Path $releaseRoot 'codex-resources'
$cmd = Join-Path $env:SystemRoot 'System32\cmd.exe'

$originalPath = $env:Path

try {
    $env:Path = "$resources;$originalPath"

    & $codex sandbox windows `
        -c 'windows.sandbox="unelevated"' `
        -- $cmd /d /c `
        'echo CODEX_WINDOWS_SANDBOX_OK'

    Write-Host "SANDBOX_EXIT_CODE=$LASTEXITCODE"
}
finally {
    $env:Path = $originalPath
}

Expected behavior

The sandbox should execute the harmless command and return:

CODEX_WINDOWS_SANDBOX_OK
SANDBOX_EXIT_CODE=0

Actual behavior

The setup stage succeeds, including locating/copying the command runner and completing the ACL work. The requested child process never starts:

windows sandbox: runner failed during SpawnChild:
CreateProcessAsUserW failed: 2

The sandbox command exits with code 1.

Additional tests

The same failure occurs when:

  • cmd.exe is supplied through its absolute System32 path.
  • Windows PowerShell 5.1 is supplied through its absolute path.
  • windows.sandbox_private_desktop=false is set.
  • The physical release binary is used instead of the PATH shim.
  • The matching release codex-resources directory is prepended to PATH.

Confirmed:

  • codex-windows-sandbox-setup.exe exists and executes.
  • codex-command-runner.exe exists, is found, and is copied.
  • The command targets exist and run outside the sandbox.
  • The standalone and AppX resource copies inspected were identical.
  • codex doctor reports a healthy installation but does not detect this child-process launch failure.

The sandbox log also contains an Access denied warning involving C:\Users\Default, but I cannot establish whether that warning causes the CreateProcessAsUserW failure.

Relationship to #32655

Issue #32655 covers helper discovery through the Windows PATH shim. Its reported workaround or use of the physical package binary allows sandbox execution to succeed.

In this environment, correcting helper discovery allows setup to progress, but the physical package still fails during SpawnChild. This therefore appears to be an additional failure after the #32655 helper-resolution stage.

A sanitized sandbox.<date>.log can be supplied if needed. No files from .sandbox-secrets will be shared.

View original on GitHub ↗

1 Comment

wvehuiah · 7 days ago

I can reproduce this on a newer Codex build and have submitted diagnostics through /feedback.

Feedback thread ID:
01a01b5b-c626-7190-ba8f-a8a3ed11c414

Environment:

  • Codex CLI 0.148.0
  • Windows 25H2
  • Build 26200
  • x64
  • Native Windows sandbox

Current reproduction:

  • elevated -> CreateProcessAsUserW failed: 2
  • unelevated -> same error
  • absolute C:\Windows\System32\cmd.exe -> same error
  • windows.sandbox_private_desktop=false -> same error
  • /setup-default-sandbox was rerun successfully; after restarting Codex without session overrides, elevated mode was restored but the same error persists

This is not PowerShell-specific: cmd.exe fails identically.

Historical local sandbox logs provide a useful regression boundary:

  • 2026-08-14: OpenAI.Codex 26.803.10989.0 / codex-command-runner 0.147.0-alpha.6.6 -> sandbox commands completed with SUCCESS.
  • The app was then updated to OpenAI.Codex 26.810.4967.0.
  • 2026-08-17: OpenAI.Codex 26.810.4967.0 / codex-command-runner 0.148.0-alpha.9 -> sandbox commands no longer completed successfully.
  • Current CLI 0.148.0 continues to reproduce the failure.

The C:\Users\Default hide users Access Denied warning does not appear sufficient to explain the regression, because the same warning was present on 2026-08-14 while sandbox commands were still completing successfully.

Setup helper execution, command-runner resolution/copy, and ACL refresh complete before the child-process failure.

I can provide sanitized sandbox logs for the working 0.147 and failing 0.148-alpha periods if useful.