Windows elevated sandbox setup fails when `node_repl.exe` is running (OS error 32)

Aperta
#52,389 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

The failure comes from the Windows elevated sandbox setup helper, which logs an ACL validation on the node_repl.exe runtime under cua_node; the issue does not name the source file, so first locate where the helper opens ACL targets for the runtime root-only update. Reproduce by running a sandboxed codex exec while an interactive session holds node_repl.exe open. Done would mean setup succeeds with that executable in use, without weakening the sandbox ACL requirements.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug CLI mcp sandbox windows-os

Environment

  • Windows 11 Home, build 10.0.26300
  • windows.sandbox = "elevated"
  • Affected setup helpers:
    • npm CLI 0.160.1 (@openai/codex-win32-x64, codex-windows-sandbox-setup.exe)
    • App-server daemon 0.161.0 and 0.162.0
  • Codex runtime present at %LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\<hash>\bin\node_repl.exe, used by the node_repl MCP server

Observed behavior

Sandboxed Codex commands intermittently fail with:

helper_unknown_error: setup refresh had errors

The sandbox log (~/.codex/.sandbox/sandbox.<date>.log) reports:

runtime read/execute validation failed: validate runtime read/execute access on C:\Users\<user>\AppData\Local\OpenAI\Codex\runtimes\cua_node\<hash>\bin\node_repl.exe: open ACL target for root-only update: The process cannot access the file because it is being used by another process. (os error 32)

setup refresh completed with errors: [...]
setup error: setup refresh had errors
setup refresh: exited with status ExitStatus(ExitStatus(1))

The same refresh also reports a non-fatal OS error 32 while attempting to update an ACE on the user-profile directory.

Evidence

  • Examined 28 failed sandbox refreshes over approximately 24 hours. All 28 reported the same node_repl.exe file-sharing error.
  • The failures began when node_repl was first used on this machine (~/.codex/node_repl/ created at the time of the first failure), although the cua_node runtime had been installed about two weeks earlier. Approximately 1,060 earlier refreshes in the examined logs had no recorded errors.
  • Failures also occurred with codex exec --ignore-user-config, suggesting the behavior is not controlled solely by the user's [mcp_servers.node_repl] configuration.
  • The executable already had an inherited Modify permission for CodexSandboxUsers. The helper nevertheless failed while opening the target for its ACL operation.
  • In observed sessions, sandbox refreshes resumed succeeding after the sessions hosting node_repl.exe exited and that process terminated.

The relationship between process lifetime and failures is supported by observations and timestamps, but was not captured through simultaneous process and file-handle tracing.

Possible cause (unconfirmed)

The sandbox setup helper may be opening runtime executables with access or sharing flags incompatible with a running executable.

This could cause a Windows sharing violation (ERROR_SHARING_VIOLATION, OS error 32) during ACL validation or modification.

The exact file-opening flags and internal helper behavior have not been verified.

Expected behavior

Codex sandbox initialization should succeed while other Codex sessions are using Codex-provided runtime executables.

Potential fixes to investigate include:

  • Opening ACL targets with compatible sharing flags.
  • Avoiding unnecessary ACL operations when effective permissions are already sufficient.
  • Handling executable-in-use sharing violations without aborting setup, provided sandbox security requirements remain satisfied.

Suggested reproduction (inferred; not deliberately reproduced)

  1. Install or initialize the Codex runtime containing cua_node.
  2. Configure Windows elevated sandbox mode.
  3. Start an interactive Codex session that launches the node_repl MCP server, and confirm node_repl.exe is running.
  4. In another terminal, execute:
codex exec --ignore-user-config -c windows.sandbox="elevated" --sandbox workspace-write "Run git status."
  1. Sandbox initialization may fail with setup refresh had errors. Inspect ~/.codex/.sandbox/sandbox.<date>.log for the sharing violation on node_repl.exe.

Workaround

Exit interactive Codex sessions hosting node_repl.exe and wait for that process to terminate before dispatching another sandboxed Codex worker.

This has restored successful sandbox initialization in the observed cases.

Lingua principale
Rust
Stelle
131k
Fork
20.7k
Merge medio
1m
PR unite (30g)
997

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.