Skip to content

[Windows] Elevated sandbox setup helper is spawned once per command even when every refresh succeeds (1103 spawns/day, marker valid) #42233

Open

Description

@RT0305

What version of Codex are you using?

codex-cli 0.151.0-alpha.7.2 (npm global), invoked as codex exec from a local
automation controller. ~/.codex/config.toml contains [windows] sandbox = "elevated".

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64 (Windows 11 Pro). Single interactive user,
member of BUILTIN\Administrators, UAC enabled.

What issue are you seeing?

With [windows] sandbox = "elevated", codex.exe spawns
codex-windows-sandbox-setup.exe once per sandboxed command, not once per
session and not only on marker invalidation. Each spawn requires elevation, so a
working day of agent runs produced 1,103 elevated helper spawns on a single
machine.

The distinguishing fact: every one of those spawns succeeded. All 1,103 logged
errors=[], and 1,046 of them reported processed N write roots with N > 0 — i.e.
the helper re-applied ACLs for a write root that a spawn moments earlier had already
processed successfully.

Marker invalidation is not the driver here. In the same 11,879-line log,
sandbox users missing or incompatible with marker version appears only 15 times
against 1,103 spawns.

Measurements (single day, ~/.codex/.sandbox/sandbox.2026-09-02.log)

Log event Count
setup refresh: spawning …codex-windows-sandbox-setup.exe 1103
setup refresh: … errors=[] 1103 (100%)
setup refresh: processed N write roots, N > 0 1046
setup refresh: processed 0 write roots 57
sandbox users missing or incompatible with marker version 15
hide users: failed to hide current user profile dir (C:\Users\Default) 1094

Inter-spawn gap distribution (1102 gaps):

Gap Count
≤ 1 s 630
2–5 s 118
6–15 s 238
16–60 s 97
> 60 s 19

Four consecutive spawns for the same cwd, ~90 ms apart, each preceded by a fresh
command-runner launch (paths redacted):

12:35:47.665 codex.exe] setup refresh: spawning …codex-windows-sandbox-setup.exe (cwd=C:\work\<projA>, payload_len=3832)
12:35:47.748 codex.exe] setup refresh: spawning …codex-windows-sandbox-setup.exe (cwd=C:\work\<projA>, payload_len=3832)
12:35:47.837 codex.exe] setup refresh: spawning …codex-windows-sandbox-setup.exe (cwd=C:\work\<projA>, payload_len=3832)
12:35:47.928 codex.exe] setup refresh: spawning …codex-windows-sandbox-setup.exe (cwd=C:\work\<projA>, payload_len=3832)

The repeating unit that precedes each spawn is always the same five lines:

codex.exe] helper copy: reused command-runner source=… destination=…\.sandbox-bin\codex-command-runner-0.151.0-alpha.7.2.exe
codex.exe] helper launch resolution: using copied command-runner path …
codex-command-runner-0.151.0-alpha.7.2.exe] hide users: failed to hide current user profile dir (C:\Users\Default): SetFileAttributesW failed for C:\Users\Default: 5 (access denied)
codex.exe] START: …\.sandbox-bin\codex.exe --codex-run-as-fs-helper
codex.exe] setup refresh: spawning …codex-windows-sandbox-setup.exe (cwd=…, payload_len=3832)

Impact

Each elevated spawn raises a UAC consent prompt on the interactive desktop. At the
observed rates (peak 41 spawns/minute; 630 of 1102 gaps under one second) the machine
becomes effectively unusable for the human at the keyboard — typing into other
applications is repeatedly interrupted for hours. We did not instrument the prompts
themselves, so we report the spawn count as measured and the prompt count only as
"one consent per elevated spawn" by mechanism, not by direct count.

Switching to [windows] sandbox = "unelevated" reduced setup-helper spawns to 0
across three subsequent verification runs (measured on four independent observation
paths over 31 minutes), confirming the elevated path as the source.

codex doctor --json reports checks.sandbox.helpers.status = "ok",
summary = "sandbox configuration is readable" throughout — the diagnostic does not
surface the loop.

Secondary observation

hide users: failed to hide current user profile dir (C:\Users\Default): SetFileAttributesW failed … 5 (access denied) occurs 1094 times, essentially once
per spawn. C:\Users\Default is a system-owned hidden profile template; the runner
appears to attempt an attribute change it will never be permitted to make from a
non-elevated context. It does not abort the run, but it is a per-command failed
privileged operation and may share a root cause with the unconditional refresh.

Relationship to existing reports

Filed separately because the observed mechanism differs from the nearby reports:

Full log excerpts and per-cwd breakdowns available on request.

Activity

  1. added
    bug
    CLI
    windows-os
    exec
    sandbox
    on Sep 2, 2026
  2. github-actions commented on Sep 2, 2026

    @github-actions
    Contributor
  3. Spongert commented on Sep 13, 2026

    @Spongert

    I just want to confirm that this issue is still persistent exactly as described by the starter in codex-cli 0.154.0. I just started to use multi-agent setups using agents.md when this started to happen. Because of this I had to switch to a different codex client (not using the NPM version, according to the CLI itself) which has now introduced this issue.

    It becomes impossible to do anything else on the machine, while a prompt is running.

  4. lvasko commented on Oct 8, 2026

    @lvasko

    I can confirm this issue is still reproducible with Codex CLI 0.161.0 on Windows 11, using the managed app-server daemon.

    Environment:

    • Codex CLI: 0.161.0
    • Managed app-server daemon: 0.161.0
    • App-server version: 0.161.0
    • PowerShell: 7.6.6
    • Configuration:
      [features]
      experimental_windows_sandbox = true
      
      [windows]
      sandbox = "elevated"

    Observed behavior:

    codex-windows-sandbox-setup.exe is repeatedly launched, causing recurring Windows UAC elevation prompts.

    The sandbox setup marker exists and is readable:

    • setup_marker.json version: 5
    • Current user has Full Control permissions.
    • The marker was successfully updated on October 8, 2026.

    The sandbox log repeatedly shows successful setup operations:

    [12:05:38.437 codex.exe] setup refresh: spawning ...codex-windows-sandbox-setup.exe
    [12:05:38.540] setup refresh: processed 2 write roots (read roots delegated); errors=[]
    [12:05:38.540 codex-windows-sandbox-setup.exe] setup binary completed
    
    [12:05:46.470 codex.exe] setup refresh: spawning ...codex-windows-sandbox-setup.exe
    [12:05:46.586] setup refresh: processed 2 write roots (read roots delegated); errors=[]
    [12:05:46.586 codex-windows-sandbox-setup.exe] setup binary completed
    
    [12:05:47.843 codex.exe] setup refresh: spawning ...codex-windows-sandbox-setup.exe
    [12:05:47.956] setup refresh: processed 2 write roots (read roots delegated); errors=[]
    [12:05:47.956 codex-windows-sandbox-setup.exe] setup binary completed
    

    Some repeated setup operations originate from the managed daemon working directory (.codex\app-server-daemon\workdir).

    Expected behavior:

    Successful sandbox initialization should not trigger another elevated setup operation for every subsequent command when the sandbox configuration and write roots have not changed.

    This appears to be the same unconditional refresh behavior described in this issue, now confirmed on version 0.161.0.

    The repeated UAC prompts significantly disrupt interactive use of Codex CLI.

  5. removed
    exec
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugperformancesandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions