Skip to content

Windows sandbox helper fails with helper_unknown_error: setup refresh had errors on every exec_command and file read #44696

Open

Description

@cdousign

Environment
codex-cli version: 0.153.0-alpha.5
OS: Windows 11
Sandbox mode: default (workspace-write)
Install path: %LOCALAPPDATA%\OpenAI\Codex\bin<hash>\codex.exe
Summary
On this Windows machine, every invocation of exec_command — and even plain file reads — fails at the sandbox initialization layer before reaching the tool logic. This makes codex-cli fully unusable in any workflow that needs command execution or file access, even read-only.

Steps to reproduce
Run codex.exe exec "" < /dev/null
Observe the error below on the very first tool call, regardless of what the tool call actually does.
Actual error
ERROR codex_core::tools::router: error=exec_command failed: CreateProcess { message:
"Rejected("Failed to create unified exec process: helper_unknown_error: setup refresh had errors")" }
...
ERROR codex_core::tools::router: error=unable to locate image at <file>: fs sandbox helper
failed with status exit code: 1: windows sandbox failed: helper_unknown_error: setup refresh had errors
Expected behavior
Sandbox helper initializes successfully (or fails with an actionable error naming the missing Windows dependency/feature), and exec_command/file reads work normally under workspace-write sandbox mode.

Notes / what we've ruled out
Not a CLI flag/config issue — this is a lower-level Windows sandbox helper initialization failure, distinct from the (already-fixed) "no active project" confirmation error we hit previously with a different Codex-based agent on the same machine.
We have not tried --dangerously-bypass-approvals-and-sandbox (or equivalent) to isolate whether the sandbox layer itself is the sole blocker, since this instance is driven by an unattended automation pipeline and running without sandbox isn't a safe test to run unattended.
Suspected cause (unconfirmed): a Windows optional feature or permission the sandbox helper depends on (e.g. Windows Sandbox feature, Hyper-V, or app container capability) may not be enabled on this machine. Haven't yet confirmed which one.
Related issues
GitHub's duplicate detector flagged #28278, #28457 and #34928 — all in the same Windows sandbox helper subsystem, but none appear to be the same failure:

#28278 / #28457: the launcher fails to locate the helper executable (error=program not found, or ShellExecuteExW failed... 1223), traced to a PATH/junction mismatch between the visible codex.exe entry point and the real standalone release directory.
#34928: helper crashes with 0xc0000142 (DLL init failure) specifically during the Desktop app's UAC-elevated first-run setup flow.
This issue: the helper is found and launched, but the setup refresh step itself returns helper_unknown_error: setup refresh had errors — a different failure signature, and downstream of where the other three fail. Our install also resolves directly to a versioned bin<hash>\codex.exe path rather than the junction layout described in #28278/#28457, so that specific root cause likely doesn't apply here.
Flagging the overlap in case a maintainer sees a connection we don't, but filing separately since the error text and failure point differ.

Impact
Full loss of function for any automated/headless codex-cli workflow on this machine — it can echo/respond but cannot execute or read files, since 100% of tool calls fail at this layer.

