[Windows Desktop] electron-sampler retries failing Win32_Process snapshots indefinitely and can cause process buildup
Codex version
Windows Store desktop app 26.715.8383.0
Platform
Windows x64, build 10.0.19044
What issue are you seeing?
The Windows desktop app's electron-sampler repeatedly launches this PowerShell command and logs a failure:
$ErrorActionPreference = 'Stop'; Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Depth 2
The retry has no effective single-flight/backoff behavior. In a clean desktop session it recurs roughly every 10–20 seconds. During longer Agent/browser workloads, PowerShell/browser/cleanup children can accumulate until process queries slow down and the machine runs out of usable memory.
A representative warning is:
warning [electron-sampler] Failed to collect child process snapshot errorMessage="Command failed: powershell.exe -NoProfile -NonInteractive -Command ... Get-CimInstance Win32_Process ... ConvertTo-Json -Depth 2"
Steps to reproduce
- Launch the Microsoft Store Codex desktop app on Windows.
- Run a local Agent task (browser/Playwright work makes the impact easier to observe, but the sampler failure also occurs while otherwise idle).
- Inspect
%LOCALAPPDATA%\Codex\Logs\...\codex-desktop-*-t0-*.log. - Observe repeated
electron-samplerchild-process snapshot failures. - With a longer browser task, observe increasing PowerShell/browser/cleanup process pressure and eventually severe UI/memory degradation.
Diagnostics already performed
powershell.exeexists and resolves from PATH; current-sessionENOENTcount is 0.- PowerShell profiles are absent, so this is not a profile loop.
winmgmtis running and the WMI repository reports consistent.- The exact full snapshot command succeeds with
EXIT=0from an elevated command prompt. - From a standard-user prompt,
Get-CimInstance Win32_Process -ErrorAction Stopsucceeds and returned 473 rows. - The standard-user full Select/ConvertTo-Json pipeline returned exit code 1 with no stderr.
- The packaged desktop app still retries the failed command: a fresh session logged 8 failures in about 85 seconds, then continued increasing.
- A clean session had 0
taskkilland 0conhostlog references initially; those are observed only after heavier timed-out Agent/browser activity. - During a previous failure storm, WMI Operational event 5858 reported
0x80041032withThrottling Idle/stack Tasks in hitting Max Memory quotafor repeatedWin32_Processqueries. - The issue persisted across Windows restarts and Codex desktop restarts.
Expected behavior
The desktop app should collect the process snapshot successfully in its packaged/non-elevated context. If collection fails, it should be single-flight, use bounded exponential backoff, and ensure the exact child process is closed before retrying. Ideally this process-tree sampling should use a native Windows API rather than repeatedly spawning PowerShell/WMI.
Additional context
Issue #24913 contains the same electron-sampler warning in a different Windows desktop failure, and #17208 reports repeated PowerShell launches in the IDE extension. This report is focused specifically on the desktop sampler retry/process-buildup loop.
No project source, prompts, credentials, or private workspace data are included here.
1 Comment
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action