Windows standalone: sandbox helpers resolved relative to PATH shim, not package release dir (breaks all sandboxed exec)
On a standalone Windows install, every sandboxed codex exec (read-only and workspace-write) fails at the first tool call because the sandbox helper binaries cannot be found.
Symptoms
ERROR codex_core::exec: exec error: windows sandbox: orchestrator_helper_launch_failed:
setup refresh failed to launch helper: helper=codex-windows-sandbox-setup.exe, error=program not found
and, once the setup helper is located, a second failure:
helper copy failed for command-runner: helper not found next to current executable or under
codex-resources: C:\Users\<user>\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe;
falling back to legacy path codex-command-runner.exe
ERROR codex_core::exec: exec error: windows sandbox: CreateProcessWithLogonW failed: 2
Root cause
codex resolves codex-windows-sandbox-setup.exe and codex-command-runner.exe "next to the current executable or under codex-resources" — but the current executable is the PATH shim at AppData\Local\Programs\OpenAI\Codex\bin\codex.exe, whereas the helpers actually ship under the package release dir: ~/.codex/packages/standalone/releases/<version>/codex-resources/. The command-runner then falls back to a bare filename, and because it is launched via CreateProcessWithLogonW for the restricted CodexSandboxOffline user (fresh environment, no inherited PATH), that bare name cannot be found, giving error 2.
Workaround (confirmed)
Copy both helpers from the release codex-resources dir into the shim's bin dir:
copy "~\.codex\packages\standalone\releases\<ver>\codex-resources\codex-windows-sandbox-setup.exe" "~\AppData\Local\Programs\OpenAI\Codex\bin\"
copy "~\.codex\packages\standalone\releases\<ver>\codex-resources\codex-command-runner.exe" "~\AppData\Local\Programs\OpenAI\Codex\bin\"
After copying, a sandboxed workspace-write codex exec completes normally. This must be re-applied after every CLI upgrade, since the new release dir's helpers are not copied to the shim bin.
Environment
Windows 11 (10.0.26200), standalone install, reproduced on both codex-cli 0.144.0 and 0.144.1. Not elevation-related; the elevated desktop instance works only because its helpers happen to be co-located. Suggested fix: resolve helpers relative to the resolved package release dir, which codex doctor already reports, rather than the PATH shim, and/or pass an absolute command-runner path into the CreateProcessWithLogonW launch.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Confirming this still reproduces on codex-cli 0.144.5 (Windows 11 10.0.26200, standalone install). The report cites 0.144.0/0.144.1, so it survives at least through .5.
We hit this independently and arrived at the same root cause before finding this issue. One detail that may help: the failure isolates cleanly to the invocation path, with everything else held constant.
Minimal A/B — same binary, same version, same flags, same cwd
Both are
codex-cli 0.144.5.…\Programs\OpenAI\Codex\binis a junction to…\.codex\packages\standalone\current\bin, so onlybinis visible there — the siblingcodex-resources\never is. The package itself is complete and passes the installer's ownTest-PackageContentsAreCompletecheck (codex-package.json,bin\codex.exe,codex-path\rg.exe,codex-resources\codex-command-runner.exe,codex-resources\codex-windows-sandbox-setup.exeall present).Why this is worse than it looks: it fails silently
codex --versionandcodex login statusboth succeed and exit 0 through the shim.codex execthen reports no error to the caller and simply changes nothing. Any health check that asks--versionreports green while every sandboxed write is broken — this cost us a full debugging session before we thought to test an actual write rather than trust the version probe. Worth considering for severity.Workaround that survives upgrades
The "copy both helpers into the shim's
bin" workaround in the issue body works, but as noted it must be re-applied after every upgrade. Prepending the real package bin to PATH instead does not:currentis itself a junction that the updater re-points to the new release dir, so the fix persists across version bumps and needs no file copying.Agree with the suggested fix — resolve helpers relative to the resolved package release dir (following the junction / using the final path, e.g.
GetFinalPathNameByHandle) rather than the invoked shim path. Junctioning the package root instead of justbinwould also makebin\andcodex-resources\siblings from the visible path.Confirming this on Codex CLI 0.144.3 with a standalone Windows installation.
Environment
0.144.317763Observed behavior
Even simple read-only commands inside the workspace could not start in the elevated sandbox.
The first sandboxed command failed with:
Codex then fell back to requesting permission to execute the command outside the sandbox. With
Approve for meenabled, the auto-reviewer approved those unsandboxed executions.codex doctorreported the standalone installation as consistent:The active executable was:
Both required helpers were present in the standalone package:
So the package itself was complete, but the active executable could not resolve the helpers from the release package directory.
Workaround
I copied both helpers next to the active
codex.exe:After fully restarting Codex, a sandboxed command such as:
completed successfully without:
orchestrator_helper_launch_failedprogram not foundThis confirms the same helper path-resolution problem on Windows 10 LTSC and Codex CLI
0.144.3.The workaround fixes the current installation, but the copied helpers may need to be refreshed after a Codex update unless helper resolution or the standalone installation layout is corrected.
Update: still reproducible on
0.144.6After upgrading the standalone Windows installation from
0.144.3to0.144.6, the installer removed the two helper files previously copied into the active shim directory:The helpers were still present in:
A fresh Codex session again failed with:
Copying both helpers into the active
bindirectory restored sandbox execution:One additional detail: resuming a session in which the sandbox had already failed continued to use auto-approved unsandboxed fallback. After fully exiting Codex and starting a new session, the same command ran without
orchestrator_helper_launch_failedand without auto-review approval.So, on my machine:
0.144.6;0.142.1 install.
codex doctorreported 17 ok / 0 fail whilecodex sandbox -- cmd.exe /d /c exit 0failed before the requested command ran (doctor does not exercise the helper spawn path).Workaround n=4: copying both same-version helpers from codex-resources\ to bin\ restores exit 0 (2026-07-03 x2, 2026-07-18, 2026-07-19). The failure recurs with every new release directory.
See #30829 for a commit-level analysis (bundled_executable_path_for_exe junction fallback). Suggested fix direction: resolve helpers via the install context's resources dir, or canonicalize the visible bin junction before executable-relative lookup — and add an end-to-end Windows standalone test that launches through the visible junction chain (current tests appear to cover only the physical package\bin path).
Confirming this remains reproducible on Codex CLI 0.145.0 using the official standalone Windows installer.
Environment
10.0.262000.145.0install.ps1Additional reproduction evidence
I reproduced the same helper-resolution failure both before and after a genuinely clean official reinstall:
%LOCALAPPDATA%\Programs\OpenAI\Codexinstallation out of the way.%USERPROFILE%\.codexuntouched.The freshly installed PATH launcher still fails:
with:
Invoking the physical release binary directly succeeds:
Result:
The PATH-resolved and physical-release executables resolve to the same SHA-256:
The observed junction chain is:
Only
binis exposed through the PATH installation. The physical siblingcodex-resourcesdirectory is not exposed at the visible launcher root, so sibling-relative helper resolution fails.One further diagnostic concern:
codex doctorreports the installation as healthy with no warnings or failures despite the PATH-native sandbox being unusable. A harmless actual sandbox-launch check incodex doctorwould detect this condition.This currently blocks a read-only orchestration workflow that deliberately fails closed rather than allowing Codex to fall back to an unsandboxed command path.
Additional Windows reproduction (Codex 0.145.0, 2026-07-25):
%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exeis a junction-backed entry point.%USERPROFILE%\.codex\packages\standalone\current\bin\codex.exepassed both validations.current\binfirst on the user PATH is a working workaround.This looks consistent with helper/resource discovery being based on the unresolved launcher path instead of the canonical executable/package directory.
Still reproducing on 0.146.0 (x86_64-pc-windows-msvc, standalone installer, Windows 11).
Two data points that might help narrow this down.
1. It regressed between releases: 0.145.0 shipped the helpers in
bin/, 0.146.0 does notBoth release dirs are on the same machine. Timestamps distinguish what the installer wrote from what I copied in later while working around this:
codex-package.jsonis identical in shape for both, and both carry the helpers undercodex-resources/:So whether a user hits this appears to depend on whether a given build happens to duplicate the helpers into
bin/— the resolution logic itself is unchanged. That may explain why some reports get closed as fixed and then resurface.The symptom timeline lines up exactly with the upgrade. Count of
setup refresh: ... error=program not foundper day in~/.codex/.sandbox/sandbox.<date>.log:Nothing hard-fails, which is what makes it nasty — commands still run, but the elevated sandbox's setup refresh silently never executes.
2. A workaround that survives upgrades
Copying the helpers into
bin/works but has to be redone on every upgrade. Since the setup-helper spawn does resolve by bare name throughPATH, putting the junction path onPATHinstead is upgrade-proof:packages\standalone\currentis a junction that the installer repoints at the new release directory, so thePATHentry keeps resolving after an upgrade with no manual step.Verified by removing
codex-windows-sandbox-setup.exefrombin/entirely and running with only thatPATHentry present:The
program not foundcounter stayed flat and the sandboxed command succeeded.This only covers the setup helper spawn, which happens in the normal user environment. The command-runner is a separate path and already launches via an absolute path out of
~/.codex/.sandbox-bin/:so the empty-environment
CreateProcessWithLogonWproblem described above is unaffected by thePATHentry either way.One caveat for anyone applying this: write it via the registry /
[Environment]::SetEnvironmentVariable, notsetx—setxsilently truncatesPATHat 1024 characters.Confirmed still reproducible on 0.147.0 (Windows 11, standalone install).
A workaround variant that avoids copying helpers and survives upgrades - expose
codex-resourcesat the visible install root via a junction to the active package:Why it works: with the visible launcher
%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe,bundled_executable_path_for_exesees the launcher's parent as...\bin, derivespackage_diras%LOCALAPPDATA%\Programs\OpenAI\Codex, and checkspackage_dir\codex-resources\<helper>. Both helpers resolve through that function -codex-windows-sandbox-setup.exeviafind_setup_exeandcodex-command-runner.exevia the helper copy path - so this single junction covers both lookup paths, independently of PATH (unlike addingcurrent\codex-resourcesto PATH, which only covers the setup helper's bare-name spawn in the normal user environment).Differences from the copy-into-bin workaround:
packages\standalone\current, which the installer re-points to each new release, so nothing needs re-applying.Verified on 0.147.0: sandboxed command ran,
.sandbox-binmaterializedcodex-command-runner-0.147.0.exe,codex doctorreports 17 ok / 1 idle / 0 warn / 0 fail.This is the "expose resources at the visible root" direction from the 2026-07-16 comment (junction the package root), scoped down to just the resources directory - sufficient because both helpers only need
package_dir\codex-resources. On the installer side, the gap isEnsure-Junctionin install.ps1 only creating the visiblebinjunction and never acodex-resourcesone - that is why this fails out of the box on builds that ship helpers undercodex-resources.Still reproducible on native Windows ARM64 with codex-cli 0.147.0 (2026-08-07).
Environment:
aarch64-pc-windows-msvcC:\Program Files\PowerShell\7\pwsh.exeThe standalone package itself is healthy and sandboxing works when launched through my existing workaround shim, which ensures the real package
codex-resourcesdirectory is available.However, invoking the installed AppData launcher directly still reproduces the helper-resolution failure:
Result:
The real package is:
and its sandbox helpers are present under its
codex-resourcesdirectory.By contrast, my existing
codex.cmdshim, which puts the real package resources on the appropriate search path before invoking Codex, succeeds:It also successfully launches the native MSI-installed:
inside the sandbox.
So this appears to confirm that the standalone launcher/helper-location issue described here remains present in 0.147.0 and is architecture-independent; this reproduction is native ARM64.