Activity

  1. added
    bug
    CLI
    windows-os
    sandbox
    tool-calls
    on Sep 11, 2026
  2. cizekmilan commented on Sep 13, 2026

    @cizekmilan

    The same issue on Windows 10.
    Solved by changing the permissions on TEMP folder.

    PS C:\Users\Milan> (Get-Acl R:\TEMP).Owner
    BUILTIN\Administrators

    ------ fix ------
    PS C:\Windows\system32> takeown /F R:\TEMP
    SUCCESS: The file (or folder): "R:\TEMP" now owned by user "MILAN-WORK\Milan".

  3. ds01562 commented on Sep 13, 2026

    @ds01562

    Confirmed root cause/fix for this exact failure on Windows 11.

    The generic error was:

    windows sandbox failed: helper_unknown_error: setup refresh had errors

    The useful detail was in %USERPROFILE%\.codex\.sandbox\sandbox.YYYY-MM-DD.log:

    granting write ACE to C:\Temp for sandbox group and capability SID
    write ACE grant failed on C:\Temp: SetNamedSecurityInfoW failed: 5
    setup refresh completed with errors: ["write ACE failed on C:\\Temp: SetNamedSecurityInfoW failed: 5"]
    

    On this machine, C:\Temp was owned by BUILTIN\Administrators. Its existing ACL was otherwise ordinary: Administrators/System FullControl, Users ReadAndExecute, and Authenticated Users Modify.

    Diagnostic sequence/results:

    1. Adding an explicit Modify ACE for the normal Windows user did not fix the Codex sandbox failure.
    2. Changed ownership of the C:\Temp directory itself to the normal Windows user (non-recursively):
      takeown /F C:\Temp
      
    3. Existing ACL entries remained intact.
    4. Retried the same Codex/ChatGPT Work local execution immediately afterward. Sandbox initialization succeeded and local execution worked again.

    No recursive /R ownership change was used.

    This suggests the failure can be caused by the sandbox helper needing to modify the DACL on a write root while that root is owned by BUILTIN\Administrators; ordinary filesystem Modify permission for the interactive user is not sufficient. It would be useful if the top-level helper_unknown_error surfaced the underlying path and SetNamedSecurityInfoW failed: 5, since the sandbox log made the problem straightforward to diagnose.

    This was reproduced repeatedly before the ownership change, including after restarting the ChatGPT/Codex process tree; the first retry after changing ownership succeeded.

  4. TheFl1y commented on Sep 17, 2026

    @TheFl1y

    Confirmed a similar failure on Windows, with a reproducible workaround involving a stale cua_node/.staging-* runtime directory.

    Environment

    • Codex App: 26.911.61220
    • OS: Windows 11 x64
    • Windows long paths: enabled (LongPathsEnabled = 1)

    Symptom

    All Codex command execution failed before the requested command actually started, including a simple:

    Get-Location

    Codex reported:

    helper_unknown_error: setup refresh had errors
    

    Changing the Codex project, workspace, and source directory did not resolve the issue.

    A newly created Codex project could initially access the same source directory, but the failure later reproduced there as well, indicating that the problem was not specific to the workspace itself.

    Sandbox log

    The sandbox log repeatedly showed:

    runtime read/execute validation failed
    

    followed by:

    CreateFileW failed
    

    The failing path was consistently under:

    C:\Users\<USER>\AppData\Local\OpenAI\Codex\runtimes\cua_node\
    .staging-<runtime-hash>-<random>\
    

    In my case, the actual staging directory was:

    .staging-e7fe122ad3cbcd58-IfqC80
    

    A representative failing path went deeply through the bundled Node dependency tree:

    bin\node_modules\@oai\sky\dist\js-dependency-cache\
    shared-v1\applied-bk-agent-openai-js\pnpm-store\v11\
    links\@rollup\plugin-typescript\12.1.2\...
    

    The relevant sequence in the sandbox log looked like:

    read ACL run completed
    
    runtime read/execute validation failed:
    validate runtime read/execute access on
    C:\Users\<USER>\AppData\Local\OpenAI\Codex\runtimes\cua_node\
    .staging-...\bin\node_modules\...
    
    CreateFileW failed for
    C:\Users\<USER>\AppData\Local\OpenAI\Codex\runtimes\cua_node\
    .staging-...\bin\node_modules\...
    
    setup refresh completed with errors
    
    setup error: setup refresh had errors
    

    Diagnostics performed

    Before applying the workaround, I checked several possible causes.

    Windows long-path support

    Get-ItemProperty `
      "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
      -Name LongPathsEnabled

    Result:

    LongPathsEnabled : 1
    

    So Windows long-path support was already enabled.

    Path accessibility

    I tested the exact path that appeared in the Codex sandbox log.

    Both the normal path and extended Win32 path were accessible:

    Normal path:
    True
    
    Extended path:
    True
    

    Therefore, the path itself existed and was accessible from my normal Windows account.

    File/directory type

    The object that Codex failed to validate was a normal directory:

    PSIsContainer : True
    Attributes    : Directory
    LinkType      :
    Target        : {}
    

    It was not a symbolic link or junction.

    ACL / sandbox permissions

    The directory ACL included:

    CodexSandboxUsers    ReadAndExecute, Synchronize    Allow
    SYSTEM               FullControl                    Allow
    Administrators       FullControl                    Allow
    <USER>               FullControl                    Allow
    

    The Codex sandbox accounts also existed and were enabled:

    CodexSandboxOffline    True
    CodexSandboxOnline     True
    

    So this did not appear to be a simple missing ReadAndExecute ACL issue.

    Node / npm / NVM

    System Node/npm configuration was also checked.

    However, the failure occurred during Codex sandbox setup, before the requested workspace command was actually launched.

    This suggests that NVM or the project's Node.js configuration was not the cause of this particular failure.

    Interesting observation

    I scanned the entire Codex bundled runtime directory:

    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
    

    for paths longer than 259 characters.

    PowerShell command:

    $root = "$env:LOCALAPPDATA\OpenAI\Codex\runtimes\cua_node"
    
    Get-ChildItem -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue |
    Where-Object { $_.FullName.Length -gt 259 } |
    ForEach-Object {
        $relative = $_.FullName.Substring($root.Length + 1)
        $top = $relative.Split('\')[0]
    
        [PSCustomObject]@{
            TopFolder = $top
            Length    = $_.FullName.Length
        }
    } |
    Group-Object TopFolder |
    Select-Object Name, Count

    The result was:

    Name                                      Count
    ----                                      -----
    .staging-e7fe122ad3cbcd58-IfqC80          4
    

    In other words, all paths longer than 259 characters in the cua_node runtime tree existed only inside the stale .staging-* directory.

    I am not certain whether the path length itself is the direct root cause, since the same path was accessible normally from PowerShell.

    However, Codex's sandbox runtime validation consistently failed specifically inside this staging tree.

    Workaround that fixed the problem

    I completely closed Codex and moved the stale .staging-* directory out of:

    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
    

    I moved it rather than deleting it, so it could be restored if necessary.

    PowerShell:

    Stop-Process -Name Codex -Force -ErrorAction SilentlyContinue
    Stop-Process -Name ChatGPT -Force -ErrorAction SilentlyContinue
    Stop-Process -Name codex-windows-sandbox-setup -Force -ErrorAction SilentlyContinue
    
    $base = "$env:LOCALAPPDATA\OpenAI\Codex\runtimes\cua_node"
    $backup = "$env:USERPROFILE\CodexStagingBackup_$(Get-Date -Format yyyyMMdd_HHmmss)"
    
    New-Item -ItemType Directory -Path $backup -Force | Out-Null
    
    Get-ChildItem -LiteralPath $base -Directory -Force |
    Where-Object { $_.Name -like ".staging-*" } |
    ForEach-Object {
        Write-Host "Moving:" $_.FullName
        Move-Item -LiteralPath $_.FullName -Destination $backup
    }

    I also moved the existing sandbox setup error file out of the way:

    $err = "$env:USERPROFILE\.codex\.sandbox\setup_error.json"
    
    if (Test-Path $err) {
        Move-Item -LiteralPath $err `
            -Destination "$backup\setup_error.json.old"
    }

    After that, I verified that no >259-character paths remained inside the active cua_node runtime tree:

    $root = "$env:LOCALAPPDATA\OpenAI\Codex\runtimes\cua_node"
    
    (Get-ChildItem -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue |
    Where-Object { $_.FullName.Length -gt 259 }).Count

    Result:

    0
    

    I then reopened Codex and tested:

    Get-Location

    Codex immediately started executing commands normally again.

    File reading and other tool execution also recovered.

    No Windows reboot was required after moving the stale staging directory.

    Conclusion / possible cause

    Based on this behavior, it appears that an abandoned or incomplete bundled cua_node .staging-* runtime directory can remain under the active runtime root.

    Codex subsequently includes that staging tree during sandbox runtime read/execute validation.

    In this case, validation repeatedly failed with CreateFileW failed, which caused the entire sandbox setup to abort with:

    helper_unknown_error: setup refresh had errors
    

    Because sandbox initialization failed before command execution, even basic commands such as Get-Location could not run.

    Moving the stale .staging-* directory outside the cua_node runtime root immediately resolved the problem.

    It may be worth having Codex:

    • automatically detect and clean up abandoned .staging-* runtime directories;
    • exclude incomplete staging directories from sandbox runtime validation;
    • or retry/rebuild the bundled runtime when staging validation fails.

    I can provide additional sanitized sandbox logs if they would be useful.

  5. Aberdebes commented on Sep 18, 2026

    @Aberdebes

    I just had this issue, here's ChatGPT's report on how it helped me fix it:

    ---------------------------------------------------------------- ChatGPT
    I was able to isolate and resolve this failure on Windows with Codex CLI 0.155.0.

    Environment

    • Windows 11 Pro x64
    • Codex CLI 0.155.0
    • npm installation
    • PowerShell 7.6.6
    • LongPathsEnabled = 1
    • failing mode reproduced with:
    codex exec --ephemeral --sandbox read-only -C <REPO> "<read-only repository task>"

    Failure

    A completely fresh terminal and fresh Codex process started normally, but the first repository/file execution failed before PowerShell or Git actually ran:

    Failed to create unified exec process:
    helper_unknown_error: setup refresh had errors
    

    Plain codex exec, --ephemeral, --sandbox read-only, and the combination of both flags could all start successfully. The failure occurred when Codex attempted the first actual internal repository/tool operation.

    Exact sandbox-log failure

    The sandbox log showed that the ACL phase completed:

    read-acl-only mode: applying read ACLs
    read ACL run completed
    

    The failure then occurred during runtime read/execute validation against an old cached CUA runtime:

    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\
    dd584937042db7da\
    bin\node_modules\@oai\sky\dist\js-dependency-cache\
    shared-v1\applied-bk-agent-openai-js\pnpm-store\v11\
    links\@rollup\plugin-typescript\12.1.2\
    a522fe9000e9cb07598cb89328c5f87afda445b7562f1579b3d4e1f77197a142
    

    The exact error was:

    runtime read/execute validation failed:
    validate runtime read/execute access on <path>:
    CreateFileW failed for <path>
    

    followed by:

    setup refresh completed with errors
    setup error: setup refresh had errors
    

    The failing object existed and appeared readable

    The directory existed and was a normal directory rather than a reparse point.

    Its ACL included:

    CodexSandboxUsers:(OI)(CI)(RX)
    SYSTEM:(OI)(CI)(F)
    Administrators:(OI)(CI)(F)
    <current-user>:(OI)(CI)(F)
    

    The runtime contained:

    manifest.json
    bin\node.exe
    bin\node_repl.exe
    

    Windows long-path support was already enabled:

    LongPathsEnabled = 1
    

    Stale runtime state

    There were two old content-addressed runtime directories under:

    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
    

    with timestamps from August 2026, while the active CLI had subsequently been updated.

    There was also stale npm update residue under:

    %APPDATA%\npm\node_modules\@openai\.codex-*
    

    which matched warnings I had repeatedly seen during previous Codex CLI updates where npm reported that a temporary directory could not be removed.

    Diagnostic test: alternate LOCALAPPDATA

    I temporarily launched Codex with an empty, shorter LOCALAPPDATA:

    New-Item -ItemType Directory -Force 'C:\CodexLocal' | Out-Null
    $env:LOCALAPPDATA = 'C:\CodexLocal'

    The exact previously failing command then succeeded immediately and could read the repository and execute Git normally.

    Confirmed recovery

    I stopped all Codex processes, removed the stale npm .codex-* update directory, and moved the entire old CUA runtime tree completely outside the Codex runtime hierarchy:

    FROM:
    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node
    
    TO:
    C:\CodexRuntimeBackup\cua_node.backup-20260919
    

    After that, the exact previously failing command succeeded immediately.

    Before the repair, codex doctor --json reported:

    sandbox.helpers:
      status: fail
      summary: elevated Windows sandbox provisioning recorded a structured failure
      error code: helper_unknown_error
      sandbox provisioning: failed
    

    After moving the stale runtime tree outside the Codex runtime hierarchy:

    sandbox.helpers:
      status: ok
      summary: sandbox configuration is readable
      sandbox provisioning: complete
    

    Secondary stale configuration

    After removing the runtime tree, Codex also warned that the globally configured node_repl MCP could no longer start because it still referenced:

    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\dd584937042db7da\bin\node_repl.exe
    

    The same generated MCP block also contained other absolute paths tied to that old runtime/app generation.

    Since I am currently using only the standalone npm Codex CLI and no longer use the GUI/runtime integration that created this MCP, I removed the orphaned server with:

    codex mcp remove node_repl

    Afterward:

    mcp.config: ok
    sandbox.helpers: ok
    

    and the CLI starts without the node_repl warning.

    What appears to be happening

    Observed behavior is consistent with:

    stale CUA runtime remains under %LOCALAPPDATA%\OpenAI\Codex\runtimes
        ->
    sandbox setup enumerates/validates that runtime
        ->
    CreateFileW fails on a deeply nested dependency
        ->
    one runtime-validation failure marks the entire sandbox refresh failed
        ->
    all exec_command/file operations are rejected
    

    Renaming the old runtime while leaving it somewhere underneath the Codex runtimes hierarchy did not resolve the problem. Moving it completely outside that hierarchy did.

    Potential fixes

    It may be worth investigating:

    • garbage collection of obsolete content-addressed cua_node runtimes after updates;
    • whether sandbox setup validates stale runtimes that are no longer active;
    • whether a single stale runtime should be allowed to invalidate all command execution;
    • long/deep Windows path handling in the runtime validator;
    • cleanup of stale absolute node_repl/runtime paths after runtime removal or updates;
    • having codex doctor report the exact failing runtime path rather than only helper_unknown_error;
    • providing a supported codex command to validate/repair/reset stale runtime caches.

    I have the relevant sandbox-log excerpt and before/after codex doctor --json output available if useful.

  6. cdousign commented on Sep 19, 2026

    @cdousign
    Author

    Confirming ds01562's root cause on a different write root, and adding a data point: the same failure happens when the
    ownership problem is on the repository's own .git directory instead of C:\Temp.

    Environment: Windows 11 Pro, codex-cli 0.153.0-alpha.5, sandbox: workspace-write, workdir C:\MeuProjeto.

    Before the fix, every exec_command and file read failed with:

    windows sandbox failed: helper_unknown_error: setup refresh had errors
    

    And %USERPROFILE%\.codex\.sandbox\sandbox.<date>.log showed the real reason:

    deny ACE failed on C:\MeuProjeto\.git: SetNamedSecurityInfoW failed for C:\MeuProjeto\.git: 5
    setup refresh: processed 2 write roots (read roots delegated); errors=["deny ACE failed on C:\\MeuProjeto\\.git: SetNamedSecurityInfoW failed for C:\\MeuProjeto\\.git: 5"]
    

    Note the difference from the C:\Temp case: here the helper is applying a DENY ACE to protect .git inside the write root,
    not granting a write ACE. Get-Acl showed the project directory owned by the interactive user, but .git owned by
    BUILTIN\Administrators (inherited ACEs were ordinary: Administrators/SYSTEM FullControl, Users ReadAndExecute,
    Authenticated Users Modify).

    Fix, non-recursive, only the owner changed, in an elevated prompt:

    icacls "C:\MeuProjeto\.git" /setowner "<DOMAIN_OR_MACHINE>\<user>"
    

    Note that this requires elevation: takeown and Set-Acl both fail from a non-elevated session with
    "the current logged on user does not have ownership privileges" / "Attempted to perform an unauthorized operation",
    so a user whose tooling runs unelevated cannot self-heal this.

    After the ownership change, with no restart of anything else, the first retry succeeded and the log became:

    applied deny ACE to protect C:\MeuProjeto\.git
    setup refresh: processed 2 write roots (read roots delegated); errors=[]
    

    A real exec_command then ran in 216ms.

    Suggestion, same as ds01562's: surface the offending path and SetNamedSecurityInfoW failed: <code> in the top-level
    error instead of helper_unknown_error. A one-line hint such as "check ownership of " would have saved days here,
    since ordinary Modify permission for the interactive user looks correct and gives no clue that ownership is what matters.

  7. Freemlen commented on Sep 19, 2026

    @Freemlen

    Cross-reference to a completed Windows sandbox investigation: #43373.

    The same top-level helper_unknown_error: setup refresh had errors was reproduced before command/file access. The investigation found multiple independent failure modes behind that message, including ACL refresh failures and a separate state-file race.

    Most relevant practical signal: on one affected machine, process-scoped TEMP/TMP=C:\CodexTemp restored sandbox/trusted-runtime startup when the normal user Temp path was the failing ACL target.

    This is not necessarily the same root cause here, but #43373 contains a useful decision tree and deeper evidence for interpreting the generic setup-refresh error.

  8. PPRRLLRR commented on Sep 22, 2026

    @PPRRLLRR

    Additional reproduction on Windows 11 with codex-cli 0.156.0 (2026-09-22).

    Environment:

    • OS: Windows 11 x64
    • codex-cli: 0.156.0
    • sandbox: workspace-write
    • approval: never
    • shell: PowerShell 7
    • working directory: local Git repository
    • wrapper forces the workspace root with codex -C <repo-root>

    What worked:

    • codex exec starts normally.
    • The reported workdir is correct.
    • A child PowerShell process executed Get-Location successfully in the expected repository root.

    Minimal reproduction:

    1. Start in a trusted local repository.
    2. Run:
      codex exec "In the current working directory, create a small test file under .codex-temp, read it back, and do not modify anything else."
      
    3. Codex first attempted apply_patch, which failed to write the file.
    4. It then attempted to create the directory / retry via shell execution.
    5. Every subsequent exec attempt failed with:
      exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
      
    6. Additional apply_patch retries also failed to write the file.

    Representative output:

    ERROR codex_core::tools::router: error=exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
    
    Failed to write file <repo>\.codex-temp\codex-156-write-test.txt
    patch: failed
    

    Important detail:

    • The workspace root / cwd was correct before the failure.
    • The failure appeared when transitioning into workspace write / helper refresh behavior.
    • No project source files were modified.
    • The same class of failure had previously been observed on 0.155.1 in the same Windows environment, so 0.156.0 still reproduces it here.

    Expected:

    • workspace-write should allow creation of a small file inside the active trusted workspace, or at minimum return an actionable sandbox error.
    • A successful read-only command should not be followed by repeated helper setup refresh failures as soon as a write path is exercised.

    This reproduction may help confirm that the issue is still present in 0.156.0 and is not limited to older 0.153.x builds. I can provide additional sanitized test results if useful.

  9. PPRRLLRR commented on Sep 22, 2026

    @PPRRLLRR

    Follow-up reproduction on codex-cli 0.156.0 confirms the failure is NOT specific to a nested .codex-temp path.

    Environment remains:

    • Windows 11 x64
    • codex-cli 0.156.0
    • PowerShell 7
    • sandbox: workspace-write
    • approval: never
    • trusted local Git repository
    • working directory correctly resolved to the repository root

    Minimal root-write test:

    codex exec "Create a file named codex-156-root-test.txt in the current working directory with exactly: OK. Then read it back. Avoid apply_patch if possible. Do not modify anything else."
    

    Observed behavior:

    1. The first shell execution failed before running:
      exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
      
    2. A second shell retry failed with the same error.
    3. Codex then fell back to apply_patch.
    4. apply_patch also failed twice:
      Failed to write file <repo>\codex-156-root-test.txt
      patch: failed
      
    5. No file was created and no other project files were modified.

    This narrows the reproduction:

    • The issue is not limited to .codex-temp.
    • A simple write directly at the workspace root fails.
    • Both exec_command and apply_patch are affected.
    • The cwd/workdir is correct, so this does not appear to be a working-directory routing problem.

    This strengthens the indication that the failure is in the Windows sandbox helper/setup-refresh path for workspace-write on 0.156.0.

  10. PPRRLLRR commented on Sep 22, 2026

    @PPRRLLRR

    Additional control test on codex-cli 0.156.0: read-only / process execution still succeeds immediately after the failed write tests.

    Command:

    codex exec "Run only Get-Location in PowerShell and report the path. Do not write or modify any file."
    

    Result:

    • Codex header reported the correct workdir.
    • Child PowerShell launched successfully.
    • Get-Location succeeded in ~612 ms.
    • Reported path matched the repository root exactly.

    This means the prior failed workspace writes do not leave the sandbox globally unusable. Instead, the failure appears specifically tied to write-capable execution / sandbox refresh behavior:

    • read-only exec works
    • workspace-root write via exec_command fails with helper_unknown_error: setup refresh had errors
    • apply_patch write also fails

    That distinction may be useful when isolating the refresh/ACL path in 0.156.0.

  11. 3 remaining items

  12. PPRRLLRR commented on Sep 23, 2026

    @PPRRLLRR

    Important refinement from another codex-cli 0.156.0 control test: even a non-writing command that merely references $env:TEMP can trigger the same setup-refresh failure before process launch.

    Command intent:

    • run only Write-Output $env:TEMP
    • do not write or modify any file

    Observed:

    • Two consecutive attempts failed before PowerShell launched with:
      exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
      
    • No file operations were requested or performed.

    This falsifies my earlier working hypothesis that the trigger is simply “write-capable commands”.

    Current pattern is subtler:

    • Get-Location: PASS
    • reading README.md: PASS
    • git status --short: PASS
    • referencing $env:TEMP via Write-Output: FAIL before process launch
    • write attempts to workspace/TEMP: FAIL before process launch or via apply_patch

    This suggests the failure may be tied to sandbox setup/refresh involving TEMP-related writable roots or environment-dependent path resolution, not purely to whether the command itself writes.

  13. PPRRLLRR commented on Sep 23, 2026

    @PPRRLLRR

    Further refinement on codex-cli 0.156.0: a trivial read-only Write-Output command with no TEMP reference also fails before PowerShell launch.

    Command intent:

    • run only Write-Output 'PKM-CODEX-156-TEST'
    • no file writes or modifications

    Observed:

    • two consecutive attempts failed before process start with:
      exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
      

    This falsifies the narrower TEMP-variable hypothesis as well.

    At this point the failure is intermittent/non-deterministic across otherwise harmless PowerShell invocations:

    • Get-Location: PASS in one session
    • Get-Content README.md: PASS
    • git status --short: PASS
    • Write-Output $env:TEMP: FAIL
    • Write-Output 'PKM-CODEX-156-TEST': FAIL
    • write attempts: FAIL

    The common denominator is now more consistent with an unstable Windows sandbox helper/setup-refresh state rather than command semantics. This may explain why some fresh execs work while subsequent/new sessions fail before child process creation.

  14. PPRRLLRR commented on Sep 23, 2026

    @PPRRLLRR

    Strong non-determinism reproduction on codex-cli 0.156.0.

    The exact same command was executed 5 times from the same repository/workdir, with 5 seconds between attempts:

    codex exec "Run Get-Location in PowerShell and report only the resulting path."
    

    Results:

    • Attempt 1: PASS — child pwsh launched, Get-Location succeeded in ~579 ms.
    • Attempt 2: PASS — ~608 ms.
    • Attempt 3: PASS — ~558 ms.
    • Attempt 4: PASS — ~559 ms.
    • Attempt 5: FAIL — process creation rejected twice with:
      exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: helper_unknown_error: setup refresh had errors\")" }
      

    All 5 invocations used the same:

    • Windows 11 x64 host
    • codex-cli 0.156.0
    • repository/workdir
    • sandbox mode: workspace-write
    • approval: never
    • command semantics

    This is the cleanest evidence so far that the Windows sandbox helper/setup-refresh failure is intermittent and not determined by the requested command itself.

    One additional concern: on the failed 5th attempt, Codex still printed the repository path in its final answer even though both tool executions failed, so the final response can appear successful despite the underlying exec failure.

  15. PPRRLLRR commented on Sep 23, 2026

    @PPRRLLRR

    A/B control result on the same Windows 11 machine and same repository strongly favors codex-cli 0.154.0 over 0.156.0.

    After downgrading:

    codex --version
    codex-cli 0.154.0
    

    The exact same command used for the 0.156.0 intermittent reproduction was then executed 5 times, with 5 seconds between attempts:

    codex exec "Run Get-Location in PowerShell and report only the resulting path."
    

    Results on 0.154.0:

    • Attempt 1: PASS — ~541 ms
    • Attempt 2: PASS — ~549 ms
    • Attempt 3: PASS — ~640 ms
    • Attempt 4: PASS — ~612 ms
    • Attempt 5: PASS — ~418 ms

    So:

    • 0.156.0: 4 PASS / 1 FAIL on the same 5-run test, with the failure showing helper_unknown_error: setup refresh had errors
    • 0.154.0: 5 PASS / 5 on the same host, repo, workdir, sandbox mode, approval mode, and command

    This A/B result strengthens the regression signal in 0.156.0 (or in code introduced after 0.154.0) rather than pointing to the host environment, repo, PowerShell, or wrapper configuration.

  16. Freemlen commented on Sep 23, 2026

    @Freemlen

    @PPRRLLRR Thanks — this 0.156.0 vs 0.154.0 A/B is very useful.

    One thing could help connect this to the deeper Windows sandbox investigation in #43373: on the failed 0.156.0 run, could you check %USERPROFILE%\.codex\.sandbox\sandbox.<date>.log and post the exact first underlying setup-refresh error / failing path immediately before setup refresh had errors?

    In our case the same top-level error came from several different underlying paths, including:

    • a Temp write-ACL failure,
    • AppData read-ACL traversal,
    • and a separate deny_read_acl_state.json race.

    So the exact lower-level log line would tell us whether your 0.156 regression is the same failure mode or a new one.

    If it points at the normal user Temp path, the process-scoped TEMP/TMP=C:\CodexTemp workaround from #43373 would also be a useful A/B test.

  17. PPRRLLRR commented on Sep 24, 2026

    @PPRRLLRR

    @Freemlen Thanks. I checked the sandbox log from the failed codex-cli 0.156.0 runs. The underlying setup-refresh failure is reproducible and is not on the repository path or TEMP path.

    The first underlying error immediately before setup refresh had errors is:

    runtime read/execute validation failed: validate runtime read/execute access on C:\Users\<USER>\AppData\Local\OpenAI\Codex\runtimes\cua_node\e4d75eceaa042f20\bin\node_modules\@oai\sky\dist\js-dependency-cache\shared-v1\applied-bk-agent-openai-js\pnpm-store\v11\links\@rollup\plugin-typescript\12.1.2\a522fe9000e9cb07598cb89328c5f87afda445b7562f1579b3d4e1f77197a142: CreateFileW failed
    

    The sequence in the log is:

    read-acl-only mode: applying read ACLs
    read ACL run completed
    runtime read/execute validation failed: ... CreateFileW failed ...
    setup refresh: processed 2 write roots (read roots delegated); errors=[...]
    setup refresh completed with errors: [...]
    setup error: setup refresh had errors
    

    This same underlying runtime path/error repeats across multiple failed commands, including:

    Write-Output $env:TEMP
    Write-Output 'PKM-CODEX-156-TEST'
    Get-Location | Select-Object -ExpandProperty Path

    So the earlier observation that even trivial/read-only commands can fail before PowerShell starts is consistent with sandbox setup failing while validating the bundled cua_node runtime, specifically inside the @oai/sky dependency cache.

    For the failed Get-Location run, the requested command is logged, then setup refresh starts, the read ACL run completes, runtime validation hits the same CreateFileW failed path, and setup exits with status 1 before the child command runs.

    This is from the same Windows 11 machine used for the previously reported A/B:

    • codex-cli 0.156.0: 4/5 PASS, 1/5 FAIL for identical Get-Location runs
    • codex-cli 0.154.0 after downgrade: 5/5 PASS

    I have not changed ACLs, ownership, TEMP, or the runtime directory while collecting this evidence.

  18. Freemlen commented on Sep 24, 2026

    @Freemlen

    @PPRRLLRR Thanks — this lower-level log line is very useful.

    This now looks much closer to the separate Windows long-path/runtime-validation cluster in #46255 and #46388 than to the Temp ACL failure in #43373.

    Those reports show the same general shape:

    cua_node -> @oai/sky -> js-dependency-cache -> pnpm-store -> @rollup/plugin-typescript -> <hash>

    followed by:

    runtime read/execute validation failed -> CreateFileW failed -> setup refresh had errors

    On several affected machines the full path was ~283–293 characters, ordinary Win32 access failed, while the same existing directory was reachable using an extended-length \\?\ path.

    If you are comfortable doing one read-only check, could you report:

    • the exact character length of the failing path;
    • whether the ordinary path resolves;
    • whether the same path resolves with the \\?\ prefix.

    No ACL, ownership, registry, TEMP, or runtime-cache changes are needed for this check.

    If that matches, your 0.156.0 reproduction would be another strong independent confirmation of #46255 / #46388 rather than the Temp/AppData failure mode from #43373.

  19. PPRRLLRR commented on Sep 25, 2026

    @PPRRLLRR

    @Freemlen I ran the requested read-only check against the exact historical failing path from the 0.156.0 sandbox log.

    Results:

    Length   : 282
    Normal   : False
    Extended : False
    

    The path tested was the same historical cua_node -> @oai/sky -> js-dependency-cache -> pnpm-store -> @rollup/plugin-typescript -> <hash> path from the failed run.

    So the path length is in the same range you mentioned for #46255 / #46388, but on the machine as it exists now, neither the ordinary path nor the \\?\ extended-length form resolves.

    That means I cannot confirm the exact same long-path behavior seen in those reports, because the original failing runtime object is no longer present at that path now.

    What I can confirm is:

    • the historical failing path length was 282 characters;
    • the sandbox log showed runtime read/execute validation failed -> CreateFileW failed -> setup refresh had errors;
    • and the currently installed runtime no longer exposes that exact object via either normal or extended-length lookup.

    I did not change ACLs, ownership, registry, TEMP, or the runtime cache while performing this check.

  20. GDIcz commented on Sep 26, 2026

    @GDIcz

    Confirming this in Codex CLI on Windows.

    I reproduced the failure after re-authenticating with codex --login. Codex CLI is launched directly from both PowerShell and cmd.exe; the result is the same on two separate Windows PCs.

    A minimal request to run Get-Location returns:

    Command could not run: helper_unknown_error: setup refresh had error

    The command does not start, so this blocks local repository inspection and all tool-driven work.

    The issue began shortly after midnight in my local timezone (Europe/Prague) on 2026-09-26. During the same night, I updated Codex CLI; the failures started after that update and have persisted since.

    I cannot prove that the update caused the issue, but the timing is consistent across two separate Windows PCs.

  21. PPRRLLRR commented on Sep 26, 2026

    @PPRRLLRR

    @GDIcz We have reproduced this same Windows sandbox/setup-refresh failure on two consecutive Codex CLI versions on our Windows 11 system:

    • codex-cli 0.155.1: affected
    • codex-cli 0.156.0: affected
    • codex-cli 0.154.0: our current stable fallback

    On 0.156.0 we also ran a controlled repeated test using the exact same Get-Location command: 4/5 runs passed and 1/5 failed with helper_unknown_error: setup refresh had errors. After downgrading to 0.154.0, the same 5-run test passed 5/5.

    Because we had already seen the failure on 0.155.1 and then again on 0.156.0, we rolled back to 0.154.0 and have kept that version pinned for our Windows workflow.

    If you can report the exact Codex CLI version you updated to before the failures started on 2026-09-26, that would be a useful additional data point to determine whether the regression is still present in a version newer than 0.156.0.

  22. agarciacalvo commented on Sep 29, 2026

    @agarciacalvo

    I've had the same problem and I solved it thanks to this comment:

    #44696 (comment)

    I deleted the folders at %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node except for the most recent one.

  23. botong88 commented on Oct 7, 2026

    @botong88

    Additional reproduction: Computer Use runtime locks break sandbox ACL refresh

    Environment

    • Codex Desktop: 26.1002.51308 (prod, up to date)
    • AppX package: OpenAI.Codex_26.1002.6548.0_x64
    • Windows 10 22H2, build 19045, x64
    • Sandbox mode: workspace-write / elevated Windows sandbox
    • Runtime: %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\2c9e75c4e9c71beb

    Symptom

    After using the desktop Computer Use/browser tool, all later exec_command calls fail before PowerShell starts:

    Failed to create unified exec process:
    helper_unknown_error: setup refresh had errors
    

    The sandbox log identifies a Windows sharing violation, not a workspace ownership problem:

    runtime read/execute validation failed: validate runtime read/execute access on
    %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\2c9e75c4e9c71beb\bin\node_repl.exe:
    open ACL target for root-only update: The process cannot access the file because it is being used by another process. (os error 32)
    

    At other times the locked target is:

    ...\swift\x64\VCRUNTIME140_1.dll
    

    Process evidence

    At failure time there were 8 concurrent node_repl.exe processes from the same CUA runtime plus one codex-computer-use-swift.exe. The Swift helper was a direct child of the main ChatGPT.exe process.

    Terminating only the verified CUA runtime processes temporarily allowed one ordinary sandbox command to start. The desktop process immediately respawned codex-computer-use-swift.exe; subsequent sandbox refreshes failed again on its loaded DLL. Reopening the affected chat created multiple new node_repl.exe processes and reproduced the lock.

    Controlled tests

    1. Terminated only node_repl.exe instances whose executable path matched the CUA runtime: temporary recovery.
    2. Terminated the matching Swift helper: temporary recovery.
    3. Fully closed Codex, waited 8 seconds, removed remaining CUA helpers, and relaunched the latest AppX package: failure reproduced after startup.
    4. Confirmed app updater status is up_to_date.
    5. No project ACLs, .git ownership, security settings, plugin files, or runtime files were modified.

    A fresh Computer Use connection then exited with:

    node_repl kernel exited unexpectedly
    windows sandbox failed: helper_unknown_error: setup refresh had errors
    

    Likely race

    The desktop app starts or respawns CUA executables before a later elevated sandbox ACL refresh validates/updates those same runtime files. Windows refuses the ACL operation while the executable or DLL is loaded. The helper treats this sharing violation as fatal, which disables both Computer Use and unrelated shell/file tools.

    Expected behavior

    • Sandbox setup should not attempt a file operation incompatible with running trusted CUA binaries, or it should retry after stopping/coordinating those helpers.
    • A CUA helper lock should not disable unrelated exec_command and file operations.
    • CUA transports should recover cleanly after their helper process is reset.
  24. AOphagen commented on Oct 8, 2026

    @AOphagen

    I can reproduce this on the current Windows release as well. Details below; all identifying project, company, and personal names have been removed.

    Environment

    • OS: Windows 11
    • Desktop app version: 26.1002.7124.0
    • Installation source: Microsoft Store via winget
    • Bundled CLI version: 0.162.0-alpha.2
    • Sandbox backend: elevated
    • Workspace: local Git repository on the system drive

    Problem

    Every local command in the desktop app fails before PowerShell starts:

    Failed to create unified exec process:
    helper_unknown_error: setup refresh had errors

    Even the minimal read-only command fails:

    Get-Location

    Git and PowerShell work normally outside the desktop app.

    Doctor result

    The bundled CLI doctor reports:

    • overallStatus: fail
    • sandbox.helpers: fail
    • sandbox backend: elevated
    • sandbox provisioning: failed
    • error code: helper_unknown_error
    • filesystem sandbox: restricted
    • denied-read rules: 0
    • denied-read restrictions: false

    The reported remediation is:

    repair or reinstall the CLI from an approved distribution

    Troubleshooting already performed

    • Fully quit and restarted the app
    • Rebooted Windows
    • Used Windows App Repair
    • Uninstalled and reinstalled the desktop app
    • Reinstalled from the Microsoft Store using the exact package identifier and source
    • Verified that the expected Microsoft Store package is installed
    • Checked ownership of the user configuration directory, project-local configuration directory, and repository metadata directory
    • All checked paths are owned by the normal interactive Windows user
    • No specific ACL error was found in the available sandbox log output
    • External PowerShell and Git continue to work normally

    Expected behavior

    A basic local command such as Get-Location should start successfully in a workspace-write task.

    Actual behavior

    The command runner fails during sandbox provisioning before the requested process starts.

    Regression information

    The issue started after a recent desktop app and bundled CLI update. Reinstalling the current Microsoft Store package does not resolve it.

    Please advise whether this is a known regression in the elevated Windows sandbox and whether a supported workaround or fixed build is available.

  25. AOphagen commented on Oct 8, 2026

    @AOphagen

    #44696 (comment)

    Update: I also tested the standalone Codex CLI as a workaround.

    • Installed the stable CLI package from the WinGet source, separately from the Microsoft Store desktop app.

    • Added its executable to the user PATH and verified that codex --version works in new PowerShell sessions.

    • The CLI successfully reads the user-level Codex configuration.

    • Starting codex from the repository, both normally and with --no-daemon, fails with the same error:

      Failed to create unified exec process:
      helper_unknown_error: setup refresh had errors

    This confirms that the failure also affects the standalone CLI on this Windows installation, not only the desktop app. External PowerShell and Git continue to work normally.

  26. aprillin99 commented on Oct 9, 2026

    @aprillin99

    I am experiencing the same Codex Windows sandbox initialization failure.

    Environment

    • Windows 11 Home, build 22631
    • Codex Desktop: 26.1002.52244
    • Using DeepSeek Flash through CC Switch
    • Normal Windows PowerShell works
    • Reproduces in a new empty workspace

    Error
    Failed to create unified exec process: helper_unknown_error: setup refresh had errors

    Even Write-Output "SHELL_OK" cannot execute.

    Troubleshooting performed

    • Restarted Windows and Codex
    • Reinstalled the Codex desktop application
    • Reinstalled Codex workspace dependencies
    • Tested an empty workspace
    • Verified that the model can respond normally
    • Captured the failures using Microsoft Process Monitor

    Confirmed Process Monitor findings

    1. codex-windows-sandbox-setup.exe attempts to access node_repl.exe and VCRUNTIME140_1.dll, resulting in SHARING VIOLATION (Windows error 32).
    2. The setup process requests Write DAC on a user-profile directory named PCManger, resulting in ACCESS DENIED.
    3. The setup helper runs under my normal Windows account at Medium integrity.
    4. The Codex sandbox service runs under LocalSystem.
    5. The PCManger directory is owned by BUILTIN\Administrators, and ACL inheritance is disabled.

    Reinstalling Codex did not resolve the failure. Model responses work, but all command execution and file operations that require the sandbox remain blocked.

    Request

    Could you advise on a supported recovery procedure for Windows sandbox ACL refresh and runtime file-sharing conflicts?

    I would prefer a fix that does not require resetting my entire Windows user-profile permissions, deleting Codex user data, or disabling sandbox security.

    Image Image Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugsandboxtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions