Repository navigation
Description
Summary
The Windows restricted-token sandbox stores per-home setup state
($CODEX_HOME/.sandbox/setup_marker.json) but manages MACHINE-WIDE
sandbox accounts (CodexSandboxOffline / CodexSandboxOnline). An
elevated sandbox setup run for one CODEX_HOME rotates a machine-wide
secret and records it only in that home's marker, invalidating every
other home's marker. Any subsequent run under a different CODEX_HOME
logs sandbox setup required: sandbox users missing or incompatible with marker version and attempts elevated re-setup — which raises a UAC
consent prompt PER COMMAND for non-interactive exec runs. Two concurrent
codex exec sessions under different homes produce a continuous UAC
prompt storm on the user's desktop, and validity ping-pongs to whichever
home ran elevated setup last.
Reproduction (measured)
- Three homes:
~/.codex,~/.codex-overflow,~/.codex-overflow2,
each authenticated, same Windows user. Markers initially valid. - Run an elevated
codex sandbox cmd /c exit 0with
CODEX_HOME=~/.codex-overflow2(its first-time setup).
→~/.codex-overflow2/.sandbox/setup_marker.jsoncreated. - Start
codex exec ... -s workspace-writeruns under~/.codexand
~/.codex-overflow.
→ both homes logsandbox setup required: sandbox users missing or incompatible with marker versionon every command; each attempt
raises a UAC prompt (observed ~9 s cadence; 30+ prompts in minutes). - Elevated re-setup per home (writing that home's marker with the new
secret) ends its storm; refined measurement an hour later: once every
home's marker holds the CURRENT secret, a marker-version mismatch
self-heals silently and unelevated on the next run (marker rewritten,
no prompt). The storm flavor occurs when a home's marker holds a
ROTATED-AWAY secret: the unelevated refresh exits -1
(ExitStatus(4294967295)) and the run escalates to a UAC consent per
command. - Copying a valid
setup_marker.jsonbyte-identical to a sibling home
does NOT directly revalidate it (sandbox setup requiredstill
logged once), but the next run self-heals it silently — consistent
with per-home fields inside the marker plus a shared secret.
Log evidence (representative lines, ~/.codex-overflow/.sandbox/sandbox.2026-08-24.log):
[... codex.exe] sandbox setup required: sandbox users missing or incompatible with marker version
[...] read-acl-only mode: applying read ACLs
[...] read ACL run completed
[... codex.exe] setup refresh: exited with status ExitStatus(ExitStatus(4294967295))
Healthy sibling in the same minutes:
[...] granting write ACE to C:\dev\wt\<worktree> for sandbox group and capability SID
[...] setup refresh: processed 2 write roots (read roots delegated); errors=[]
[... codex-windows-sandbox-setup.exe] setup binary completed
Impact
- A first-time sandbox setup for a NEW CODEX_HOME (which resets the
shared accounts' secret) instantly breaks every other home on the
machine until each is re-set-up elevated — during which any running
codex execsessions on those homes storm the desktop with UAC
consents. - Headless/automation runs on a stale home escalate to interactive UAC
prompts — a prompt storm on whatever desktop is logged in, and the
runs fail closed (Failed to write file ...) when declined. - Read-only runs still pass on a stale home, so simple health probes
report healthy while builds storm — the failure is invisible until
write time.
Asks
- Store the sandbox secret so multiple CODEX_HOMEs on one machine can
share the accounts (machine-scoped state keyed off the accounts, not
per-home markers), or namespace the sandbox accounts per home. - Never raise interactive elevation from non-interactive
codex exec
runs — fail with a typed error instead. - Document the one-home-at-a-time constraint if it is intended.
Environment
- codex-cli 0.149.0 (npm
@openai/codex), Windows 11 Home 10.0.26200 - Sandbox binaries:
codex-windows-sandbox-setup.exe,
codex-command-runner-0.149.0.exe(vendored) - One Windows user; homes provisioned per Codex-bank pattern; setup
markers version 5. - Related open issue: [Windows] Desktop and npm CLI alternate elevated sandbox marker state, causing repeated setup/UAC prompts #36865
(desktop app vs npm CLI ping-ponging one shared~/.codexmarker).
This report is the multi-CODEX_HOMEform of the same class: three
CLI homes, one Windows user, machine-wide sandbox accounts, per-home
markers. 36865 does not cover that repro.
Addendum 2026-08-25: elevated from-scratch recreate fails (CreateProcessAsUserW: 2)
Measured 2026-08-25 ~10:27 AM on the same machine, attended and
elevated. With one home (.codex-overflow2) reset to from-scratch
state (its setup_marker.json and deny_read_acl_state.json
deleted), an ELEVATED codex sandbox windows setup run from an
administrator PowerShell fails immediately:
windows sandbox failed: CreateProcessAsUserW failed: 2 (The system
cannot find the file specified.) | cwd=C:\dev\wt\worktree-reaper |
cmd=windows setup | env_u16_len=4506 | si_flags=256 |
creation_flags=525312
The home's own sandbox log records only START: windows setup and
nothing further. Read-only probes on the same home still pass
(cmd /c exit 0 spawns fine), so the failure is specific to the
setup path's spawn-as-sandbox-user. Practical consequence: on a
machine in this state there is NO working recovery path for a broken
home short of reinstalling the codex runtime — per-home state deletion
plus elevated re-setup, the documented recovery, cannot complete.
This compounds the marker-rotation defect above: any home that loses
the current machine-wide secret cannot be re-qualified.
Activity
bielxdh3 commentedon Sep 19, 2026
Independent multi-
CODEX_HOMEorchestration use case that may be useful for impact/testing.I am running a local configured-actor orchestrator with two separately authenticated Codex profiles under different
CODEX_HOMEroots (primary orchestrator + secondary App Server actor). On Codex 0.154.0, a real read-only App Server Architect turn under the secondary profile completes successfully.That is a useful negative control, but importantly it does not prove the multi-home write path is healthy. It reinforces the warning in this issue that read-only probes can look fine while the failure only appears when a home needs the Windows write sandbox.
This matters directly for failover orchestration: if an external Executor is unavailable, I want an explicitly user-authorized Codex profile to be eligible for the Executor role. That requires
workspace-writeunder a secondCODEX_HOME. I am deliberately not treating the successful read-only turn as a green light for that.Current design is fail-closed: no automatic substitution, and only profiles explicitly allowed for a fallback role can be selected.
If there is a candidate fix/branch for the machine-wide secret / per-home marker interaction, I can test it against:
CODEX_HOMEprofiles;No credentials or auth files need to be shared for the repro.
JeffLepp commentedon Sep 27, 2026
Source-level follow-up: the cross-home credential mismatch still appears present in
rust-v0.157.1andmainat819cdb7.setup.rsuses the fixedCodexSandboxOffline/CodexSandboxOnlineaccount names; credential paths remain perCODEX_HOME.provision_sandbox_usersgenerates fresh passwords and resets existing accounts, whilewrite_secretspersists them only under the requesting home.I also checked #47695. It improves recovery when stored passwords are rejected, but does not appear to reconcile credential records across sibling homes. Serializing provisioning alone would not keep another home's stored credentials current after a password rotation.
A regression check worth covering is: provision home A, provision home B, then alternate sandbox commands between A and B; both homes should remain usable without repeated password rotation.
This is source analysis, not a fresh runtime reproduction.
P12 PR 3a: dry-run fixes (Claude trust, Codex sandbox mode, search fi…
bielxdh3 commentedon Oct 1, 2026
@JeffLepp I now have a fresh runtime reproduction that matches your source analysis and appears to confirm that #47695 did not fix the multi-
CODEX_HOMEcase.Environment:
0.157.0CODEX_HOMEprofiles on the same Windows userworkspace-writeExecutorOn the secondary home, the sandbox log shows a successful refresh first:
The command runner is then copied/reused under that secondary
CODEX_HOME, but the very next trivial probes still report:The same state is visible through App Server:
elevatedupdateRequiredcommand/execprobes for bothcmd.exeand Node fail before any process result, with JSON-RPC-32603and a Windows-sandbox setup errorsandboxPolicy, so this is not caused by the caller's workspace-write policy overrideI also tried the supported recovery command for the secondary home from an elevated PowerShell:
It exits with:
I checked current source again. The default branch still uses the fixed machine-wide account names
CodexSandboxOffline/CodexSandboxOnline, whilesandbox_users.jsonremains per-CODEX_HOME; provisioning generates fresh passwords and callsNetUserSetInfofor existing accounts before persisting those secrets only into the requesting home. That still looks structurally capable of invalidating sibling homes exactly as described in this issue.So from my repro, #47695's rejected-credential repair is useful, but it does not reconcile credentials across sibling
CODEX_HOMEroots.I can test a candidate fix against:
workspace-writeApp Server commands A -> B -> A,updateRequired.No credentials or auth files need to be shared.
Isajunsei commentedon Oct 2, 2026
Additional report from October 2, 2026, with a Windows desktop app and a separate CLI home under the same Windows user.
Environment observed:
After initially recovering sandbox setup, initialization state alternated between the app home and the independent CLI home. App Server commands failed before the requested process started, including a trivial Get-Location, with:
Our local diagnosis identified the same machine-wide CodexSandboxOffline / CodexSandboxOnline accounts with per-home sandbox credential state described here. A temporary local mitigation kept the sandbox credential store consistent across the two homes. The repair record documents tests of the shared-path state and subsequent successful CLI sandbox execution and app commands. Application authentication and configuration remained separate.
This is evidence from our installed runtime and local repair record, not a clean-machine reproduction on current main or a recommendation to change credential storage manually. The account/subscription plan was not established as the cause.
A separate initial setup failure matched #49299: an unmanaged full-access profile prevented provisioning; using a managed profile for the setup invocation recovered that stage but did not by itself address the cross-home recurrence.
The key regression case for an upstream resolution seems to be provision A, provision B, then alternate actual workspace-write execution A → B → A without re-provisioning invalidating the other home. A readiness flag or a read-only probe alone is insufficient. Please clarify the supported multi-home isolation/credential model so desktop and independent CLI use can coexist reliably.
MeroZemory commentedon Oct 3, 2026
Corroborated on Windows 11 / codex-cli 0.160.0, native elevated sandbox, with several active sessions using the default CODEX_HOME and a separate account manager's CODEX_HOME. Both homes had version-5 metadata and referenced the same fixed machine-wide CodexSandboxOffline / CodexSandboxOnline accounts.
At the same observation time, directly validating each home's encrypted sandbox credentials with LogonUserW gave:
The matching rust-v0.160.0 source uses machine-wide account names and home-local credential files; provisioning can reset those shared passwords and persist only the caller's record. I did not attribute the conflict to the model proxy, nor infer validity solely from file timestamps.
A one-time local recovery copied only the record proven valid by both logon checks into the stale home. Windows account passwords were not changed, and the target record's owner and DACL were preserved. Both homes then validated successfully. Subsequent explicit managed/elevated workspace-write checks in A -> B -> A all wrote/read successfully (2.18 / 1.90 / 2.35 seconds), and both credential-file modification times stayed unchanged. The existing default-home session also resumed normal sandbox commands. No hardlinks, symlinks or credential-sync service were installed.
This is a measured reproduction of this existing issue, not a new issue. The reconciliation restores current state but does not permanently solve later password rotation by another home. Manual validation only; no Codex/Rust build or Rust test execution for this investigation. A separate large protected-tree ACL propagation/capacity outage was investigated under #50349 and required a separate repair.
Nexvorn commentedon Oct 10, 2026
Additional reproduction: two VS Code Codex instances with separate CODEX_HOME directories (October 10, 2026)
I can reproduce the cross-home elevated Windows Sandbox/UAC behavior using the Codex VS Code extension, with two concurrent VS Code windows, separate projects, separate ChatGPT sign-ins, and separate CODEX_HOME directories. Both windows previously operated concurrently without repeated UAC prompts; this behavior appeared recently.
Environment
26.1007.21434; also reproduced after downgrading to26.930.61225~/.codexand~/.codex-plus2Controlled reproduction
whoamionce in the primary window's normal sandbox. It succeeds asCodexSandboxOfflinewithout a UAC prompt.whoamiagain in the primary window. Windows prompts to elevatecodex-windows-sandbox-setup.exe; the command completes after consent.26.930.61225, with both windows running, alternating read-onlywhoamiprobes in primary → secondary → primary produced a UAC prompt in all three attempts. Older chat histories remained accessible in both instances.Sandbox state measured at the reproduction time (October 10, local time UTC+3)
~/.codex/.sandbox-secrets/sandbox_users.json~/.codex/.sandbox/setup_marker.json~/.codex-plus2/.sandbox-secrets/sandbox_users.json~/.codex-plus2/.sandbox/setup_marker.jsonBoth machine-local Windows accounts,
CodexSandboxOfflineandCodexSandboxOnline, were enabled and reported PasswordLastSet = 14:56:02, exactly matching the secondary home's credential-file update, while the primary home's stored artifacts remained at 14:41. Both marker files existed, and the primary marker was readable from normal PowerShell.This is strong timestamp and behavioral evidence consistent with one home re-provisioning the machine-global accounts and making the other home's persisted state stale. It does not, by itself, cryptographically establish that the old credentials were invalid: I did not inspect/decrypt credentials or attempt
LogonUserW.Additional potentially related per-command symptom: In the last 3,000 lines of the latest inspected sandbox log,
setup refresh: spawningoccurred 91 times,setup binary completedanderrors=[]each occurred 91 times, whilesandbox users missing or incompatibleoccurred 14 times,marker missing0, andhide users: failed to hide current user profile dir77 times. This also resembles the distinct recurring-successful-refresh behavior in #42233; I cannot yet isolate how much of the UAC frequency belongs to each mechanism.Expected: two Codex VS Code windows using separate CODEX_HOME directories and accounts should be able to run concurrently with the elevated sandbox, preserving their independent authentication and conversation history, without each home triggering UAC reprovisioning for the other.
Please investigate machine-global sandbox credential lifecycle across independent CODEX_HOME instances and the apparently excessive successful setup refreshes. No raw logs, credentials, hostnames, personal account details, or project contents are attached.
Release 0.1.1: Dock UX, hot-add roles, Codex sandbox guard
onmateco commentedon Nov 30, 2026
Multica tracks the task-home side of this issue in multica-ai/multica#5876. On Windows with Multica 0.13.0 and standalone Codex 0.172.0, two task-local Codex homes each performed full elevated sandbox provisioning. Windows recorded account password resets followed by failed logons for an incorrect password. Native commands then failed to start with Win32 error 1326.
In a separate setup attempt, the standalone client requested Registered Core provisioning and reported that the app runtime provisioning service was unavailable and helper fallback was refused. The available evidence does not identify the failing IPC step.
Is there a supported, authenticated way for an external Codex app-server with a task-local
CODEX_HOMEto reuse compatible Desktop-owned Windows sandbox provisioning? If a Codex change is needed, could it verify caller identity and filesystem/network policy compatibility, keep account secrets private, and reject incompatible requests before rotating accounts or changing Desktop policy?The integration needs to preserve per-task configuration, tokens, session history and checkout boundaries even when Desktop and the task run sequentially. openai/codex#62397 describes a related case involving different proxy settings.