Windows elevated sandbox: repeated UAC prompts because offline firewall proxy_ports flip between project-level network_proxy threads and daemon threads
What version of Codex CLI is running?
codex-cli 0.162.1 (standalone; app-server daemon 0.162.1)
What subscription do you have?
ChatGPT Pro Lite
Which model were you using?
gpt-6.1-sol (high)
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64 (Windows 11 Enterprise 25H2 build 26200.9448, Windows 365 Cloud PC, Entra ID, non-admin user)
What terminal emulator and version are you using (if applicable)?
Windows Terminal, PowerShell 7
Codex doctor report
Same machine and config as #54440 (full redacted codex doctor --json is there). Relevant parts: sandbox backend elevated, sandbox provisioning complete, [features] network_proxy = true set only in the project .codex/config.toml.
What issue are you seeing?
Resuming a session, especially one with subagents, produces 7-15 UAC prompts for codex-windows-sandbox-setup.exe within about a minute. Each one is a full elevated provisioning run. ~/.codex/.sandbox/sandbox.<date>.log shows the stored offline firewall ports flipping between two values:
23:41:58 sandbox setup required: offline firewall settings changed (stored_ports=[], desired_ports=[3128, 8084], stored_allow_local_binding=false, desired_allow_local_binding=false)
23:42:24 sandbox setup required: offline firewall settings changed (stored_ports=[3128, 8084], desired_ports=[], stored_allow_local_binding=false, desired_allow_local_binding=false)
23:42:29 sandbox setup required: offline firewall settings changed (stored_ports=[], desired_ports=[3128, 8084], stored_allow_local_binding=false, desired_allow_local_binding=false)
The base64 payload in the UAC dialog decodes to:
{"version":5,"offline_username":"CodexSandboxOffline","online_username":"CodexSandboxOnline","codex_home":"C:\Users\<user>\.codex","command_cwd":"C:\Users\<user>\.codex","read_roots":[],"write_roots":[],"deny_write_paths":[],"proxy_ports":[],"allow_local_binding":false,"oter_paths":[],"refresh_only":false,"hydrate_sandbox_users":false,"use_profile_root_policy":true}
Project threads load network_proxy = true and want ports [3128, 8084]. Daemon-internal threads run with cwd ~/.codex, never load the project config, and want []. Every alternation rewrites setup_marker.json and triggers another elevated setup. Concurrent setups also collide:
failed to grant non-inheriting read-attributes ACE on user profile C:\Users\<user>: open ACL target for root-only update: The process cannot access the file because it is being used by another process. (os error 32)
Failed to create unified exec process: orchestrator_helper_incomplete: setup helper exited successfully before setup completed
The first upgrade from 0.160.0 to 0.162.1 caused the same storm (sandbox setup marker missing or incompatible plus the port change): 12 provisioning runs in about 60 s.
What steps can reproduce the bug?
- Windows 11, elevated sandbox, non-admin account.
- Enable
[features] network_proxy = trueonly in a project.codex/config.toml, not in~/.codex/config.toml. - Start or resume a thread in that project, ideally one with subagents, so the daemon also runs its own background threads.
- Watch the UAC prompts and the
offline firewall settings changedlines in the sandbox log.
Thread id: 01a141b9-8003-7cd1-a957-4d585234048d.
What is the expected behavior?
At most one elevated setup per real configuration change, and no oscillation between threads with different proxy settings. For example, the firewall rules could cover the union of the ports, or be keyed per proxy configuration. Parallel setup requests should also be serialized or deduplicated, so a single change produces one UAC prompt.
Additional information
Workaround: remove network_proxy from the project config (or set it identically in the user config). Related: #40217, #30445 (setup helper / marker issues), #54440 (escalation ignored on the same machine).
Additional Windows 10 reproduction and source review
Environment: Windows 10 Pro 22H2 build 19045.7807, desktop package 26.1013.4894.0, cached CLI 0.163.0-alpha.10.2. Native elevated sandbox. A previously approved directory-only SYSTEM ownership workaround for a separate sandbox-bin access failure remains active; no new ACL or security-policy changes in these trials.
Observed reproduction and controls
Native Codex and local Work share sandbox accounts and setup artifacts, but request different offline network settings: native empty proxy ports/local binding false, Work ports 3128 and 8081/local binding true.
One early-overlap trial on 20 October 2026 reproduced two bad-password logon events for the technical sandbox account, repeated internal provisioning and a native orchestrator_helper_incomplete result. Work eventually ran successfully. The native request began about 410 ms after Work requested setup. Native ACL refresh overlapped Work provisioning; two simultaneous full provisioning writers were not established. Individual credential snapshots and failed-logon callers were not captured, so an exact causal trace remains unproven.
Later genuine serial native-to-Work and Work-to-native transitions both provisioned successfully and ran their read commands with exit 0. Independent elevation controls also passed. Earlier no-visible-prompt ShellExecuteExW cancellation failures are a separate intermittent stage and have not been assigned the same cause.
Concrete source review targets
Version tag resolves to 4ebc485ca321243727539187169425fcf972f2c4; exact installed binary/source identity is not independently attested.
- Existing writer serialization: windows-sandbox-rs/src/setup_mutex.rs and setup_provisioning.rs:555-573. This is not a claim that all global locking is absent.
- identity.rs:298-310 selects credentials before ACL refresh and returns that original snapshot afterwards. Selection through actual logon is not one protected transaction in the reviewed path.
- identity.rs:483-497 unconditionally removes the shared account artifact during credential recovery; the rejected snapshot/generation is not an input to that function.
- elevated/runner_client.rs:156-172 retries via that recovery for refreshable failures; lines 403-432 pass the selected credentials to CreateProcessWithLogonW.
- setup.rs:1019/1071 performs completion validation after helper exit. identity.rs:79-89 reads separate marker/account artifacts without identifying the requesting setup generation/profile.
A numeric, in-memory interleaving model demonstrates stale-snapshot and transient-completion counterexamples with only one serialized writer. This is a logical model, not execution of product code or proof of the historical schedule.
At public main commit f29d55ff0697a88226e8a9811b3c007e5f719cba, identity.rs and setup.rs were byte-identical to those version snapshots. This does not rule out fixes elsewhere or prove any release package has identical behavior.
Requested engineering assessment
Please assess consistent generation-aware coordination of credential selection, login, invalidation and helper completion. Recovery should preserve a newer successfully provisioned account artifact; completion should distinguish an incomplete attempt from a successful attempt superseded by another setup. Preserve fail-closed readiness and each profile's network restrictions. A simple union of allowed proxy ports or disabling sandbox/proxy protection is not an acceptable equivalent control.
Useful diagnostic events would include caller PID, setup-attempt ID, desired profile, non-secret generation, and stage boundaries. Do not log passwords, protected credential blobs or full launch payloads. Suggested deterministic regression points: rotate after selection/before login; begin a second setup after first helper exit/before completion; attempt stale recovery after a newer commit; and genuine missing-artifact recovery.
Two earlier changes, #52682 and #51822, are already ancestors of the matching version-tag commit. They concern registered-account repair validation and active runtime-file ACL access respectively; neither establishes a fix for the reader/completion coordination windows described above.
Pinned source references:
- Credential selection before refresh
- Shared-artifact invalidation on login failure
- Runner retry and login
- Completion validation
- Existing helper writer guard
No raw logs, credentials, personal account identifiers, screenshots or attachments are included.
On Windows 10 x64 with stable desktop build 30866 (runner 0.171.0-alpha.13.2), the packaged sandbox service is running. Desktop startup recorded appPackageCoreActive=false and selected the copied runtime. Switching between offline and managed-network commands still requested full setup. Declining UAC returned 1223 before the business process started. Is there a supported desktop migration or fix that preserves each workload’s network restrictions and allows both managed HTTP and SOCKS to require a host-side upstream?
Additional Windows 10 PC reproduction: Dot direct shell versus desktop Codex
Investigated on 29 November 2026. The elevated sandbox already works; the recurring setup is associated with alternating network profiles, not inability to provision it initially.
Environment
- Windows 10 Pro 22H2, build 19045.6466.
- Desktop 26.1120.50957, build 30866; bundled CLI 0.171.0-alpha.13.2.
[windows] sandbox = "elevated"; packaged sandbox service running.- Both desktop app-server and Dot remote exec-server use the same bundled CLI. Both have
features.prefer_mxc=true, but this PC uses the elevated backend. - The configured updater reported
up_to_dateduring the investigation. - No user/machine proxy or local-binding environment overrides were found.
Observed policy collision
| Execution path | Requested offline proxy ports | Local binding |
|---|---|---|
| Restricted desktop/app-server path | [] |
false |
| Dot direct Windows exec-server path | [3128,8081] |
true |
Dot's exec-server owns listeners on 127.0.0.1:3128 and 127.0.0.1:8081. Both paths share the fixed sandbox accounts and ~/.codex/.sandbox/setup_marker.json.
Selected log entries, 29 November, Central time:
15:55:14.683 sandbox setup required: offline firewall settings changed (stored_ports=[3128, 8081], desired_ports=[], stored_allow_local_binding=true, desired_allow_local_binding=false)
15:55:23.615 setup provisioning binary completed
15:55:48.360 sandbox setup required: offline firewall settings changed (stored_ports=[], desired_ports=[3128, 8081], stored_allow_local_binding=false, desired_allow_local_binding=true)
15:55:51.800 setup provisioning binary completed
15:56:19.753 sandbox setup required: offline firewall settings changed (stored_ports=[3128, 8081], desired_ports=[], stored_allow_local_binding=true, desired_allow_local_binding=false)
15:56:25.431 setup provisioning binary completed
The resulting marker is version 5, with proxy_ports=[], allow_local_binding=false and created_at=2026-11-29T21:56:25.431594800+00:00.
Source review and remaining uncertainty
Reviewed published tag rust-v0.171.0-alpha.13.2, corresponding to the installed version string; this is not a reproducible-build attestation.
- prepare_managed_network constructs the executor proxy from the incoming
params.network_proxyusingfrom_remote_launch_config. The precise upstream Dot setting selectingallow_local_binding=trueremains unidentified. - Executor startup does not establish a documented desktop
config.tomloverride for that incoming per-command value. - SetupMarker::request_mismatch_reason requires matching local-binding mode, and matching ports when binding is false. Public main retained that logic when checked.
- Fixed sandbox usernames and machine-level rules mean separate
CODEX_HOMEdirectories alone do not isolate these policies. Editing the marker would not repair actual enforcement. - Firewall provisioning removes offline loopback block rules when local binding is enabled. Enabling it for previously offline desktop commands would change their protections. Setting Dot binding=false alone would still leave the port mismatch.
Workaround tests and limits
A saved instruction routes Dot Windows work into an existing restricted desktop Codex chat, avoiding Dot's own shell/filesystem executor. This is an agent instruction, not OS enforcement.
Five probes alternated local restricted bundled CLI -> Dot-delegated desktop chat -> local -> Dot-delegated -> local. All ran as CodexSandboxOffline, passed directory reads, unique disposable study-file write/read/delete, and Git reads using a command-only exact-checkout safe.directory exception. Direct HTTPS was blocked as expected by the offline policy. Independent host inspection found zero new full provisioning or offline-profile mismatch entries during those probes; the marker stayed unchanged.
These tests validate only the routing workaround. They do not validate direct Dot shell alternation or Dot's managed networking. Routine per-command ACL refresh is distinct from full provisioning.
A displayed Full access / effective workspace-write mismatch and application certificate-store warnings were also observed; no causal connection to this firewall drift was established. No security settings, firewall rules, game files or organization policies were manually changed.
Requested resolution
Please identify a supported Windows 10 app-only repair that preserves offline desktop loopback restrictions and Dot's managed HTTP/SOCKS policy. An OS upgrade is not acceptable for this PC. Neither merging the allowed permissions nor suppressing setup checks is an equivalent fix.
Acceptance: desktop -> direct Dot Windows shell -> desktop -> direct Dot -> desktop, preserving the actual restricted identities and intended policies; folder reads and disposable writes pass, intended networking works and blocked destinations stay blocked, with no new full provisioning. Please also account for concurrent launch paths and shared credential/setup-state consistency.
Personal paths, chat/environment identifiers, credentials and raw diagnostic bundles are omitted.
Verified Windows 10 workaround: feature-level proxy settings, with an explicit localhost tradeoff
Follow-up to my earlier reproduction. We now have a working workaround on this PC for actual desktop Codex ↔ Dot direct Windows shell switching. This is not an upstream fix or a security-equivalent repair: after reviewing the implications, I explicitly accepted broader localhost access. The earlier request to preserve the original loopback restrictions remains unresolved.
Tested: Windows 10 Pro 22H2, build 19045.6466; desktop 26.1120.50957/build 30866; bundled CLI 0.171.0-alpha.13.2; native elevated sandbox. No Windows upgrade.
Configuration that worked
Back up the user ~/.codex/config.toml and merge the following into it, preserving unrelated settings. Put default_permissions at the top level, before any table headers. If features.network_proxy is already a boolean or inline table, replace that value with the table form rather than defining it twice. Keep the existing elevated Windows sandbox setting.
default_permissions = "win10-feature-trial"
[features.network_proxy]
enabled = true
allow_local_binding = true
proxy_url = "http://127.0.0.1:3129"
socks_url = "http://127.0.0.1:8082"
[features.network_proxy.domains]
"chatgpt.com" = "allow"
"developers.openai.com" = "allow"
[permissions.win10-feature-trial]
extends = ":workspace"
[permissions.win10-feature-trial.network]
enabled = true
The two domains above are a deliberately small test allowlist, not a complete development-network configuration. Add the specific hosts your workflow needs; remote Git/package downloads were not established by these tests. The settings are documented under features.network_proxy, which is experimental.
On this PC, Dot already owned loopback ports 3128/8081; the desktop profile used free ports 3129/8082. Check for port conflicts on other machines.
- Fully quit and reopen the desktop app after editing.
- Select win10-feature-trial in each relevant local chat's permissions selector, including existing chats. A saved default alone did not update every existing chat.
- Send a new turn after selection. An already-running turn retained its previous permissions.
- First verify the actual shell identity/environment. Here it was
CodexSandboxOffline, desktopHTTPS_PROXY=http://127.0.0.1:3129,ALL_PROXY=socks5h://127.0.0.1:8082, andCODEX_NETWORK_ALLOW_LOCAL_BINDING=1. Dot retained its own 3128/8081 proxies and binding=1. - Expect initial provisioning for the real policy change; subsequent switches should not provision again.
Important desktop distinction: putting the proxy URLs, local-binding flag and domains only under permissions.<name>.network worked in standalone app-server tests but failed in the actual desktop chat, even after selecting that profile in a fresh turn. The desktop shell instead got default ports 3128/8081, binding=0, and denied an intended allowed domain. Moving those values to features.network_proxy worked in the actual desktop chat. The exact internal cause of that profile-detail handoff remains unproven. Feature-level settings also affect other locally managed, network-enabled command proxies; this is broader configuration scope than a single named profile.
Actual firewall effect and risk
Codex's normal setup removed:
codex_sandbox_offline_block_loopback_tcpcodex_sandbox_offline_block_loopback_udp
The offline account's non-loopback inbound/outbound block rules retained their original properties. UAC and all three Windows firewall profiles remained enabled. No custom persistent WFP filters, broad inbound allow rules, services, drivers, ACL workarounds, or patched executables were left installed.
This permits broader access to local services, not just four proxy ports. Services that trust localhost can expose data or actions beyond filesystem sandbox permissions. Loopback-only proxy listeners do not establish localhost isolation. Do not use this workaround if preserving the prior loopback policy is required.
The reviewed version's SetupMarker::request_mismatch_reason ignores port differences while both requests have local binding enabled. That explains why desktop 3129/8082 and Dot 3128/8081 can coexist without repeatedly rebuilding the shared firewall state. It does not repair the shared-state design.
Verification
Normal tools in actual desktop chats, interleaved with Dot's own Windows shell, completed:
desktop 1 → Dot 1 → desktop 2 → Dot 2 → desktop 3
All five passed:
- restricted offline sandbox identity;
- folder and Git reads;
- disposable TEMP-file creation, readback and deletion;
- HTTPS 200 to both test hosts with Node/OpenSSL certificate verification enabled;
- direct public TCP denied with EACCES.
After initial provisioning, independent host-side log/state observation found zero new provisioning completions, zero new offline-firewall mismatch entries, and an unchanged setup marker throughout those switches and the following study test. Routine ACL refresh messages still occur and are distinct from firewall provisioning.
A separate actual project chat passed a disposable write/read/delete in its existing study workspace, exit 0, with no setup request observed. Later routing tests in two development workspaces also passed create/read/delete, exit 0, under effective workspace-write and this selected profile; the user observed no permission prompts. Existing project files were not modified.
The desktop tool denied example.com as not allowlisted. That expected negative check was separated from the positive probe because the tool surfaces the denial as a tool-level error rather than returning complete probe JSON.
Limits and rollback
- Dot still returned HTTPS 200 from
example.comdespite its reported allowlist. Its domain-policy enforcement is not verified; this workaround does not fix that discrepancy. - Dot's filesystem roots were not expanded. Writes outside them still route to appropriately scoped local Codex chats. That routing instruction is operational guidance, not OS enforcement.
- Node/OpenSSL networking passed; earlier PowerShell/Schannel failures and certificate-store warnings are not declared fixed.
- Full access was not needed for the successful command tests. The earlier UI/effective-policy mismatch remains a separate observation.
- An older chat or another launch path requesting the original offline profile can still recreate the mismatch. Concurrent launches and all other background paths were not exhaustively tested.
To undo: restore the previous user-config values, or remove only these added sections/key while preserving subsequent unrelated edits; select the original workspace policy and restart the app. With Dot's direct shell idle, run a normal restricted workspace command so Codex reconciles the original sandbox policy. This may require one setup approval. Verify the original loopback rules and marker afterward; do not edit the marker manually or reset the firewall.
This result supports a practical opt-in workaround on the tested build, not closing the issue as fixed. Personal paths, chat IDs, account SIDs, credentials and raw diagnostic bundles are omitted.
I’m still hitting this on Windows 10 in ChatGPT Desktop, with Codex runner 0.171.0-alpha.13.2. On Nov 30, full sandbox provisioning finished at 23:30:16 UTC. About nine seconds later, another command requested administrator approval again: the saved profile had proxy ports [3128, 8081] and local binding enabled; the new request wanted no proxy ports and local binding disabled. The repeated prompts block ordinary commands and stall unattended work. Please escalate this to Windows desktop engineering. Is there a patched build that lets both Desktop and Work run normally while preserving their existing network restrictions?