Skip to content

Windows sandbox setup refresh fails with os error 32 (sharing violation) on running node_repl.exe — structural start-order conflict between cua_node runtime and ACL validation #52501

Open

Description

@pinkMing

Environment

OS: Windows 11 (Chinese locale, error messages localized)
Codex Desktop App (ChatGPT.exe / Electron, multi-process)
Sandbox mode: [windows] sandbox = "elevated" in ~/.codex/config.toml
App version:
Workspace on E: (NTFS), trusted project

Summary
Every setup refresh on Windows fails with a sharing violation when it tries to apply a root-only ACL update to the computer-use runtime binary:
runtimes\cua_node\3dd31cfff853001c\bin\node_repl.exe
runtimes\cua_node\3dd31cfff853001c\bin\node_modules@oai\sky\bin\windows\swift\x64\VCRUNTIME140_1.dll
The ACL update requires an exclusive handle on the file, but the cua_node runtime (node_repl / computer-use MCP helper) is always started before the sandbox setup refresh runs. The binary is therefore already executing, and the ACL write gets os error 32 (ERROR_SHARING_VIOLATION, "another program is using this file").
This is a structural ordering problem, not a transient race: the helper processes must be running before any tool call can trigger a setup refresh, so the conflict reproduces on 100% of setup refreshes under this configuration.
Observed evidence (single day, 2026-10-09)
From ~/.codex/.sandbox/sandbox.2026-10-09.log (log lines shown with username redacted):

172 occurrences of the os error 32 sharing violation
50 of 50 setup refresh runs "completed with errors" — zero clean runs all day
100 setup error: setup refresh had errors entries; 47 exited with status ExitStatus(1)
Affected files: node_repl.exe (majority) and VCRUNTIME140_1.dll (from @oai/sky's bundled Swift runtime)
The runtime directory was re-provisioned at 10:00 local time; the first failure followed at 10:01:09

Sample log lines:
[2026-10-09T08:07:27.329624300+00:00] runtime read/execute validation failed: validate runtime read/execute access on
C:\Users<user>\AppData\Local\OpenAI\Codex\runtimes\cua_node\3dd31cfff853001c\bin\node_repl.exe:
open ACL target for root-only update: 另一个程序正在使用此文件,进程无法访问。 (os error 32)

[2026-10-09T08:46:30.620207+00:00] setup refresh: processed 4 write roots (read roots delegated);
errors=["runtime read/execute validation failed: ... node_repl.exe: open ACL target for root-only update: ... (os error 32)"]

[2026-10-09T08:46:30.630 codex.exe] setup refresh: exited with status ExitStatus(ExitStatus(1))
(Localized message = "The process cannot access the file because it is being used by another process.")
User-visible impact: a repeating setup failure loop; sessions fail to refresh the UI ("page doesn't refresh") until the error storm subsides. Not every validation failure escalates to a fatal setup error — some runs log the validation failure but continue — which makes the symptom intermittent from the user's perspective.
Control experiment: full restart does NOT fix it
To rule out a stale/orphaned process holding the lock:

Quit the app normally, then force-killed all related processes: ChatGPT.exe, codex.exe (including --codex-run-as-fs-helper), node_repl.exe, codex-computer-use.exe, codex-windows-sandbox-setup.exe
Verified no related processes remained
Cold-started the app and triggered tool calls (git commands) in a trusted workspace
Result: the first two setup refreshes (17:09:46 and 17:10:14 local) failed with the exact same node_repl.exe ... os error 32

This confirms the cua_node runtime is (re)started by the app itself before the sandbox setup refresh executes, so the ordering conflict is inherent to the current startup sequence.
Analysis

The codex-windows-sandbox-setup.exe "runtime read/execute validation" step attempts to open the runtime binaries for a root-only ACL update, which needs a handle mode incompatible with a running executable's image lock.
The runtime binaries are held open for execution by the long-running computer-use runtime / MCP server processes that the app starts first.
Therefore, under elevated sandbox mode with the cua_node runtime provisioned, validation of the runtime root can never succeed while the runtime is live.

Suggested fixes (any one of)

Perform the runtime ACL update before spawning the cua_node runtime processes (move it into the provisioning step).
Open the ACL target with WRITE_DAC without requiring exclusive file access — a security-descriptor update does not need to write file data and should not conflict with an executing image.
Treat "runtime binary currently executing" as a pass for read/execute validation (if it's running, the sandbox user can obviously read/execute it) instead of failing the whole setup refresh.
On os error 32 for the runtime validation target specifically, downgrade to a warning so a running runtime doesn't fail the entire setup.

Related

#29063 — recursive ACL rewrites touch every file's metadata (same elevated-sandbox ACL machinery; separate but adjacent symptom)
#33737 — elevated sandbox repeatedly scanning large directory trees (perf side of the same setup path; also mentions stale %TEMP% node-compile-cache slowing setup)

These together suggest the Windows elevated-sandbox setup path needs a redesign pass: avoid exclusive-handle requirements on live binaries, and avoid re-walking/validating large trees on every refresh.
Reproduction

Windows, ~/.codex/config.toml with [windows] sandbox = "elevated"
Let the app provision the cua_node runtime (%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node<hash>)
Open a trusted workspace and trigger any tool call (e.g. git status)
Observe ~/.codex/.sandbox/sandbox..log: runtime read/execute validation failed ... node_repl.exe ... (os error 32) and setup refresh completed with errors
Repeating step 3 reproduces it every time; full app restart does not help

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugcomputer-usesandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions