Windows elevated sandbox refresh stalls for >20 minutes with hundreds of deny ACEs and concurrent setup helpers
Summary
Windows sandbox permission refresh became effectively stuck before local commands could execute. Multiple codex-windows-sandbox-setup.exe processes accumulated, consumed CPU for many minutes, and repeatedly logged deny-write ACL updates against the same Codex home directory.
A read-only ACL inspection found 464 explicit deny entries covering 232 distinct SIDs on the Codex home directory. Tagged source suggests a possible amplification path when a protected directory does not overlap any transformed writable root: the helper applies a separate inheritable deny for every active writable-root capability SID.
The runtime symptoms and ACL counts below were observed. The proposed amplification mechanism is source-based analysis, not a confirmed sampled call stack or a clean-room reproduction.
Environment
- Windows 11 Pro, build 26300, x64.
- Codex CLI and managed app-server daemon: 0.167.0.
- Desktop package also present: 26.1103.3517.0.
[windows] sandbox = "elevated".- Affected local sessions used a managed restricted/workspace-write permission profile, with the user profile directory as the workspace and Codex configuration directories protected from writes.
- The global config also contained
sandbox_mode = "danger-full-access"; this was not the effective restricted profile shown for the affected sessions. The discrepancy is included to avoid implying that the global setting alone described the failing execution path. - Codex home is an ordinary directory, not a junction.
- Desktop and CLI processes were present concurrently.
Observed behavior
- Local shell calls stopped returning; a separate terminal also remained at “Resuming session…”. The desktop later reported that the target chat was open in another application. These were concurrent symptoms; a common cause for every UI symptom has not been established.
- At one inspection, seven sandbox setup helpers were present. Five long-running helpers remained at cleanup, with ages ranging from approximately 8 to 23 minutes and still-increasing CPU time.
- The daily sandbox log contained 718 lines matching:
This is the aggregate count in that day's log, not a count attributed to a single helper.applied deny ACE to protect C:\Users\<user>\.codex - Captured helper arguments showed numerous writable child paths under the user profile, with
.codexamong the deny-write carveouts. The raw arguments are intentionally not attached. - Read-only
Get-Aclinspection of%USERPROFILE%\.codexreturned:TotalRules: 468 ExplicitDenyRules: 464 DistinctDeniedSIDs: 232 Deny rule groups: 232 explicit entries, no inheritance flags 232 explicit entries, ContainerInherit | ObjectInherit AreAccessRulesProtected: False SDDL character length: 33177 - Both transcript JSONL segments for the affected conversation parsed successfully, with no invalid JSON lines.
- Executing the hook's no-Orca-environment exit path outside the stalled sandbox returned exit code 0 in approximately 16 ms. This only checks that exit path, not the full hook environment.
Additional sanitized log observations:
setup refresh: spawning ...\codex-windows-sandbox-setup.exe
failed to grant non-inheriting read-attributes ACE on user profile ...:
another process is using the file (os error 32); continuing setup
read ACL run completed
granting write ACE to <writable child> for sandbox group and capability SID
write ACE grant failed on <another child>: Access is denied. (os error 5)
applied deny ACE to protect C:\Users\<user>\.codex
... repeated over many minutes ...
The sharing/access-denied messages are included as context. They have not been isolated as the cause of the prolonged deny-ACL processing.
Source path worth investigating
Source pinned to rust-v0.167.0 / commit cb41599ccbe371272892f156286a236aa097bada:
workspace_write_cap_sids_for_path, setup_provisioning.rs: if no writable root overlaps a deny path, the fallback returns capability SIDs for all writable roots.- Deny-write processing loop: applies each SID separately and emits the repeated log line after a successful update.
add_deny_ace, acl.rs: constructs an inheritable deny ACE, then callsSetSecurityInfofor each SID separately.
Could repeated inheritable DACL updates on a populated Codex home, multiplied across writable-root SIDs and concurrent refresh helpers, account for this behavior? Please investigate batching, refresh coordination, and whether non-overlapping protected paths need this all-root fallback.
The observations do not establish an infinite loop or deadlock. A very expensive finite sequence of ACL updates is also consistent with what was observed.
Reproduction status
This is an affected-machine report, not yet a deterministic minimal reproduction.
Observed setup: use the Windows elevated sandbox with the user profile as a broad writable workspace, protect Codex configuration directories, and invoke local tools from concurrent CLI/desktop sessions. Inspect helper lifetime, CPU usage, repeated deny-ACL log entries, and the explicit deny rules on Codex home.
Mitigation and expected behavior
Terminating only the five long-running setup helpers reduced the remaining helper count to zero. No chat history or configuration was deleted or rewritten. This was cleanup, not proof of a permanent fix; a fresh ordinary restricted-sandbox command was not used to validate recovery.
Expected: refresh should finish in bounded time, avoid repeatedly propagating equivalent protection rules across a large directory tree, and surface actionable progress/failure rather than leave local tool requests waiting indefinitely.
Related reports
- #57200 — setup refresh before every shell command.
- #52566 — runtime sharing violations during setup refresh.
- #59730 — resume overrides ignored for an already-loaded thread.
- #60057 — setup failure in the same desktop package version, with a different observed ACL error.
This report concerns prolonged deny-write processing and accumulated setup helpers; the exact relationship to those reports remains to be established.
Privacy
Only sanitized observations are included. No raw logs, session IDs, account or machine names, private directory names, network addresses, credentials, or transcript attachments are uploaded.
OpenAI feedback submission succeeded via the installed Codex 0.167.0 feedback/upload API.
Uploaded feedback thread ID: 01a1b965-df31-74e2-b148-6a66de96817a
This is the ID returned by the successful upload. Codex's own external-user success UI explicitly asks users to mention this thread ID in an existing GitHub issue: feedback_view.rs, tagged 0.167.0.
Privacy scope: includeLogs: false; no automatic raw logs or conversation attachments were uploaded. The upload contains the sanitized Markdown diagnostic report from this issue. Before uploading, a local feedback/save preview was inspected and contained only report.json, the sanitized report attachment, and its manifest.
I've been reproing this every day for the past week. It is very frustrating.
I observed this on Codex CLI 0.170.0 on Windows with the elevated sandbox and %USERPROFILE% as the workspace. A simple Get-Command codex -All query waited for sandbox setup before PowerShell could run.
The refresh started at 17:31:25.710 and finished at 17:47:32.882 with 73 write roots and errors=[]. The sandbox log recorded 73 successful deny-ACE additions targeting %USERPROFILE%.codex. The first and last entries were 15m 24s apart. The helper eventually exited successfully.
Could the helper collect the missing deny entries for a protected path and commit them in one DACL update? Progress reporting during this phase would also make a slow refresh distinguishable from a hung command.
It is at the point now where I've given my dot instructions to try and mitigate this.
"... not start or use the Windows Codex sandbox, or any Dot action on the Windows PC that might start it. This includes shell commands, file reads and edits, diagnostics, Dot-driven Computer Use, retries, and delegating to a Windows-backed task as a workaround."
I encountered a similar issue on Codex CLI 0.171.0 and collected a symbol-resolved ETW CPU profile that provides additional evidence for the ACL propagation bottleneck described in this issue.
Environment
- Codex CLI: 0.171.0
- Windows 11, build 26200.9974
- CPU: AMD Ryzen 7 5800H (8 cores / 16 logical processors)
- Multiple concurrent Codex sessions, including subagents and Goal workloads
Observed behavior
- Codex CPU usage progressively increased, reaching approximately 77% of total CPU capacity.
- The issue recurred after terminating and restarting Codex.
- Even simple sandboxed shell commands timed out, leading to repeated retries and escalation requests.
- Seven threads in the affected Codex process were each consuming approximately one logical CPU during profiling.
ACL inspection
The DACL of %USERPROFILE%\.codex contained:
| Metric | Value |
|---|---|
| Total access rules | 1,233 |
| Explicit deny ACEs | 1,222 |
| Distinct denied SIDs | 611 |
| Binary DACL size | 44,368 bytes |
| DACL capacity utilization | 67.7% |
Denied SIDs present in the current cap_sid file |
34 |
Denied SIDs absent from the current cap_sid file |
577 |
Every denied SID had exactly two explicit deny ACEs. These entries were also inherited by child directories.
The 577 unmatched SIDs suggest that stale capability-related ACEs may be accumulating, although absence from the current cap_sid file alone does not establish that a SID is unused.
Symbol-resolved ETW profiling
I captured a 37.625-second ETW trace using WPR and analyzed it using Xperf. No ETW events or buffers were lost.
The symbol-resolved, PID-filtered stack report contained 162,371 hits.
| Function | Inclusive hits | Exclusive hits |
|---|---|---|
ntmarta.dll!SetSecurityInfo |
89.13% | 0.00% |
ntmarta.dll!MartaManualPropagation |
89.13% | 0.00% |
ntmarta.dll!MartaUpdateTree |
89.13% | 0.00% |
ntdll.dll!RtlpInheritAcl2 |
43.62% | 0.23% |
ntdll.dll!RtlpGenerateInheritedAce |
43.34% | 23.49% |
ntdll.dll!RtlpIsDuplicateAce |
6.46% | 2.59% |
ntdll.dll!memcmp |
16.62% | 16.50% |
ntfs.sys!NtfsModifySecurity |
19.87% | <0.01% |
These percentages are relative to the filtered stack report, not total system CPU utilization. Inclusive percentages overlap.
The report shows the following simplified Windows-side call tree:
codex.exe (unresolved symbols)
-> SetSecurityInfo
-> AccRewriteSetHandleRights
-> MartaManualPropagation
-> MartaUpdateTree
-> recursive MartaUpdateTree calls
-> CreatePrivateObjectSecurityEx
-> MartaSetFileRights
ACL inheritance generation, duplicate ACE checks, and NTFS security descriptor updates account for substantial portions of the sampled workload.
ETW stack collection itself also introduced measurable overhead (EtwpTraceStackWalk: 31.68% exclusive hits), which should be considered when interpreting the profile.
Mitigation
I backed up the existing configuration and DACL, switched the configured sandbox backend to MXC, and removed the 1,222 matching deny ACEs.
[windows]
sandbox = "mxc"
After closing the remaining Codex processes, I verified the ACL cleanup and reset the following legacy sandbox state by renaming the corresponding files and directories:
.sandbox.sandbox-bin.sandbox-secretscap_sid
After cleanup, the Codex home directory and the inspected sessions, plugins, and sqlite directories each had 11 access rules and zero deny ACEs.
The following sandboxed test command subsequently completed successfully:
codex sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo SANDBOX_OK
Output:
SANDBOX_OK
Exit code: 0
Since ACL cleanup and migration to MXC were performed together, I have not independently measured their effects or established long-term stability.
Suggested areas to investigate
- Batch missing ACEs into a single DACL update per protected path instead of applying each inheritable ACE separately.
- Investigate the lifecycle of capability SIDs and stale ACL entries.
- Avoid concurrent or redundant recursive ACL propagation against the same protected directory.
- Provide progress reporting during expensive sandbox permission refresh operations.
The ETW data supports the ACL propagation mechanism proposed in this issue. It does not establish an infinite loop or identify the exact Codex-side function initiating the updates.
Attachments
Sanitized ETW profiling evidence is attached for further investigation.