You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: codex exec cannot run any shell command after the desktop app provisions the sandbox (setup helper exits 1, proxy_ports 3128/8081 vs none) #62397
CLIIssues related to the Codex CLIbugSomething isn't workingexecIssues related to the `codex exec` subcommandsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Versions: codex-cli 0.170.0 (npm; also 0.169.0, and the app-bundled 0.169.0-alpha.11.1), Codex desktop app 26.1111.2228.0, Windows 11 Pro for Workstations 10.0.26300, [windows] sandbox = "elevated".
Repro
Use the Codex desktop app normally. Its service (CodexSandboxService.OpenAI.Codex) provisions the sandbox, and .codex\.sandbox\setup_marker.json ends up with "proxy_ports": [3128, 8081], "allow_local_binding": true.
Result: every shell call fails with Failed to create unified exec process: orchestrator_helper_exit_nonzero: setup helper exited with status Some(1).
The sandbox log says sandbox setup required: offline firewall settings changed (stored_ports=[3128, 8081], desired_ports=[], stored_allow_local_binding=true, desired_allow_local_binding=false).
No UAC prompt appears, including when run from an interactive PowerShell window. This was reproduced after a reboot.
Tried, no change:--enable network_proxy; -c features.network_proxy.enabled=true -c features.network_proxy.allow_local_binding=true; --enable windows_sandbox_service; the app's bundled codex.exe; upgrading to 0.170.0.
Expected: the CLI either accepts the app-provisioned marker, or re-provisions through the same sandbox service the app uses, without needing an elevated helper that fails.
Side effect: while the app and the CLI alternate, users see repeated sandbox approval prompts.
Related:#54441 (same proxy_ports flip, where it shows as repeated UAC prompts; here the helper exits 1 with no prompt), #61268 (elevated helper exits 1).
This is the same two-provisioner divergence as #54441/#61268, and the stored/desired values in your log line up with it. Source refs below are at rust-v0.170.0 (your CLI version).
Why the desired side is []/false. The desired offline firewall settings are derived from the invoking process environment, not from the app's marker: offline_proxy_settings_from_env reads CODEX_NETWORK_ALLOW_LOCAL_BINDING, CODEX_WINDOWS_SANDBOX_PROXY_PORTS, and the standard proxy variables (windows-sandbox-rs/src/setup.rs, offline_proxy_settings_from_env/proxy_ports_from_env). Those keys are only injected when a managed network proxy is active (apply_proxy_env_overrides, network-proxy/src/proxy.rs). A desktop-app provisioned marker therefore stores [3128, 8081]/true, while a plain codex exec from a shell computes []/false, and SetupMarker::request_mismatch_reason (an exact-equality comparison) demands re-provisioning on every alternation. In #54441 the same flip surfaces as repeated UAC prompts instead of a hard failure; here the helper dies first.
Why the --enable windows_sandbox_service attempt likely didn't change anything. The sandbox-service route is selected in the app-server setup processor (app-server/src/request_processors/windows_sandbox_processor.rs requires elevated mode plus registered_core_requested() or the windows_sandbox_service feature), and registered_core_requested() is gated on env CODEX_WINDOWS_REGISTERED_CORE=1, which only a registered-core (packaged runtime) chain injects (sandboxing/src/manager.rs strips it from the wrapper env unless the parent already had it). Your error still comes from the standalone elevated-helper path (orchestrator_helper_exit_nonzero is the fallback produced by report_helper_failure in setup.rs), so this run apparently never reached the service route. Worth confirming whether codex exec with that flag actually routes through the app-server processor in your setup.
What to capture next.report_helper_failure only includes a structured report when the helper wrote .codex/.sandbox/setup_error.json; your message is the bare fallback, meaning the elevated helper exited before its first report point. If that file is absent while the runas ShellExecuteExW launch itself succeeded (setup.rs run_setup_exe_payload), an auto-approving UAC context (admin shell, or UAC set to never notify) plus an early helper failure would match the "no prompt" observation.
Possible direction. The mismatch check is exact-equality in both directions. For an invocation that owns no proxy of its own, the stored settings are a superset of what it needs (offline identity unchanged), so adopting the stored firewall config instead of demanding a narrowing re-provision - and narrowing only when the proxy-owning client provisions next - would stop the ping-pong in both this issue and #54441. There is a tradeoff (loopback binding stays open during CLI-only sessions), but it is bounded and probably better than a hard failure plus an elevation prompt on every alternation.
Same failure here, with a few observations that are not in the thread yet.
Setup: npm codex-cli 0.163.0 and Codex Desktop 26.1111.2228.0 (bundled 0.169.0-alpha.11.1, service CodexSandboxService.OpenAI.Codex) sharing one CODEX_HOME, Windows 11 Pro 10.0.26300, [windows] sandbox = "elevated", CLI started from a non-elevated process, UAC at the default level (ConsentPromptBehaviorAdmin = 5). So the problem is not limited to 0.169/0.170.
What we saw for each failing command (same log line as above, stored_ports=[3128, 8081], desired_ports=[]):
In our case a UAC prompt does appear: consent.exe runs for about 4 seconds, then codex-windows-sandbox-setup.exe from the npm package starts and exits within roughly 0.1–0.3 seconds. No setup error: line, no setup_error.json, no new sandbox-<id>.log, and the marker is unchanged.
codex exec still exits 0 with turn.completed; only the command_execution item has exit_code: -1, status: "failed". A wrapper that trusts the exit code treats the run as successful (one such run cost us about 250k input tokens and produced nothing).
codex sandbox -P :read-only -C <dir> -- cmd /c echo ok keeps working in this state (it only does a setup refresh and does not compare the firewall settings), so it is not usable as a health check.
Setting CODEX_NETWORK_ALLOW_LOCAL_BINDING=1 in the environment of the codex exec process did not change the desired value in the log. Setting CODEX_WINDOWS_SANDBOX_PACKAGE_FAMILY to the Desktop package family name did not make the CLI use the Desktop service.
Starting the Desktop-bundled codex.exe directly by path fails the same way (as already reported above).
How it recovered for us (once; not confirmed to be reliable):
We quit and restarted Desktop. After that the packaged service was STOPPED (exit code 0, still AUTO_START), and Desktop's own commands failed with Failed to create unified exec process: app runtime provisioning service is unavailable; refusing helper fallback.
sc start "CodexSandboxService.OpenAI.Codex" worked without elevation.
The next local command in a Desktop thread logged the same desired_ports=[] mismatch, the service re-provisioned, and setup_marker.json went back to "proxy_ports": [], "allow_local_binding": false.
The npm CLI could run commands again, with no UAC prompt.
Before the restart, Desktop had been the one asking for [3128, 8081] / true (from a shell started by the OpenAI.CodexPrimaryRuntime package), so the same Desktop install wants different values at different times.
Workaround we use now: read %CODEX_HOME%\.sandbox\setup_marker.json before starting the CLI, and do not start it while proxy_ports is not empty or allow_local_binding is true.
Two requests in addition to the ones above:
When the helper is going to refuse, please say so (log line or setup_error.json) and skip the elevation prompt.
Please do not let codex exec exit 0 when no command could be started at all, or expose it in a machine-readable way.
Reproduced on 2026-11-30 with standalone codex-cli and app-server 0.172.0, desktop package 26.1120.6357.0 (bundled core 0.171.0-alpha.13.2), and Windows 11 Pro 25H2 build 26200.7171. The supported updater still resolves to 0.172.0.
A deterministic reproduction uses the app-server protocol directly, without a model turn. After initialize/initialized, send command/exec with the following parameters, using an existing working directory.
With windows.sandbox = "elevated", this returns error -32603 and orchestrator_helper_exit_nonzero: setup helper exited with status Some(1). The sandbox log records the exact settings mismatch from this issue, stored ports [3128,8081] and local binding true versus desired ports [] and local binding false. Three concurrent directory/Git/file-search commands fail at this same provisioning stage.
The installed CodexSandboxService.OpenAI.Codex service is running, and a completed package-owned Registered Core installation is present. Installation/configuration checks pass in codex doctor. Enabling windows_sandbox_service and supplying the package-family routing hint did not resolve this reproduction.
Source inspection suggests a specific coexistence failure. The legacy setup helper rejects account provisioning when Registered Core owns the accounts, before producing its ordinary log/error report. The service separately rejects clients without the installed package identity. The unpackaged CLI can consequently fall back to a helper that is prohibited from provisioning. This is a causal inference from the source and local registration state. The helper's internal rejection text was not captured directly.
The CLI's codex sandbox smoke test succeeds, while the command/exec reproduction fails. The debug sandbox entry point preserves existing proxy settings, so that smoke test does not cover the reconciliation failure.
The documented unelevated fallback passed parallel command execution and workspace/read-only filesystem checks. The original elevated setting has been restored while investigating recovery through the authenticated packaged service. Please investigate a supported coexistence/reconciliation path for standalone CLI and desktop-owned sandbox accounts.
Update with a verified recovery on the same machine. The desktop GUI process was absent throughout the final checks, while its Windows sandbox service remained running.
I used Windows Invoke-CommandInDesktopPackage with the installed package family and AppId App to launch a hidden diagnostic process. GetCurrentPackageFullName verified the actual installed package identity. From that genuine package context, I launched the package's own app/resources/codex.exe with CODEX_WINDOWS_REGISTERED_CORE=1 and called windowsSandbox/setupStart with mode elevated and the working directory, using an environment without proxy variables. The service returned windowsSandbox/setupCompleted with success=true. The actual service operation changed the marker to proxy_ports=[] and allow_local_binding=false.
Afterward the ordinary standalone 0.172.0 app-server passed all six checks through command/exec with elevated sandboxing: three concurrent directory/Git/file-search commands, permitted workspace writing, denied read-only writing, and denied outbound TCP in the offline policy. The same TCP destination was reachable from an ordinary host process as a control.
The user configuration is back to windows.sandbox="elevated". The recovery used the authenticated service operation. The product-level coexistence issue can recur if a later desktop session provisions the shared offline identity with different proxy settings.
🤖 Claude Opus 5.5 responding on behalf of noah-schneider
On this machine, the desktop app's cloud environment exec-server triggered the marker flip, not normal desktop-app sessions. Each time a Codex cloud task ran a command on this PC, the packaged service re-provisioned silently to proxy_ports: [3128, 8081] / allow_local_binding: true. From then on, every sandboxed command from the npm CLI asked for UAC elevation, and the helper exited 1.
Environment: npm codex-cli 0.172.0 (driven by a third-party GUI), desktop package 26.1120.6357.0 with CodexSandboxService.OpenAI.Codex running, Windows 11 Pro 10.0.26200, [windows] sandbox = "elevated", shared CODEX_HOME.
What I verified from .codex/.sandbox/sandbox.<date>.log:
The desktop app keeps a long-running codex.exe exec-server --remote https://codex-cloud-environments.chatgpt.com/api --environment-id ccarenv_… process.
Both flips happened right after a command from that process. These commands are easy to spot in the log for three reasons:
They run through the OpenAI.CodexPrimaryRuntime…\dependencies\native\powershell\pwsh.exe shell.
They don't have the try { [Console]::OutputEncoding=... } catch {} prefix that local desktop and CLI commands get.
The last line then repeats for every later CLI command.
An earlier flip on 2026-11-27 17:19 followed the same pattern. That time the triggering cloud command was a gh auth status; gh run list ….
Before the flip, the same day's log has about 1,250 normal session commands and about 700 fs-helper calls. None of them asked for setup.
Workaround that worked here (twice): in an elevated shell, recreate the two firewall rules codex_sandbox_offline_block_loopback_tcp and codex_sandbox_offline_block_loopback_udp. They block outbound traffic to 127.0.0.0/8 and ::/127, filtered to the CodexSandboxOffline user's SID. Then set setup_marker.json back to "proxy_ports": [] and "allow_local_binding": false. The CLI runs without prompts afterwards, until the next cloud-task command on this machine.
Judgment: this is the same two-provisioner problem described above. It's worth adding because it happens even when nobody touches the desktop app locally: any cloud task that targets the machine resets the marker. A fix probably needs both of these: separate offline firewall state per proxy configuration, so the two sides don't overwrite one shared marker, and a CLI path that either goes through the packaged service or reports why its elevated helper exits 1.
CLIIssues related to the Codex CLIbugSomething isn't workingexecIssues related to the `codex exec` subcommandsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Nov 19, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
yjjnls commentedon Nov 19, 2026
This is the same two-provisioner divergence as #54441/#61268, and the stored/desired values in your log line up with it. Source refs below are at
rust-v0.170.0(your CLI version).Why the desired side is
[]/false. The desired offline firewall settings are derived from the invoking process environment, not from the app's marker:offline_proxy_settings_from_envreadsCODEX_NETWORK_ALLOW_LOCAL_BINDING,CODEX_WINDOWS_SANDBOX_PROXY_PORTS, and the standard proxy variables (windows-sandbox-rs/src/setup.rs,offline_proxy_settings_from_env/proxy_ports_from_env). Those keys are only injected when a managed network proxy is active (apply_proxy_env_overrides,network-proxy/src/proxy.rs). A desktop-app provisioned marker therefore stores[3128, 8081]/true, while a plaincodex execfrom a shell computes[]/false, andSetupMarker::request_mismatch_reason(an exact-equality comparison) demands re-provisioning on every alternation. In #54441 the same flip surfaces as repeated UAC prompts instead of a hard failure; here the helper dies first.Why the
--enable windows_sandbox_serviceattempt likely didn't change anything. The sandbox-service route is selected in the app-server setup processor (app-server/src/request_processors/windows_sandbox_processor.rsrequires elevated mode plusregistered_core_requested()or thewindows_sandbox_servicefeature), andregistered_core_requested()is gated on envCODEX_WINDOWS_REGISTERED_CORE=1, which only a registered-core (packaged runtime) chain injects (sandboxing/src/manager.rsstrips it from the wrapper env unless the parent already had it). Your error still comes from the standalone elevated-helper path (orchestrator_helper_exit_nonzerois the fallback produced byreport_helper_failureinsetup.rs), so this run apparently never reached the service route. Worth confirming whethercodex execwith that flag actually routes through the app-server processor in your setup.What to capture next.
report_helper_failureonly includes a structured report when the helper wrote.codex/.sandbox/setup_error.json; your message is the bare fallback, meaning the elevated helper exited before its first report point. If that file is absent while therunasShellExecuteExW launch itself succeeded (setup.rsrun_setup_exe_payload), an auto-approving UAC context (admin shell, or UAC set to never notify) plus an early helper failure would match the "no prompt" observation.Possible direction. The mismatch check is exact-equality in both directions. For an invocation that owns no proxy of its own, the stored settings are a superset of what it needs (offline identity unchanged), so adopting the stored firewall config instead of demanding a narrowing re-provision - and narrowing only when the proxy-owning client provisions next - would stop the ping-pong in both this issue and #54441. There is a tradeoff (loopback binding stays open during CLI-only sessions), but it is bounded and probably better than a hard failure plus an elevation prompt on every alternation.
takeshihashimoto commentedon Nov 20, 2026
Same failure here, with a few observations that are not in the thread yet.
Setup: npm
codex-cli 0.163.0and Codex Desktop26.1111.2228.0(bundled 0.169.0-alpha.11.1, serviceCodexSandboxService.OpenAI.Codex) sharing oneCODEX_HOME, Windows 11 Pro 10.0.26300,[windows] sandbox = "elevated", CLI started from a non-elevated process, UAC at the default level (ConsentPromptBehaviorAdmin = 5). So the problem is not limited to 0.169/0.170.What we saw for each failing command (same log line as above,
stored_ports=[3128, 8081], desired_ports=[]):consent.exeruns for about 4 seconds, thencodex-windows-sandbox-setup.exefrom the npm package starts and exits within roughly 0.1–0.3 seconds. Nosetup error:line, nosetup_error.json, no newsandbox-<id>.log, and the marker is unchanged.codex execstill exits 0 withturn.completed; only thecommand_executionitem hasexit_code: -1,status: "failed". A wrapper that trusts the exit code treats the run as successful (one such run cost us about 250k input tokens and produced nothing).codex sandbox -P :read-only -C <dir> -- cmd /c echo okkeeps working in this state (it only does a setup refresh and does not compare the firewall settings), so it is not usable as a health check.CODEX_NETWORK_ALLOW_LOCAL_BINDING=1in the environment of thecodex execprocess did not change the desired value in the log. SettingCODEX_WINDOWS_SANDBOX_PACKAGE_FAMILYto the Desktop package family name did not make the CLI use the Desktop service.codex.exedirectly by path fails the same way (as already reported above).How it recovered for us (once; not confirmed to be reliable):
STOPPED(exit code 0, stillAUTO_START), and Desktop's own commands failed withFailed to create unified exec process: app runtime provisioning service is unavailable; refusing helper fallback.sc start "CodexSandboxService.OpenAI.Codex"worked without elevation.desired_ports=[]mismatch, the service re-provisioned, andsetup_marker.jsonwent back to"proxy_ports": [], "allow_local_binding": false.Before the restart, Desktop had been the one asking for
[3128, 8081]/true(from a shell started by theOpenAI.CodexPrimaryRuntimepackage), so the same Desktop install wants different values at different times.Workaround we use now: read
%CODEX_HOME%\.sandbox\setup_marker.jsonbefore starting the CLI, and do not start it whileproxy_portsis not empty orallow_local_bindingis true.Two requests in addition to the ones above:
setup_error.json) and skip the elevation prompt.codex execexit 0 when no command could be started at all, or expose it in a machine-readable way.sonsungjong commentedon Nov 30, 2026
Reproduced on 2026-11-30 with standalone codex-cli and app-server 0.172.0, desktop package 26.1120.6357.0 (bundled core 0.171.0-alpha.13.2), and Windows 11 Pro 25H2 build 26200.7171. The supported updater still resolves to 0.172.0.
A deterministic reproduction uses the app-server protocol directly, without a model turn. After initialize/initialized, send command/exec with the following parameters, using an existing working directory.
{ "command": ["C:\\Program Files\\PowerShell\\7\\pwsh.exe", "-NoProfile", "-Command", "Get-Location"], "cwd": "C:\\work\\repo", "sandboxPolicy": { "type": "workspaceWrite", "writableRoots": ["C:\\work\\repo"], "networkAccess": false }, "timeoutMs": 15000 }With windows.sandbox = "elevated", this returns error -32603 and
orchestrator_helper_exit_nonzero: setup helper exited with status Some(1). The sandbox log records the exact settings mismatch from this issue, stored ports [3128,8081] and local binding true versus desired ports [] and local binding false. Three concurrent directory/Git/file-search commands fail at this same provisioning stage.The installed CodexSandboxService.OpenAI.Codex service is running, and a completed package-owned Registered Core installation is present. Installation/configuration checks pass in codex doctor. Enabling windows_sandbox_service and supplying the package-family routing hint did not resolve this reproduction.
Source inspection suggests a specific coexistence failure. The legacy setup helper rejects account provisioning when Registered Core owns the accounts, before producing its ordinary log/error report. The service separately rejects clients without the installed package identity. The unpackaged CLI can consequently fall back to a helper that is prohibited from provisioning. This is a causal inference from the source and local registration state. The helper's internal rejection text was not captured directly.
The CLI's
codex sandboxsmoke test succeeds, while the command/exec reproduction fails. The debug sandbox entry point preserves existing proxy settings, so that smoke test does not cover the reconciliation failure.The documented unelevated fallback passed parallel command execution and workspace/read-only filesystem checks. The original elevated setting has been restored while investigating recovery through the authenticated packaged service. Please investigate a supported coexistence/reconciliation path for standalone CLI and desktop-owned sandbox accounts.
Update with a verified recovery on the same machine. The desktop GUI process was absent throughout the final checks, while its Windows sandbox service remained running.
I used Windows Invoke-CommandInDesktopPackage with the installed package family and AppId App to launch a hidden diagnostic process. GetCurrentPackageFullName verified the actual installed package identity. From that genuine package context, I launched the package's own app/resources/codex.exe with CODEX_WINDOWS_REGISTERED_CORE=1 and called windowsSandbox/setupStart with mode elevated and the working directory, using an environment without proxy variables. The service returned windowsSandbox/setupCompleted with success=true. The actual service operation changed the marker to proxy_ports=[] and allow_local_binding=false.
Afterward the ordinary standalone 0.172.0 app-server passed all six checks through command/exec with elevated sandboxing: three concurrent directory/Git/file-search commands, permitted workspace writing, denied read-only writing, and denied outbound TCP in the offline policy. The same TCP destination was reachable from an ordinary host process as a control.
The user configuration is back to windows.sandbox="elevated". The recovery used the authenticated service operation. The product-level coexistence issue can recur if a later desktop session provisions the shared offline identity with different proxy settings.
noah-schneider commentedon Dec 1, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of noah-schneider
On this machine, the desktop app's cloud environment exec-server triggered the marker flip, not normal desktop-app sessions. Each time a Codex cloud task ran a command on this PC, the packaged service re-provisioned silently to
proxy_ports: [3128, 8081]/allow_local_binding: true. From then on, every sandboxed command from the npm CLI asked for UAC elevation, and the helper exited 1.Environment: npm codex-cli 0.172.0 (driven by a third-party GUI), desktop package 26.1120.6357.0 with
CodexSandboxService.OpenAI.Codexrunning, Windows 11 Pro 10.0.26200,[windows] sandbox = "elevated", sharedCODEX_HOME.What I verified from
.codex/.sandbox/sandbox.<date>.log:codex.exe exec-server --remote https://codex-cloud-environments.chatgpt.com/api --environment-id ccarenv_…process.OpenAI.CodexPrimaryRuntime…\dependencies\native\powershell\pwsh.exeshell.try { [Console]::OutputEncoding=... } catch {}prefix that local desktop and CLI commands get.gh auth status; gh run list ….Workaround that worked here (twice): in an elevated shell, recreate the two firewall rules
codex_sandbox_offline_block_loopback_tcpandcodex_sandbox_offline_block_loopback_udp. They block outbound traffic to127.0.0.0/8and::/127, filtered to the CodexSandboxOffline user's SID. Then setsetup_marker.jsonback to"proxy_ports": []and"allow_local_binding": false. The CLI runs without prompts afterwards, until the next cloud-task command on this machine.Judgment: this is the same two-provisioner problem described above. It's worth adding because it happens even when nobody touches the desktop app locally: any cloud task that targets the machine resets the marker. A fix probably needs both of these: separate offline firewall state per proxy configuration, so the two sides don't overwrite one shared marker, and a CLI path that either goes through the packaged service or reports why its elevated helper exits 1.