Windows: each `codex.exe --__codex-windows-mxc` launch leaves ~395 BfsS/BfsG kernel pool allocations (bfs.sys, via Appinfo) that are not released after the launcher exits; long uptime ends in `CreateProcessSecurityEnvironment failed (0x800705AA)`
Summary
On Windows 11 25H2, every MXC sandbox launch by the Codex desktop app is followed, within about a second, by roughly 395 paged-pool allocations tagged BfsS/BfsG, made in the context of the Appinfo service (svchost) with bfs.sys on the stack. The MXC launcher processes live 0.4–1.7 s, but 170–350 s after they exited, only 0.5–1.5% of those allocations had been freed. With several Codex threads running all day, the outstanding count grew steadily; after 5.7 days of uptime the Codex browser tool could no longer start:
MXC launcher: failed to create the process security environment:
CreateProcessSecurityEnvironment failed (HRESULT = 0x800705AA)
(0x800705AA = ERROR_NO_SYSTEM_RESOURCES.) Physical RAM and commit were not exhausted at the time (6–7 GB RAM free, ~55–65 GB commit free). A reboot cleared it. The legacy restricted-token sandbox (codex sandbox -- cmd /c exit) kept working throughout.
We have not established the root cause. We are reporting the measurements so the team can check the lifecycle and cleanup of MXC security environments.
Environment
- Windows 11 Home 25H2, build 26200.9711 (x64), laptop with 32 GB RAM
bfs.sys10.0.26100.8875;appinfo.dll10.0.26100.8875- Codex desktop (MSIX)
OpenAI.Codex_26.1016.8120.0; bundled CLIcodex-cli 0.163.0-alpha.11.1 [windows] sandbox = "unelevated"in config.toml- Usage pattern: several long-running Codex threads using the browser tool continuously (24/7)
What we observed
Before the reboot (5.7 days of uptime), at the time of the failure:
| Pool tag | Outstanding allocations | Bytes |
|---|---|---|
| BfsS | 17,061,551 | ~955 MB |
| BfsG | 8,530,763 | ~546 MB |
| Toke | ~689,000 | ~1,498 MB |
| (paged pool total) | ~6.8 GB |
Read with NtQuerySystemInformation(SystemPoolTagInformation) (non-admin); sizes in decimal MB/GB.
After the reboot, sampled every 10 minutes: BfsS+BfsG grew at about 9–10 MB per hour, about the same rate as before the reboot, while the Codex threads were working.
Kernel trace (WPR, System keywords ProcessThread + Loader + Pool, stacks on PoolAllocation; 371 s, 7.9 M events, 0 lost; converted with tracerpt):
- BfsS + BfsG: 14,261 allocations, 200 frees, net +14,061 in 371 s.
- 99.9% of these allocations were made in the context of one svchost process whose only service is Appinfo; stack modules
ntoskrnl.exe > bfs.sys > ntoskrnl.exe. - 48
codex.exe --__codex-windows-mxcprocesses appear in the trace; 35 started and ended inside it (processes matched by UniqueProcessKey). Each lived 0.4–1.7 s. - Appinfo's BfsS/BfsG allocations occur in bursts aligned with MXC launches, about 262 BfsS + 131 BfsG ≈ 395 per launch (when two or three launches fall within the same few seconds the burst is 790 / 1,188). No bursts were seen between launches.
- For those 35 short-lived launchers, 0.5–1.5% of the allocations in their burst were freed by the end of the trace, 170–350 s after the launcher had exited.
- In a separate 50 s trace, the same pattern held (4 launches → 1,571 Appinfo BfsS/BfsG allocations, 8 freed).
- Rough cost per launch in that trace: 262 × 56 B + 131 × 64 B ≈ 22.5 KiB of paged pool (observation from one trace, not a constant).
Controls:
- 100 ×
codex sandbox -- cmd /c exit(legacy restricted-token sandbox): no BfsS/BfsG increase beyond background. - Plain process creation (600 ×
cmd /c exit, 300 ×git statusfrom Python): no measurable BfsS/BfsG change.
What we do not know
- What the MXC "process security environment" object is, how many environments were actually created (we counted launcher processes and allocation bursts, not environments), and what its intended lifetime is.
- Whether Codex is expected to call a release/close API that it does not call, whether the environment is supposed to be torn down when the launcher exits or when a longer-lived owner exits, or whether this is a Windows (Appinfo/bfs.sys) issue.
- Whether some other component (we have third-party network/VPN filter drivers installed) keeps these entries alive.
- Whether the BfsS/BfsG exhaustion is the specific resource behind the 0x800705AA, or only correlated with it.
- We did not test closing the Codex desktop app to see whether the entries are released then.
Request
Could the team check:
- The lifecycle and cleanup of MXC security environments on Windows, including the success path, partial-failure path and process termination, and what should release the Appinfo/bfs.sys state.
- Whether this reproduces with repeated short MXC launches on a clean machine (net BfsS/BfsG allocations after each batch, waiting a few minutes between batches).
We can share a de-identified excerpt of the trace analysis (event counts, timings, stack module chains) on request; the raw trace contains local paths and command lines, so we are not attaching it publicly.
Also observed (probably unrelated, not established)
Over the same period the Toke pool tag also grew (~50–140 outstanding per minute, varying with load). In our trace its growth was not concentrated around MXC launches, and plain process creation and the legacy sandbox did not reproduce it, so we do not attribute it to MXC. We mention it only because both counts were high when the failure occurred. The Toke growth looks similar to what is described in #31212.
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #55046
Powered by Codex Action
Same growth here, measured per launch on Windows 11 Pro for Workstations 26H2, build 26300.9711 (x64), bfs.sys 10.0.26100.8115, Codex desktop MSIX 26.1021.3705.0. config.toml says [windows] sandbox = "elevated", but the desktop starts its app-server and exec-server with -c features.prefer_mxc=true, and ~/.codex/.sandbox/sandbox.<date>.log shows Windows sandbox selection: mxc for the desktop (elevated for codex exec).
Method: NtQuerySystemInformation(SystemPoolTagInformation), non-admin, cumulative allocs/frees per tag, read before and after a desktop chat that ran 5 separate shell commands (whoami returned the user's own account, so MXC rather than the sandbox user). Launches were counted from Microsoft-Windows-AppModel-Runtime/Admin events 39/41 (Sandbox.{GUID} created/deleted). That gave 8 MXC launches in 55 s: the chat's 5, plus 3 from the desktop's automatic ambient-suggestions thread right after.
| Tag | Before (since boot) | After 8 launches |
|---|---|---|
| BfsS | 24 allocs, 1 freed | 1,110 allocs, 49 freed |
| BfsG | 0 | 519 allocs, 0 freed |
| BfsN / BfsT / Bfsg | — | +66 outstanding each |
| all Bfs* outstanding | 53 (4,304 B) | 1,808 (113,696 B) |
That is ~219 allocations / ~13.4 KiB per launch left outstanding (vs ~395 / 22.5 KiB in this report), BfsS:BfsG ≈ 2:1 as here. The last launch alone added 132 BfsS + 63 BfsG. Only 6 more were freed over the next 5 minutes. Other Bfs tags churned and were fully freed (BfsC +9,284, Bfsb 694, BfsP 527).
Before the test, after 2 days of uptime with hundreds of elevated-sandbox codex exec commands a day, BfsS had 24 allocations and BfsG none. So on this machine the growth comes only from MXC launches. The Sandbox.{GUID} profile that every Codex process start creates and deletes within ~30 ms (the MXC availability check) did not allocate them either.
The leftover AppContainer directories from the same test are posted on #55046.
Additional recurrence and recovery evidence from the same Windows host. This strengthens the cumulative-lifecycle/resource-exhaustion hypothesis and distinguishes the failure from an application update trigger.
Environment
- Windows 11 Pro 26H2, build 26300.9711, x64.
- Codex package active when the failure began: 26.1021.3705.0.
- Package 26.1023.6123.0 was staged but not yet active at failure onset.
- The system had been up for 68 h 39 min since the preceding Windows restart.
Abrupt success-to-failure boundary
In one affected turn, 151 command-execution attempts were recorded. The first 147 launched successfully. The last successful command completed at 2026-10-28 04:48:11.355 UTC. The first launcher failure appeared at 04:48:14.233 UTC, only 2.878 seconds later:
MXC launcher: failed to create the process security environment:
CreateProcessSecurityEnvironment failed (HRESULT = 0x800705AA)
The failure occurred before the requested child process started. Subsequent trivial, source-free probes failed identically, so the condition was not tied to project content, command syntax, PowerShell, or a particular file.
This was the second observed occurrence with the same abrupt boundary. In the preceding occurrence, 1,611 launches in an affected turn succeeded before the first 0x800705AA failure appeared only 134 ms after the last success. Eight subsequent launcher attempts failed. These counts cover the individual turns only, not the much larger system-wide MXC launch total accumulated across chats since boot.
Update and recovery sequence
- The newer package had only been staged before the failure; the older package remained active at onset.
- At 08:37 local time, package 26.1023.6123.0 was registered and the Codex sandbox service was replaced/restarted.
- A source-free probe at 08:39 still failed with 0x800705AA on the new package.
- Windows was restarted at 08:43.
- A source-free probe at 08:44 succeeded with exit code 0, and normal command execution resumed.
Therefore, an in-place app update and sandbox-service replacement did not release the exhausted state, while a full Windows restart did. Windows Resource Exhaustion Detector recorded no matching event during the failure window, and there was no evidence that global physical memory or commit exhaustion was the immediate trigger.
Interpretation
The sudden onset after many successful launches is consistent with a threshold being crossed in a cumulative per-launch resource leak. The persistence across an app-package/service replacement and immediate recovery after reboot further suggest that the retained state is below the chat and desktop-service lifetime, consistent with the Appinfo/bfs.sys BfsS/BfsG observations in this issue. This does not by itself prove whether cleanup responsibility belongs to Codex/MXC or Windows, but it provides a reproducible lifecycle boundary and a second recurrence on the same host.
Third recurrence on the same host, now on desktop 26.1027.3384.0; only a Windows reboot recovered MXC
This is a further recurrence of the same 0x800705AA failure on the host from my previous comment. It adds evidence that the condition persists in a newer Codex desktop package and again survives both an application restart and a sandbox-service restart.
Environment
- Windows 11 Pro 26H2, build
26300.9711, x64 bfs.sys10.0.26100.8115- Codex Desktop AppX
26.1027.3384.0 - Previous Windows boot: approximately
2026-10-28 08:43Europe/Bucharest - Failure onset: approximately
2026-11-02 01:50Europe/Bucharest, after about 4 days 17 hours of uptime - Recovery reboot:
2026-11-02 08:11:21Europe/Bucharest
Failure and recovery sequence
-
A long-running local task had been launching sandboxed commands normally. A later read command suddenly failed before the child process started:
MXC launcher: failed to create the process security environment: CreateProcessSecurityEnvironment failed (HRESULT = 0x800705AA) -
Two source-free control launches requesting Python child exits
0and2both failed immediately with launcher exit code1; neither child process started. -
The Codex application was fully closed and reopened. At
2026-11-02 06:04:58Z, the same two source-free probes still failed identically. -
The Windows service
CodexSandboxService.OpenAI.Codexwas found stopped. It was started successfully, but the affected desktop-chat execution route continued to return the same0x800705AAerror. -
A CLI execution path with the same restricted permission intent and PowerShell executable continued to launch commands. This again separates the desktop MXC route from general Python, PowerShell, project-file, or command-syntax failure. The exact sandbox implementation used by each route may differ, so this is supporting isolation evidence rather than a claim that both paths used the same MXC environment.
-
Immediately before reboot, the host still reported approximately 3.5 GB free physical memory and 10 GB free virtual memory. Windows Resource Exhaustion Detector produced no matching event. Thus no ordinary global RAM/commit exhaustion was evident.
-
Windows was rebooted at
2026-11-02 06:11:21Z. -
At
06:17:29Z, the exact same affected task reran one exit-0and one exit-2probe. Both launchers started and both expected child exits were observed. No task migration, permission-profile change, application reinstall, or project-file change was needed.
Additional value relative to the previous recurrence
- The failure remains reproducible on the newer desktop package
26.1027.3384.0. - It recurred after another multi-day uptime interval on the same host.
- Restarting the desktop app did not recover it.
- Starting/restarting the Codex sandbox service did not recover it.
- A full Windows reboot immediately restored process creation in the same task.
This is consistent with the cumulative MXC/Appinfo/bfs.sys lifecycle hypothesis already documented in this issue: the retained state appears to survive the desktop and sandbox-service lifetimes but is cleared by a Windows reboot. It still does not establish whether cleanup responsibility belongs to Codex/MXC or Windows.
No private task content, paths, or project data are included. The failed probes produced no file writes.
A Microsoft MXC issue may be related to this report:
Both reports observe BfsS and BfsG paged-pool allocations associated with MXC/ProcessContainer environments that are not reclaimed after the environment or launcher exits. The MXC issue isolates a leak per filesystem grant, while this Codex report measures the aggregate allocations per launch and a later 0x800705AA resource-exhaustion failure. This correlation does not establish that the leaked filesystem grants are the sole cause of the eventual launcher failure or that every measured allocation has the same origin.
Drafted with GitHub Copilot assistance.
Fourth recurrence on the same host, now on desktop 26.1103.4239.0; app termination did not recover MXC, Windows reboot did
This is a fourth observed recurrence of the same CreateProcessSecurityEnvironment failed (HRESULT = 0x800705AA) condition on the Windows host described in my previous comments. It adds evidence from a newer Codex desktop/runtime release and another multi-day uptime interval.
Environment
- Windows 11 Pro 26H2, build
26300.9711, x64 bfs.sys10.0.26100.8115- Codex Desktop AppX
26.1103.4239.0 - Active desktop runtime at the failed probes:
26.1104.2876.0 - Windows boot before failure:
2026-11-02 08:11:21Europe/Bucharest - Recovery reboot:
2026-11-08 10:36:34Europe/Bucharest, after about 6 days 2 hours of uptime
Failure and recovery sequence
-
A local desktop task that had previously launched commands successfully could no longer start even source-free child-process checks. Two control probes requesting Python child exits
0and2both failed immediately with launcher exit code1before Python started:MXC launcher: failed to create the process security environment: CreateProcessSecurityEnvironment failed (HRESULT = 0x800705AA) -
The Codex/ChatGPT desktop application was closed, remaining processes were terminated through Task Manager, and the application was reopened. The new app processes used the newer active runtime above, but the same two source-free probes still failed identically in the same affected task.
-
At that point the Windows service
CodexSandboxService.OpenAI.Codexwas stopped with service exit code1067. Service Control Manager event7034recorded that the service terminated unexpectedly at the time the desktop processes were force-terminated. I am including this only as lifecycle context, not as a claimed root cause; in the previous recurrence, starting the service did not restore MXC. -
Immediately before reboot, the host still reported approximately 2.9 GB free physical memory and 5.0 GB free virtual memory. Windows Resource Exhaustion Detector had no event
2004in the preceding 24 hours, so ordinary global RAM/commit exhaustion was not evident. -
Windows was rebooted at
2026-11-08 08:36:34Z. The sandbox service returned automatically inRunningstate with exit code0. -
At approximately
08:38Z, the exact same affected task, with the same restricted permission profile, reran the source-free controls. The exit-0child returned0, and a checked exit-2control confirmed the child's actual exit was2. No task migration, profile change, reinstall, or project-file change was required. The task then resumed normal command execution.
Additional value relative to the prior recurrence
- The condition persists on desktop
26.1103.4239.0with runtime26.1104.2876.0. - It recurred after another approximately six-day uptime interval.
- Fully terminating and reopening the desktop app, including activating a newer runtime, did not release the failed MXC state.
- A full Windows reboot immediately restored child-process creation in the same task.
This remains consistent with the cumulative MXC/Appinfo/bfs.sys lifecycle hypothesis in this issue and the related Microsoft MXC report. It still does not prove whether cleanup responsibility belongs to Codex, MXC, or Windows.
No private task content, local paths, project identifiers, or file data are included. The failed and recovery probes performed no project-file reads or writes.
Hi everyone, this first bit was written by me; the rest is LLM generated. I've been experimenting with using Codex to do many, many calls (tens of thousands) for a project evaluating how to improve LLMs' ability to solve coding problems if we give them a little "nudge". I kept running into issues, so I got Claude on to the case, and below is what it found. Hope that it is of help to anyone in a similar position.
Everything below was written by Claude
We hit this twice in one day, and the numbers point to a fixed limit per boot rather than memory running out. Windows 11 25H2 (build 26200), Codex CLI 0.172.0 with windows.sandbox = "mxc".
What runs out. Each MXC launch creates a new Sandbox.{GUID} AppContainer. Each new AppContainer takes a kernel lowbox-number entry (pool tag SeLs) that is not freed before a reboot, as described in microsoft/mxc#1486. Once about 65,400 MXC launches have happened since boot, CreateProcessSecurityEnvironment fails with 0x800705AA. With the entries other apps hold, that fits a 16-bit limit of 65,536; mxc#1486 reports the failure "near ~64K".
Evidence from our machine.
SeLsoutstanding was 65,963 while every launch was failing, and 114 after a reboot.- The second failure came 7 h 20 min after a reboot, after about 65,400 MXC launches: 32,904
phase=spawnlines in%USERPROFILE%\.codex\.sandbox\sandbox.*.log, plus about 32,500 fromcodex debug prompt-inputruns whose Codex home we deleted (3 each, as measured in a home we kept). The first failure, counted from when MXC was first set up on the machine the day before, came after a similar number. BfsSandBfsGtogether held about 127 MB of paged pool while it was failing, so pool size was not the limit here.- The figures in the original report fit the same limit: 17,061,551
BfsSat 262 per launch and 8,530,763BfsGat 131 per launch both come to about 65,100 launches.
Leftover profiles. Once launches fail, each failed launch leaves its Sandbox.{GUID} profile behind (a registry mapping and a folder under %LOCALAPPDATA%\Packages). We had about 79,000 within a day. Before the limit is reached they are cleaned up normally. They do not cause the failure: after a reboot the sandbox worked with about 26,000 of them still present.
A Codex-side multiplier. Our workload was about 34,000 short codex exec calls with the shell tool and other tools disabled. With a custom deny-by-default permissions profile, every session start made 3 MXC launches (kind=fs_helper). With the built-in :read-only, :workspace or :danger-full-access profiles it made none, and under :read-only the rendered prompt was the same apart from per-request ids. With a render before each call, that came to 6 sandboxes per call and a reboot every few hours. Doing those start-up reads without a sandbox, or reusing one AppContainer per session, would make the limit much harder to reach.
Workaround. For sessions that run no tools, use a built-in profile, for example -c default_permissions=":read-only". Check SeLs and reboot before it nears 65,536. This thread and mxc#1486 report that restarting the sandbox service or AppInfo does not free the entries.
Reading SeLs without poolmon (64-bit Python, no elevation)
import ctypes, struct
# SystemPoolTagInformation (class 22), as poolmon reads it; 64-bit Python, no elevation needed.
buf, got = ctypes.create_string_buffer(1 << 22), ctypes.c_ulong()
status = ctypes.WinDLL("ntdll").NtQuerySystemInformation(22, buf, len(buf), ctypes.byref(got))
assert status == 0, hex(status & 0xFFFFFFFF)
for i in range(struct.unpack_from("<I", buf.raw, 0)[0]):
off = 8 + 40 * i # 40-byte SYSTEM_POOLTAG entries after an 8-byte header
if buf.raw[off:off + 4] == b"SeLs":
allocs, frees = struct.unpack_from("<II", buf.raw, off + 4)
print("SeLs outstanding:", (allocs - frees) & 0xFFFFFFFF)