Codex Desktop for Windows: sandbox setup refresh fails when the WindowsApps helper cannot launch (os error 5)

Authorship disclosure: This report was written by Codex, an AI coding agent, from a user-authorized and de-identified diagnostic session. It is an
independent technical report, not an official OpenAI security advisory.

Summary

On 6 August 2026, a Codex Desktop task on Windows stopped being able to run
ordinary sandboxed commands or apply patches. The problem was discovered after
a Python 3.10.20 validation workflow, when Codex attempted to update required
project documentation. Both a trivial read-only shell probe and apply_patch
failed before the requested operation began.

The original failure occurred in the Windows sandbox setup-refresh bootstrap.
The packaged Codex CLI attempted to launch
codex-windows-sandbox-setup.exe from its WindowsApps package resources.
Windows returned Access denied with os error 5.

A signed, byte-identical copy of the same helper in Codex’s per-user application
bundle could be launched successfully. This points to a functional packaging
or execution-context compatibility defect rather than corruption of the helper,
Python, Git, or repository code.

I have not found evidence that this is a security vulnerability. The observed
behavior failed closed: the requested command never started, no unrestricted
fallback occurred, and no sandbox escape, privilege escalation, or unauthorized
access was demonstrated.

Sanitized environment

  • Windows 11 x64, build family 26200
  • Codex Desktop Store package version 26.730.8199.0
  • Codex CLI version 0.147.0-alpha.1.2
  • Original CLI location:
    <WindowsApps package>\app\resources\codex.exe
  • Original helper location:
    <WindowsApps package>\app\resources\codex-windows-sandbox-setup.exe
  • Working per-user CLI location:
    %USERPROFILE%\.codex\plugins\.plugin-appserver\codex.exe
  • Working per-user helper location:
    %USERPROFILE%\.codex\plugins\.plugin-appserver\codex-windows-sandbox-setup.exe
  • Managed workspace-write sandbox policy

This report intentionally omits the real user name, computer name, SIDs, PIDs,
repository name, thread identifier, tokens, private logs, and absolute
user-specific paths.

Failure component and stage

The initial inner error was equivalent to:

orchestrator_helper_launch_failed
setup refresh failed to launch helper
Access denied (os error 5)

The failing sequence was:

desktop task
  -> packaged codex.exe
  -> sandbox setup refresh
  -> launch codex-windows-sandbox-setup.exe
  -> Windows returns error 5
  -> requested command or patch never starts

OpenAI Codex source shows that setup refresh constructs a process for this
helper and returns OrchestratorHelperLaunchFailed when process creation fails.
The helper lookup is anchored to the current codex.exe: it checks beside that
executable and then under its package resources directory. A working per-user
copy is not selected merely because it exists elsewhere.

What was checked

  • The Store package reported a healthy installation state.
  • The WindowsApps helper existed and had a valid Authenticode signature.
  • The WindowsApps and per-user helpers had identical SHA-256 digests.
  • The per-user helper started and reached argument validation.
  • A per-user Codex CLI workspace sandbox probe succeeded.
  • No matching Defender, AppLocker, or Code Integrity event was found during the
    failed launch.
  • The required sandbox users and group existed and were enabled.
  • Repository and worktree paths existed and were readable.
  • Terminating an orphaned older command runner did not resolve the failure.

These observations reject the most obvious missing-file, binary-corruption,
Python, Git, repository, and general Windows-sandbox hypotheses. They support a
path-specific or package-execution-context problem. They do not prove exactly
which AppX policy or deployment detail caused Windows to reject that process.

Impact

  • Normal sandboxed shell commands failed before execution.
  • apply_patch could not initially read or update files.
  • Tests, static checks, Git inspection, and documentation synchronization could
    not continue through the normal safety boundary.
  • Previously collected test evidence remained valid, but the delivery workflow
    could not be closed.
  • Explicitly approved out-of-sandbox diagnostics remained possible, but there
    was no automatic fallback to unrestricted execution.

The demonstrated impact was loss of availability, not loss of sandbox
isolation.

Remediation

The desktop package exposes environment-based overrides for the CLI and
code-mode host. The following de-identified values were configured:

