Skip to content

Windows app sandbox helpers are packaged under resources but launcher searches app/PATH #30732

Open

Description

@zim90live

What happened?

On the Windows Codex app, sandboxed commands started failing before the requested command ran. The initial failure was that the sandbox setup helper could not be launched:

windows sandbox: orchestrator_helper_launch_failed: setup refresh failed to launch helper: helper=codex-windows-sandbox-setup.exe, cwd=C:\Program Files\WindowsApps\OpenAI.Codex_26.623.9142.0_x64__2p2nqsd0c76g0\app, log=%USERPROFILE%\.codex\.sandbox\sandbox.2026-06-30.log, error=program not found

The helper binary exists, but under app\resources rather than directly under app or a directory on PATH:

C:\Program Files\WindowsApps\OpenAI.Codex_26.623.9142.0_x64__2p2nqsd0c76g0\app\resources\codex-windows-sandbox-setup.exe

After copying codex-windows-sandbox-setup.exe to the active Codex user bin directory on PATH, setup completed, but the next sandbox run failed with:

windows sandbox: CreateProcessWithLogonW failed: 2

The sandbox log then showed the command runner lookup falling back to the legacy name:

helper copy failed for command-runner: helper not found next to current executable or under codex-resources: %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe; falling back to legacy path codex-command-runner.exe

codex-command-runner.exe also exists under app\resources, but was not discoverable from the active user bin/PATH location.

Expected behavior

Sandboxed commands should run without manually copying helper binaries. The launcher should either:

  • look in app\resources for codex-windows-sandbox-setup.exe and codex-command-runner.exe, or
  • package/copy those helpers next to the executable/path location where the launcher expects them.

Actual behavior

Any sandboxed command failed before execution because codex-windows-sandbox-setup.exe was not found. After manually making that helper discoverable, sandbox setup completed but command execution failed because codex-command-runner.exe was not found.

Workaround

Copying both helper binaries from app\resources into the active Codex user bin directory made sandboxed commands work again:

Copy-Item "<Codex WindowsApps package>\app\resources\codex-windows-sandbox-setup.exe" "<active %LOCALAPPDATA%\OpenAI\Codex\bin\hash>\codex-windows-sandbox-setup.exe" -Force
Copy-Item "<Codex WindowsApps package>\app\resources\codex-command-runner.exe" "<active %LOCALAPPDATA%\OpenAI\Codex\bin\hash>\codex-command-runner.exe" -Force

After this, simple sandboxed commands such as Get-Location and git status --short ran successfully.

Environment

  • OS: Windows native Codex app
  • Codex app package observed: OpenAI.Codex_26.623.9142.0_x64__2p2nqsd0c76g0
  • Sandbox mode: workspace-write, Windows native sandbox
  • Date observed: 2026-06-30

Notes

This looks like a packaging or helper lookup path regression: the required helper binaries are present in the app package, but the runtime lookup path does not include their packaged location.

Activity

  1. added
    bug
    app
    windows-os
    sandbox
    on Jun 30, 2026
  2. github-actions commented on Jun 30, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. arteagacz commented on Jun 30, 2026

    @arteagacz

    Same here. And restarting Codex did not fix it. This happens in all modes (full access, custom, any...).

    What I tested after the restart:
    PowerShell command:
    Write-Output 'ok'; Get-Location
    from C:\somefolder\somefolder2

    cmd.exe command:
    echo ok && cd
    from C:\somefolder\somefolder2

    Both failed before the shell started, with the same Codex-side error:
    Failed to create unified exec process: helper_unknown_error: setup refresh had errors

  4. arteagacz commented on Jun 30, 2026

    @arteagacz

    Same issue with CLI

  5. starriet9 commented on Jul 6, 2026

    @starriet9

    I hit the same helper-discovery class of failure with the standalone Windows CLI install, and I think there is one more path shape involved: the standalone installer exposes codex.exe through a visible bin directory that is a Windows junction to the actual release bin directory.

    Observed layout, with user-specific parts omitted:

    %LOCALAPPDATA%\Programs\OpenAI\Codex\bin
      -> junction to %USERPROFILE%\.codex\packages\standalone\current\bin
    
    %USERPROFILE%\.codex\packages\standalone\releases\0.142.5-x86_64-pc-windows-msvc\bin\codex.exe
    %USERPROFILE%\.codex\packages\standalone\releases\0.142.5-x86_64-pc-windows-msvc\codex-resources\codex-windows-sandbox-setup.exe
    %USERPROFILE%\.codex\packages\standalone\releases\0.142.5-x86_64-pc-windows-msvc\codex-resources\codex-command-runner.exe
    

    In this layout the helpers are present, but lookup from the visible current_exe() path checks around:

    %LOCALAPPDATA%\Programs\OpenAI\Codex\bin\...
    %LOCALAPPDATA%\Programs\OpenAI\Codex\codex-resources\...
    

    That misses the actual release codex-resources directory. If the executable path is canonicalized first, the lookup resolves through the junction to the real release bin, and ../codex-resources finds both helper binaries.

    I prepared a candidate fix here:

    https://github.com/starriet9/codex/tree/fix/windows-sandbox-helper-junction

    Commit:

    b6cee222c Fix Windows sandbox helper lookup through junctions
    

    The patch keeps the existing literal lookup first, then falls back to the same lookup using dunce::canonicalize(exe) when the helper was not found. That should preserve existing layouts while fixing the standalone junction layout.

    Local validation:

    cargo fmt -p codex-windows-sandbox --check
    git diff --check
    cargo test -p codex-windows-sandbox helper_source_lookup
    

    I also verified the path behavior with an isolated Windows junction probe: literal lookup from the visible junction path missed both helpers, while the canonicalized fallback found both helpers under the release codex-resources directory.

    I am not opening a PR yet because docs/contributing.md says external PRs are by invitation only. If this direction matches the intended packaging/runtime behavior, I can open a focused PR from the branch above.

  6. mon-jai commented on Jul 14, 2026

    @mon-jai

    The following command fixes my install.ps1 installation.

    TL;DR: This command identifies the most recent release directory (to which ~/.codex/packages/standalone/current is junction-linked) and creates hard links of <release>/codex-resources/{codex-command-runner.exe,codex-windows-sandbox-setup.exe} to the <release>/bin/ directory.

    $standalonePath = Join-Path $env:USERPROFILE '.codex\packages\standalone'
    $latestRelease = Get-ChildItem (Join-Path $standalonePath 'releases') -Directory | 
        Where-Object Name -Match '^\d+\.\d+\.\d+-' | 
        Sort-Object { [version](($_.Name -split '-')[0]) } -Descending | 
        Select-Object -First 1
    
    $resourceExecutables = 'codex-command-runner.exe', 'codex-windows-sandbox-setup.exe'
    $resourceExecutables | ForEach-Object {
        $sourcePath = Join-Path $latestRelease.FullName "codex-resources\$_"
        $linkPath = Join-Path $latestRelease.FullName "bin\$_"
        
        if (Test-Path $linkPath) { Remove-Item $linkPath -Force }
        New-Item -ItemType HardLink -Path $linkPath -Target $sourcePath | Out-Null
    }

    One liner:

    $standalonePath=Join-Path $env:USERPROFILE '.codex\packages\standalone'; $latestRelease=Get-ChildItem (Join-Path $standalonePath 'releases') -Directory | Where-Object Name -Match '^\d+\.\d+\.\d+-' | Sort-Object {[version](($_.Name -split '-')[0])} -Descending | Select-Object -First 1; $resourceExecutables='codex-command-runner.exe','codex-windows-sandbox-setup.exe'; $resourceExecutables | ForEach-Object {$sourcePath=Join-Path $latestRelease.FullName "codex-resources\$_"; $linkPath=Join-Path $latestRelease.FullName "bin\$_"; if(Test-Path $linkPath){Remove-Item $linkPath -Force}; New-Item -ItemType HardLink -Path $linkPath -Target $sourcePath | Out-Null}
  7. Loongtech commented on Jul 30, 2026

    @Loongtech

    I can reproduce the same helper-discovery failure with the Microsoft Store Windows app, and it is intermittent within the same installed version.

    Environment:

    • Codex Windows app package: OpenAI.Codex_26.721.11231.0_x64__2p2nqsd0c76g0
    • Windows native sandbox, workspace-write mode

    Observed failure:

    windows sandbox: orchestrator_helper_launch_failed:
    setup refresh failed to launch helper:
    helper=codex-windows-sandbox-setup.exe
    ...
    error=program not found
    

    The package contains both helpers at:

    <package>\app\resources\codex-windows-sandbox-setup.exe
    <package>\app\resources\codex-command-runner.exe
    

    The most useful contrast is in the sandbox log on the same day:

    • Successful refresh: spawning C:\Program Files\WindowsApps\OpenAI.Codex_26.721.11231.0_x64__2p2nqsd0c76g0\app\resources\codex-windows-sandbox-setup.exe, followed by setup binary completed.
    • Failed refresh: spawning codex-windows-sandbox-setup.exe, followed by program not found.

    So the executable is present and can be launched when the resolver uses its absolute packaged resource path; the intermittent failure appears to fall back to a bare filename that is not on PATH. I counted 131 instances of this specific launch failure in my sandbox logs from July 15–30 (24 in the latest seven days). I found no matching Microsoft Defender quarantine/block event.

    This appears to be the same root cause as this issue, with the newer Store package and a particularly clear absolute-path vs bare-name comparison.

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

    appbugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions