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

Open
#36,386 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

Reproduce the failure with the provided PowerShell command and trace the Windows sandbox SpawnChild path around CreateProcessAsUserW. Use the absolute cmd.exe and PowerShell cases to isolate the launch failure; done means the harmless command prints CODEX_WINDOWS_SANDBOX_OK and exits with code 0.

Written by the indexing model from the issue text.

Description

bug CLI sandbox windows-os

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.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.