CODEX_CLI_PATH=%USERPROFILE%\.codex\plugins\.plugin-appserver\codex.exe
CODEX_CODE_MODE_HOST_PATH=%USERPROFILE%\.codex\plugins\.plugin-appserver\codex-code-mode-host.exe

After fully restarting Codex Desktop:

  • the main CLI process came from the per-user bundle;
  • the code-mode host came from the same bundle;
  • the setup helper was resolved from that bundle;
  • the helper launched successfully; and
  • an independent workspace sandbox probe returned success.

CODEX_CLI_PATH was the decisive change. Changing only the code-mode host did
not fix the problem while the main CLI still ran from WindowsApps.

This is a local workaround, not proof that the Store package has been repaired.
The overrides should be removed after a future package version is verified to
launch its bundled helper normally.

Separate residual ACL issue

After the original helper-launch defect was bypassed, the affected desktop task
revealed a second, separate issue. One explicitly configured external writable
root was owned by an administrator principal. The now-working helper launched,
but its DACL refresh returned SetNamedSecurityInfoW failed: 5.

This residual root-permission problem must not be confused with the original
WindowsApps launch failure. Full recovery of that multi-root task remains a
separate permission decision. Safer options include removing the external root
when it is not needed or using the owning application’s supported ownership and
repair process.

Why this is not currently a demonstrated vulnerability

The evidence supports a functional or compatibility bug because a normal
product function could not run in the packaged execution arrangement.

It is not currently a demonstrated security vulnerability because:

  • the requested command never ran;
  • the sandbox was not bypassed;
  • no privilege escalation occurred;
  • no unauthorized file or network access was observed;
  • no private application state was exposed;
  • no unrestricted fallback occurred; and
  • the later ACL operation concerned an explicitly authorized writable root.

The classification should change if future evidence shows sandbox escape,
automatic unsandboxed execution, privilege escalation, ACL changes outside
authorized roots, or unauthorized data access.

Comparison with related reports

The closest Community report is titled:

Codex Windows sandbox setup refresh fails with os error 740 on codex-windows-sandbox-setup.exe

It involves the same helper and the same pre-command setup-refresh stage, but
Windows returned error 740, meaning elevation was required, rather than error 5.

The official Codex repository records this separate sequence:

  • PR 23764, Remove Windows sandbox resource stamping, merged 20 May 2026;
  • Issue 24050, Windows sandbox setup helper triggers UAC installer detection (os error 740), opened 22 May 2026; and
  • PR 25949, Restore setup helper UAC manifest, merged 3 June 2026.

This proves that the helper bootstrap previously had a real Windows packaging
bug. It does not prove that the error-5 incident has the same mechanism.

Another Community topic is titled:

How do I resolve the codex-windows-sandbox-setup.exe not found for windows error when launching Codex?

That report concerns helper installation or lookup, but the helper in this
incident was present and byte-identical to a working copy.

A third topic, Codex tip: Setting up your windows native sandbox to reduce auto-review requests, discusses restricted sandbox users being unable to
launch executables installed through WindowsApps paths. It is directionally
consistent with this incident, but it concerns a different executable and is a
community suggestion rather than an official root-cause statement.

Targeted Community searches did not find a post matching the complete
combination of the setup helper, WindowsApps, and error 5. Some later searches
were rate-limited, so this comparison is not exhaustive.

Suggested product improvements

  1. Add a Store-package integration test that launches the setup helper from the
    same non-elevated process context used by Codex Desktop.
  2. Materialize or launch the helper from a per-user executable directory when
    WindowsApps execution policy prevents direct launch.
  3. Make codex doctor perform a minimal real setup-refresh launch.
  4. Preserve the structured inner setup error instead of showing only
    setup refresh had errors.
  5. Document CODEX_CLI_PATH and its rollback procedure if it is intended as a
    supported recovery mechanism.

This report should be treated as a normal product bug report. It should move to
a security-reporting channel only if additional evidence demonstrates sandbox
bypass, privilege escalation, access outside authorized roots, or automatic
execution without the configured sandbox.