Windows desktop freezes while electron-sampler fails WMI process snapshots in sandbox
What version of the Codex App are you using?
Codex Desktop 26.506.3741.0 from the Windows MSIX package path:
OpenAI.Codex_26.506.3741.0_x64__2p2nqsd0c76g0
What platform is your computer?
Microsoft Windows [Version 10.0.26200.8457]
What issue are you seeing?
Codex Desktop repeatedly freezes/stalls for a few seconds during normal UI interaction, including sending a message, streaming a response, moving the app window, and resuming/opening threads.
This still happens after reinstalling Codex Desktop and after disabling a previously active heartbeat automation. It also reproduces when no custom pet/avatar is active, so this does not appear to be a custom pet rendering/cache issue.
The app logs repeatedly show electron-sampler failing to collect a child process snapshot. The command it runs uses PowerShell/WMI, and it fails inside the Codex Windows sandbox with access denied.
Representative redacted log excerpt:
warning [electron-sampler] Failed to collect child process snapshot
errorMessage="Command failed: powershell.exe -NoProfile -NonInteractive -Command
$ErrorActionPreference = 'Stop';
$cpuByPid = @{};
Get-CimInstance Win32_PerfFormattedData_PerfProc_Process |
ForEach-Object { $cpuByPid[[int]$_.IDProcess] = [double]$_.PercentProcessorTime };
Get-CimInstance Win32_Process |
Select-Object ProcessId,ParentProcessId,CommandLine,WorkingSetSize,
@{Name='CpuPercent';Expression={$cpuByPid[[int]$_.ProcessId]}},
@{Name='AgeSeconds';Expression={[int]((Get-Date) - $_.CreationDate).TotalSeconds}} |
ConvertTo-Json -Depth 2
"
Get-CimInstance : Zugriff verweigert.
Running the same WMI checks from a normal user PowerShell session succeeds. Running them from the Codex sandbox user fails. The sandbox command context reports the user as:
<HOST>\CodexSandboxOffline
The local Windows groups Leistungsüberwachungsbenutzer / Performance Monitor Users and Leistungsprotokollbenutzer / Performance Log Users were empty, which likely explains why CodexSandboxOffline cannot read those WMI classes.
Additional observations
The same sessions also show long thread/resume / metadata operations around the freezes, for example:
method=thread/resume conversationId=<redacted> durationMs=58400 errorCode=null
method=thread/goal/get conversationId=<redacted> durationMs=58558 errorCode=-32600
error={"code":-32600,"message":"goals feature is disabled"}
method=thread/metadata/update conversationId=<redacted> durationMs=47839 errorCode=null
That may be separate from the sampler issue, but both show up around the observed stalls.
Related: #21774 mentions later sampler warnings after a Windows desktop restart, but this issue is specifically about recurring UI freezes/stalls while electron-sampler repeatedly fails WMI process snapshots from the Windows sandbox context.
Steps to reproduce / local checks performed
- Start Codex Desktop on Windows with the default/elevated Windows sandbox configuration.
- Use the app normally: open/resume threads, send a message, move the window, wait for a streamed response.
- Observe repeated short UI freezes.
- Check Codex logs under
%LOCALAPPDATA%\Codex\Logs. - Observe repeated
electron-samplerwarnings with the WMIGet-CimInstancecommand above. - Verify that the same WMI command succeeds outside Codex's sandbox but fails from the sandboxed
CodexSandboxOfflinecontext.
Expected behavior
Codex Desktop should not freeze because a diagnostic/sampling command cannot access WMI process counters from the sandbox. If WMI access is unavailable, the sampler should either skip that data source, handle access denied cheaply, or avoid running the command from a sandbox token that lacks the required rights.
Actual behavior
The app repeatedly attempts the WMI process snapshot from the sandboxed context, logs access-denied failures, and the desktop UI freezes/stalls intermittently.
6 Comments
Still reproducible on Codex Desktop 26.707.9981.0 on Windows 10.
Symptoms: the desktop UI intermittently stalls for several seconds, including keyboard input lag. Other apps remain responsive. Especially after returning to working with its window after a time.
Codex logs repeatedly show:
[electron-sampler] Failed to collect child process snapshot
The failing sampler invokes PowerShell Get-CimInstance Win32_Process / Win32_PerfFormattedData_PerfProc_Process.
At the time of sampling, Codex was not under sustained local load:
Same symptom on Windows 11 ARM64, native arm64 build (not emulated).
Adding quantified data since this thread lacks measurements.
Environment
Measured behavior (0.6s sampling, 100 samples, repeated 3x)
Responding=Falsefor 32-40% of wall time(not blocked on another process or lock)
Control test (same time window,
Responding=Falserate)ChatGPT.exe 32% | chrome 0% | explorer 0% | claude 0%
-> Codex-specific, not a system-wide stall.
Re: the WMI/electron-sampler root cause in this issue
I confirmed
CodexSandboxOfflineandCodexSandboxOnlineexisted on mymachine and that
Performance Monitor Userswas empty. I added bothaccounts to that group, fully restarted, and re-measured:
before: 32% / 38% after: 40%
No improvement. The
electron-samplerWMI failure also appears only2x in my logs, which does not match the ~14s freeze cycle. So the WMI
access-denied issue may be a symptom rather than the root cause here.
Separate but concurrent defect: runtime distribution is broken
install-primary-runtimeretries every 30s forever:Failed to download primary runtime manifest (404 Not Found)"Could not reinstall Codex dependencies"
Ruled out (no effect)
GPU compositing disabled, plugins disabled, right panel/browser closed,
MCP servers removed (npx-based slack), OneDrive (not running, 0 placeholders),
Defender (0% CPU during hang), DNS/network (22-453ms; main process holds
no sockets), settings reset, reinstall, reboot.
Note: editing
[windows] sandboxinconfig.tomlis futile — the appappends the key back at the end of the file on every launch, and it is not
exposed in the settings UI.
Reproduced on Codex Desktop 26.715.4045.0, Windows x64 (MSIX), with an additional user-visible symptom: a PowerShell console window briefly appears on the desktop and can steal focus during normal Codex use.
Local evidence
ChatGPT.exe(Codex Desktop main process) →powershell.exe→conhost.exe.Get-CimInstance Win32_PerfFormattedData_PerfProc_Processfollowed byGet-CimInstance Win32_Processand JSON conversion.[electron-sampler] Failed to collect child process snapshotwarnings containing that exact command.No supported local configuration switch for this sampler was found. I did not modify the signed app package, replace PowerShell, alter
PATH, or add broad system restrictions.Expected handling
On Windows, the sampler's PowerShell child should be created with
windowsHide: true/CREATE_NO_WINDOW(or replaced with a console-free API). If WMI access repeatedly fails, sampling should degrade or stop instead of repeatedly creating a visible console host.Local usernames, paths, process IDs, thread IDs, and conversation content have been intentionally omitted.
Reproduced on Codex Desktop 26.715.7063.0, Windows x64 (MSIX) with bundled app-server 0.145.0-alpha.18.
This occurrence differs from the original access-denied case:
0x80041006/ "Not enough memory" after the WMI provider becomes resource-exhausted.WmiPrvSE.exestays at high CPU and the whole desktop becomes sluggish. Fully exiting Codex restores normal behavior.[electron-sampler] Failed to collect child process snapshotwarnings in about five minutes. The failing commands were the sameGet-CimInstance Win32_ProcessandWin32_PerfFormattedData_PerfProc_Processqueries reported above.taskkill.exeprocesses and matchingconhost.exechildren accumulated. The cleanup helpers were descendants of the mainChatGPT.exeprocess.Read-only inspection of the packaged desktop code shows a 30-second sampler heartbeat, additional active/focused sampling rate-limited to roughly five seconds, and a five-second timeout for the Windows WMI worker. The Windows process-tree cleanup path invokes
taskkill.exe /pid <pid> /t /f.The observed failure sequence is therefore consistent with a feedback loop:
This appears to connect the sampler failure reported here with the cleanup storms in #34025 and #34260.
Suggested handling: after repeated WMI failures, back off or disable process sampling for the session; also bound the concurrency and lifetime of Windows
taskkillcleanup helpers.Local usernames, paths, repository names, conversation IDs, and raw logs have been omitted.
Additional reproduction detail: a very large image-heavy thread appears to be a reliable trigger/amplifier for this WMI failure.
Thread characteristics
The affected Codex thread's local rollout file is 178.6 MB:
data:image/image_urlpayloads.From a separate healthy thread, requesting the affected thread's latest 10 turns produced an internal response of 87,124,454 bytes, exceeding the observed 67,108,864-byte IPC frame limit. Reading one turn at a time works until reaching the image-heavy turn.
This IPC limit was observed in the cross-thread inspection path, so it is not necessarily the desktop UI's exact message limit. It does, however, provide direct evidence that a normal history page for this thread has become abnormally large.
Reproduction pattern
WmiPrvSE.exethread count and CPU rise; the whole machine becomes sluggish.During a read-only investigation from another thread, a newly created WMI provider host grew from 11 to 233 threads before sustained CPU usage began. After terminating only that abnormal provider instance, Windows created a replacement with 10 threads and no
taskkill.exebacklog.Working interpretation
The large thread does not directly call WMI. The evidence suggests that thread rehydration/serialization and the associated local-tool/process activity create a trigger condition that the Electron process sampler then amplifies through repeated WMI process snapshots. Interrupted tool turns and process-tree cleanup may further amplify it.
This connects two failure modes:
The same task can be continued safely from its on-disk artifacts in a new clean thread; continuing to send messages in the oversized thread repeatedly reproduces the problem.
Suggested safeguards
No usernames, local paths, prompts, repository names, or image contents are included here.
thanks for the detailed reports and investigation here: they were really helpful 💖
26.730.7989.0that address some major sources of powershell/wmi stormstaskkill.execan still be started by other process-cleanup paths, and we’re continuing to work on reducing that separatelyif you’re still seeing sustained wmi cpu usage or system-wide lag after
26.730.7989.0, please share an updated/feedbackid