Repository navigation
Windows Desktop: unbounded taskkill.exe/conhost.exe cleanup storm exhausts WMI #34260
Description
Summary
Codex Desktop on Windows can enter an unbounded process-cleanup loop where hundreds of taskkill.exe processes remain alive, each with a corresponding conhost.exe. The accumulated taskkill instances repeatedly query Win32_Process, exhaust the WMI provider quota, and make the entire Windows UI sluggish or unable to launch new processes.
This is related to #17229 and #21957, but the leaking processes in this case are taskkill.exe themselves rather than only git.exe/conhost.exe or leaked stdout.
Environment
- Codex Desktop:
26.715.4045.0 - OS: Windows 25H2 x64, build
26200.8875 - RAM: 32 GB
- Installation: Microsoft Store/MSIX package
OpenAI.Codex_26.715.4045.0_x64__2p2nqsd0c76g0
Observed behavior
During normal local-agent use involving shell commands, cancellations, and command timeouts, process counts grew continuously.
Peak measurements:
taskkill.exe: 457 processesconhost.exe: 473 processes- total processes: 1,388
- total threads: over 14,000
- total handles: over 350,000
- WMI provider private memory: 720.5 MB
All sampled taskkill.exe instances had the Codex Desktop main process (ChatGPT.exe inside the OpenAI.Codex package) as their parent. Most excess conhost.exe instances were children of those taskkill.exe processes.
Windows Event Viewer recorded:
- WMI event 5612:
PrivatePageCountexceeded its 512 MB quota. - WMI event 5612:
ThreadCountexceeded its 256-thread quota. - WMI Activity event 5858: repeated
Win32_Processqueries failed with0x80041006and0x80041033. taskkill.execrashed with exception0xc0000005(Application Error event 1000 / Windows Error Reporting event 1001).
Killing the accumulated taskkill.exe processes immediately reduced the total process count from 1,388 to about 565, and WMI private memory fell from 720.5 MB to about 104 MB. However, while the original Codex process remained running, taskkill.exe counts grew again from 156 to 320 in 20 seconds.
Fully restarting/reinstalling Codex cleared the bad state. With the same app version reinstalled, the stable baseline was:
taskkill.exe: 0conhost.exe: 12- total processes: about 390
- WMI: 139 MB private memory / 54 threads
Because the reinstalled version is identical, this appears to clear the accumulated state rather than fix the underlying bug.
Relevant packaged-app implementation
Inspection of the installed app.asar shows that the Windows process-tree cleanup path invokes approximately:
execFile(taskkill.exe, ["/pid", pid, "/t", "/f"], {
windowsHide: true,
});The call does not appear to set a timeout. Cleanup is deduplicated per execution object, but there is no apparent global concurrency limit, backoff, or circuit breaker across multiple local executions. If taskkill.exe hangs because process enumeration/WMI is unhealthy, later cleanups can start additional taskkill.exe instances indefinitely.
Steps that may reproduce
- Open Codex Desktop on Windows and a local repository.
- Run multiple local shell operations, including operations that time out or are cancelled.
- Observe
taskkill.exeandconhost.exein Task Manager or Process Explorer. - If WMI/process enumeration becomes slow, observe whether
taskkill.exeinstances remain alive and increase continuously. - Keep the app open and observe WMI event 5858 failures and growing process/thread/handle counts.
The trigger is intermittent; the unbounded accumulation after the first stuck cleanup is the main defect.
Expected behavior
- A process-tree cleanup should complete or time out within a bounded period.
- Codex should not run hundreds of concurrent
taskkill.execleanup processes. - Repeated cleanup failures should activate backoff/circuit breaking and surface one actionable error to the user.
- Failure of WMI/process enumeration should not cause a system-wide process storm.
Suggested fixes
- Add a timeout to the
taskkill.exeinvocation and forcibly terminate a stuck cleanup helper. - Add a process-wide single-flight or small concurrency limit for Windows tree cleanup.
- Add exponential backoff/circuit breaking after repeated cleanup failures.
- Prefer Windows Job Objects or direct Win32 process-tree termination instead of spawning
taskkill.exefor every cleanup. - Log the target PID, duration, exit status, and number of concurrent cleanup operations.
Activity
github-actions commentedon Jul 20, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
frank9306 commentedon Jul 20, 2026
I'm also affected by this issue and would appreciate any updates on the progress. Thanks for the work on this.
msg7086 commentedon Jul 20, 2026
26.715.4045.0 here also affected by this. My work laptop is frozen with 80% of the CPU wasted on ChatGPT taskkills.
askxue commentedon Jul 20, 2026
I have been suffering from this bug for several days now. I hope it can be fixed as soon as possible.
adfras commentedon Jul 20, 2026
I can reproduce this on a newer Codex Desktop build, so the issue persists beyond 26.715.4045.0.
Environment
26.715.7063.0OpenAI.Codex_26.715.7063.0_x64__2p2nqsd0c76g010.0.26200Reproduction and evidence
After fully quitting Codex, restarting Windows, checking for app updates, and relaunching Codex, the process storm returned.
C:\Windows\System32\taskkill.exe /pid <pid> /t /fprocesses accumulated.taskkill.exehad the packaged Codex desktop main process (ChatGPT.exe) as its direct parent.git status --short --untracked-files=nocompleted in about 0.2 seconds, so repository Git responsiveness was not the trigger in this reproduction.The Codex desktop log repeatedly reports:
Windows WMI Activity event 5858 records repeated
Win32_Processquery failures from the cleanup processes with result codes:0x800410320x800706BE0x800706BAInspection of this build's packaged
app.asaralso shows that the Electron sampler:This appears to amplify the failure: a timed-out WMI snapshot leads to
taskkillcleanup; each stucktaskkillperforms anotherWin32_Processquery; later sampler cycles add more cleanup processes without effective global backoff/circuit breaking.The same sampler failure first appears in local Codex logs from 2026-07-15 under desktop build
26.707.9981.0, and continues under26.715.7063.0. No private paths, repository names, prompts, or raw logs are included here. Sanitized screenshots and selected log/event excerpts are available if maintainers need them.levgoriachev commentedon Jul 20, 2026
+1. Made whole app completly unuseable. With 2 220$ subscriptions. Great work, devs!
win 10, 26.715.52143
NocturnalSk commentedon Jul 20, 2026
Confirmed on a newer Microsoft Store build with another Windows 10 reproduction.
Environment
OpenAI.Codex_26.715.7063.0_x64__2p2nqsd0c76g0Ok/StoreChatGPT.exefile version:150.0.7871.12419045.6466Observed behavior and evidence
Task Manager showed the following simultaneous CPU spike:
A read-only process/event investigation found:
Winmgmtwas hosted normally byC:\Windows\System32\svchost.exe -k netsvcs -p.Windows
svchost.exe,WmiPrvSE.exe, andtaskkill.exebinaries had valid Microsoft signatures.Before the screenshot, the WMI Activity log already contained 742 Event ID 5858 failures from 00:17 through 00:23. The operations repeatedly enumerated
Win32_ProcessandWin32_PerfFormattedData_PerfProc_Process, with result codes including0x800706BA,0x80041032, and0x80041033.One live snapshot found 46
taskkill.exeprocesses, all direct children of the Codex Desktop mainChatGPT.exeprocess. Sampled command lines were of the form:A later five-second sample started with 212 live
taskkill.exeprocesses and ended with 202 still alive.During one 15-second polling window, 1,092 distinct PIDs were observed (including the initial live set), showing extreme intermittent process churn.
A later five-second CPU sample showed
Winmgmtand all fourWmiPrvSE.exeinstances back at 0%, consistent with a bursty query/cleanup storm rather than sustained load.The WMI permanent-subscription check found no
CommandLineEventConsumerorActiveScriptEventConsumer; only the standard SCM event-log subscription was present. No TCP connections were owned by the WMI provider PIDs.Two later diagnostic commands timed out and may have amplified the subsequent
taskkill.execount. However, the 742 WMI failures and the Task Manager spike occurred before those diagnostics, so the underlying cleanup/query storm was already active.This matches the unbounded Windows cleanup behavior described in this issue and confirms that it still reproduces in Store build
26.715.7063.0on Windows 10. A bounded timeout plus global concurrency limit/backoff aroundtaskkill.exewould prevent this failure from escalating into system-wide WMI and process exhaustion.Usernames, repository paths, conversation contents, and unrelated process details were intentionally omitted. A screenshot of the WMI CPU spike can be provided if useful.
noman-qadir commentedon Jul 20, 2026
Additional WPR and controlled Git/MCP isolation evidence
I have an independent reproduction on:
26.715.4045.026200.8875, x64A 4.09 GiB Windows Performance Recorder trace captured the process storm with zero lost events or buffers. During its final 385-second incident window:
taskkill.exelaunches occurred.git.exe.git config --null --get core.fsmonitor.I later performed a controlled MCP-isolation comparison:
config.toml, removing Node REPL’s disabled flag.rev-parse HEAD,remote -v,config --null --get core.fsmonitor, andstatus --porcelain.git config --null --get core.fsmonitorcommand completed naturally in 91 ms.git -c core.hooksPath=NUL -c core.fsmonitor=false status --porcelainprocess alive.Earlier logs also showed automatic title/description sessions initializing complete helper/MCP environments while recording zero MCP tool executions. During the full recurrence, ten matching local helper suites remained resident simultaneously.
Normal application closure was incomplete twice during the follow-up. Residual ChatGPT processes had to be ended through Task Manager; one idle residual group used approximately 755 MB.
This evidence supports a compound lifecycle problem:
taskkill /Tthen enumerates that enlarged process table through WMI and can escalate into the reported storm.After restoring the original MCP configuration and performing a final clean restart, the app was stable with one expected helper suite, zero Git, zero taskkill, and zero exact
Win32_ProcessWMI failures during the final observation. This cleared the accumulated state but did not fix the underlying product defect.I can provide the full WPR ETL, targeted WPA CSV exports, event-log details, process command lines, and timestamped chronology if useful.
Existing OpenAI feedback ID:
019f7bb3-69e7-7f23-8635-79b16e2eb930.Related reports: #29408, #33531, and #34251.
Chronology note: #29408 documented the same Git polling command family on Codex versions
26.616.6631.0,26.623.11225.0, and26.707.62119. This indicates that the underlying Git polling defect predates26.715; the WPR evidence above in this comment connects that older behavior to the downstreamtaskkill/WMI storm.athan614 commentedon Jul 20, 2026
Same issue here, ChatGPT/Codex windows app is stuck in a runaway process-enumeration loop with taskkill.exe whenever launched, causing WMI to get stuck at 25% CPU constantly, lagging my entire PC.
q447552640 commentedon Jul 21, 2026
If I launch Codex Desktop directly in user mode, it spawns a large number of terminal processes and keeps failing repeatedly, with up to five or six hundred such processes running. Meanwhile, the WMI Provider Host process consumes over 50% of system resources. However, when I run it as administrator, no excessive terminal processes are created and WMI operates normally. This issue is most likely caused by a permission-checking process that keeps failing and restarting continuously.
Right Click Codex And Run As Administrator may be helpful.
13 remaining items
dciechanowicz commentedon Jul 23, 2026
Independent reproduction on the same Windows desktop build confirms this issue, including the cold/idle startup variant.
Environment
OpenAI.Codex_26.715.4045.0_x64__2p2nqsd0c76g0codex-command-runner-0.145.0-alpha.18Observed behavior
Merely launching Codex/ChatGPT Desktop, without intentionally starting a task, caused process, thread, handle, and memory counts to grow continuously. Fully closing the Codex/ChatGPT processes caused the counts to fall back toward baseline.
A live snapshot during the storm showed:
1,66911,179398,810taskkill.exe:618processes /114,606aggregate handlesconhost.exe:649processes /63,534aggregate handlesEarlier before/after screenshots from the same launch showed growth within approximately 101 seconds from:
313 -> 8715,079 -> 8,701147,879 -> 251,81311.4 GB -> 17.6 GBThe counts continued increasing after that snapshot.
Parent-process confirmation
A WMI-independent Toolhelp32 process-tree capture was used because WMI became too slow to answer during the storm. In one diagnostic sample, all 587 live
taskkill.exeinstances had the Codex DesktopChatGPT.exeprocess (PID 28712) as their direct parent:Closing Codex stopped the spawning and returned the system to approximately
380processes /5,000threads /150,000handles.This independently supports the existing diagnosis that the desktop cleanup path can enter an unbounded
taskkill.exespawn loop. It also confirms that the trigger can occur immediately after restoring/launching the desktop app, before the user intentionally initiates a new task.A sanitized diagnostic ZIP containing six-sample process timelines, parent PIDs, grouped handle/thread/RAM counts, app versions, and no chat/config contents is available if maintainers need it.
levgoriachev commentedon Jul 23, 2026
26.715.72359 still exist. Codex dev folks, do you realize that it's a blocker not even major bug? The desktop app is complitly unuseable. Like at all =)
And we all still paying subscription for the unuseable app. Is there any workarounds maybe? till the official fix.
DaveW001 commentedon Jul 23, 2026
Independent reproduction: 26.715.10079.0, WmiPrvSE at 49% CPU, 39k CPU-seconds
Same failure mode on a newer Store build.
Environment
OpenAI.Codex_26.715.10079.0_x64__2p2nqsd0c76g026200Live evidence from an active storm
WmiPrvSE.exe PID 101532 accumulated 39,325 CPU-seconds in ~2 hours -- sustained 49% CPU. Three WmiPrvSE instances were running.
Every live
taskkill.exewas a direct child ofChatGPT.exePID 85172 (Codex Desktop main process). All rantaskkill.exe /pid <pid> /t /f. 13 instances alive at capture, spawning at 3-5/sec.Full process tree under PID 85172:
hash-objectin one repoSampler amplifies the loop
The two
powershell.exechildren are Codex's[electron-sampler]. Every 30 seconds it runs:This is Codex monitoring its own child processes via WMI. When the taskkill pile-up starts, these queries slow down, hit the same WMI quota, and log
[electron-sampler] Failed to collect child process snapshot. Retries add more WMI load.So the feedback loop has three participants:
If the sampler used
CreateToolhelp32Snapshotinstead of WMI on Windows, it would remove one amplifier.Workaround tested
Stop-Process -Name ChatGPT,codex -Forcekilled the tree. WmiPrvSE CPU dropped from 49% to near zero in 30 seconds. Relaunch worked normally.Per-repo
.git/info/excludeadditions reduced Git scanning volume, but the underlying taskkill/WMI loop is still present.msg7086 commentedon Jul 23, 2026
I was able to recover my working environment, by deleting all conversations and projects from codex app, i.e. performing a factory reset.
~/.codex/sessionsand remove all sessions. You can backup to a different directory instead of deleting them.~/.codex/.codex-global-state.jsonfile.Then when you start codex app, you should get a clean and empty workspace, and the CPU usage should drop quickly.
If you have unfinished sessions, use codex CLI instead, resume your conversation, ask it to dump a handover markdown file. You can then pick the handover file in codex desktop app later, after the reset.
PPandYY commentedon Jul 24, 2026
I published a standalone MIT-licensed containment guard for this specific Windows failure mode:
https://github.com/PPandYY/codex-windows-taskkill-guard
Release: https://github.com/PPandYY/codex-windows-taskkill-guard/releases/tag/v0.1.0
This is a temporary community mitigation, not an upstream fix.
The guard:
NtQuerySystemInformation-based native snapshots rather than WMI;taskkill.exechildren directly owned by a package-verified CodexChatGPT.exe;app\ChatGPT.exesuffix,System32\taskkill.exepath, PID/creation-time identity, and direct parentage all match;BelowNormal, runs the guard atAboveNormal, and releases after 10 quiet seconds;On one affected Windows machine, under the same 30-second workload:
taskkill.exepeak: 26 -> 5conhost.exepeak: 39 -> 17The trade-off is explicit: suppressing cleanup helpers during a storm can leave an individual tool child running. The guard never terminates Codex or
conhost.exe, and never broadens its target set.The public repo includes 34 Python tests plus PowerShell installation/rollback fixtures. This result supports implementing a process-wide cleanup concurrency/timeout fix upstream and replacing the Desktop WMI sampler with native process APIs.
levgoriachev commentedon Jul 24, 2026
Current build still contains the disposal-to-
taskkillpathI reproduced this again after updating to the current Microsoft Store package:
OpenAI.Codex_26.721.3996.0_x64__2p2nqsd0c76g0With the normal profile, the storm still starts during cold launch. Removing all pinned tasks did not prevent it: one controlled run observed 40 unique
taskkill.exeprocesses, about 3.8 GiB peak Desktop working set, and heavy disk activity within the first minute. Direct Git control commands against the same repositories completed normally in approximately 1.5–3.4 seconds.Read-only inspection of this exact installed build's
app.asarshows a more specific cleanup trigger than a generally slow Git repository:The local execution host exposes child
stdinas an RPC-backedWritableStream.When the last RPC stub reference is disposed while the stream is not marked closed,
WritableStreamStubHook.dispose()callswriter.abort(...).The local execution host's
stdinabort handler invokes child cleanup.With
killProcessTree=true, the Windows cleanup path invokes:The
taskkillexecFilecall still has no visible hard timeout, process-wide concurrency limit, per-target single-flight guard, backoff, or circuit breaker.This means normal RPC stub disposal can be interpreted as cancellation and reach process-tree termination even when the read-only Git operation itself is not slow. Large/restored workspaces and long task histories increase the number of background Git/RPC lifecycles, but they are amplifiers rather than the root defect.
A separate clean isolated
CODEX_HOMEwith no sessions, projects, or authentication produced notaskkillstorm, but still reached roughly 2.5 GiB Desktop working set and heavy plugin-related disk I/O. That separates the general startup resource problem from this cleanup defect; deleting conversation history is not a complete fix.Suggested product-side fixes:
stdinexplicitly on normal completion before disposing the RPC stub;Acceptance should include completed read-only Git commands whose RPC stubs are disposed without launching
taskkill.exe, plus a stress test proving cleanup concurrency remains bounded when many background Git operations are cancelled.No usernames, repository names, absolute user paths, session contents, credentials, or raw traces are included. Sanitized ETW/log excerpts can be provided if a maintainer requests a specific format.
Pyseph commentedon Jul 24, 2026
Independent reproduction on
26.715.10079.0I independently reproduced this issue using read-only monitoring that did not stop, pause, or modify any running applications.
Evidence collected during the active slowdown:
taskkill.exeprocesses in 8 seconds (~30.6 launches/second).taskkill.exewas a direct child of the packaged Codex DesktopChatGPT.exe.ExecQuerystarts (~57.6/second).Win32_Process, including process IDs, parent IDs, working sets, thread counts, and CPU times.WmiPrvSE.exeand 1.34 cores to the Winmgmt service host.User-visible impact included browser updates occurring only every few seconds, delayed typing in text fields, delayed mouse-hover feedback, and general desktop sluggishness. Memory, disk, and GPU saturation were not observed.
The app was intentionally left running because active background work could not be interrupted, so a restart comparison was not performed. Raw ETL traces and process exports have been retained locally but are not attached publicly because they may contain local paths, identifiers, command lines, or unrelated process information. A sanitized extract can be provided through an appropriate private channel if requested.
levgoriachev commentedon Jul 24, 2026
Follow-up: process storm contained, but a separate full-rollout scan still makes Desktop unusable
I ran controlled local experiments against the current Store build
26.721.3996.0using a disposable portable copy. The real sessions were never deleted or modified.The reproduction includes an active legacy goal thread whose JSONL rollout is about 4 GiB. Removing pinned tasks did not help.
What the experiments separated
taskkill.exe, and disabling the WMI child-process sampler, prevented the original unboundedtaskkillprocess storm. Process count stayed bounded.codex.exesustained roughly 100-140 MiB/s reads until an external guard terminated only the disposable build.thread/read(includeTurns=true): about 60 KiB returned in under 1 second;thread/resumewithexcludeTurns=true, a 5-turn initial page, and deferred goal continuation: 61 KiB response, 6.4 seconds, about 279 MiB peak backend working set, and no automatic turn.thread/resume, the renderer sendsthread/goal/getand thenthread/goal/set. That second request starts the destructive scan.Specific backend path
In
app-server/src/request_processors/thread_goal_processor.rs, both goal set and clear callreconcile_thread_goal_rollout(...). It unconditionally callsreconcile_rollout(...)with no builder and no incremental items.In
rollout/src/state_db.rs, that shape falls through tometadata::extract_metadata_from_rollout(...), which scans the rollout file. For an already materialized thread whose metadata row already exists in SQLite, this is redundant, but it rereads the complete multi-gigabyte legacy JSONL.The app-server trace showed
thread/goal/setenteringcodex_rollout::recorder/ rollout reconciliation at exactly the point where backend disk reads and RAM growth began.Suggested product-side change
Before reconciling a goal mutation, check whether the thread metadata row already exists in
StateRuntime:An acceptance test should use a large legacy rollout with existing SQLite metadata and verify that
thread/resumefollowed bythread/goal/setreads only a bounded suffix / incremental data, does not materialize the full JSONL, and does not start a turn when goal continuation is deferred.This appears to be a compound failure:
taskkill/WMI cleanup loop is one root defect;The local patches were diagnostic only and are not presented as a production-ready fix. I am stopping the experiments and cleaning up the disposable build, but this should provide a narrower upstream target without requiring users to delete their conversations.
ayanamislover commentedon Jul 26, 2026
Current-build follow-up:
26.721.4979.0isolates two repeated WMI snapshot callersI reproduced the remaining WMI polling on the current Windows Store package:
19045.6466OpenAI.Codex_26.721.4979.0_x64__2p2nqsd0c76g0app.asarwere not modifiedA 10.097-second Microsoft-Windows-Kernel-Process ETW baseline recorded 14 direct
powershell.exechildren of the Electron main process (1.387/s), with the activeWmiPrvSE.exeprocesses consuming about 0.286 logical cores in aggregate.Windows PowerShell Event 400/403 recorded only these two commands in that window:
A short, reversible
ChildProcess.spawntrace in the Electron main process identified the exact remaining stack:Current bundle inspection shows two independent callers:
ElectronSampler.addChildProcessFields()creates the dedicatedchild-process-snapshot-worker.jsworker.tXin this build) callslistProcessSubtreesfromupsert/complete, retries at[0, 100, 300, 600]ms, and then falls back to a detached-process candidate scan.To isolate causality without restarting Codex, I temporarily neutralized only those two seams in the same Electron PID:
listProcessSubtreesandlistDetachedProcessCandidatesdependencies returned empty arrays.The real execution host, ordinary worker construction, Git, PowerShell, and the
taskkill.execleanup function were not globally intercepted.Results:
The last small provider-host delta was not accompanied by any child process start from any current ChatGPT PID. The Electron main PID and start time did not change, the temporary loopback Inspector was closed, and no ETW session remained.
This is a causal isolation, not a suitable product workaround: returning empty process snapshots can make background/detached-process attribution incomplete.
Suggested product fix:
NtQuerySystemInformationor Toolhelp32 plus process metrics);taskkill.exe/WMI feedback loop.The Electron Desktop implementation is not present in the public repository, so I cannot submit the product-code PR against
openai/codex. This comment provides the current-build call sites and controlled A/B for the private Desktop implementation.chess-oai commentedon Aug 5, 2026
while we believe
26.730.7989.0substantially improves the WMI storm, there are still many cases of taskkill floods that we need to resolve separately. leaving this issue open to track taskkill issues, but if you were suffering mostly WMI-related system exhaustion, re-test on26.730.7989.0DukeTwoCan commentedon Aug 13, 2026
I can confirm that I am still experiencing this issue on Windows 11 Pro, and my codex version is
26.803.10989.0. As soon as I launch the ChatGPT/Codex desktop application, it spawns a bunch of taskkill/git tasks and then my WMI Provider Host process spikes. If left alone it causes a system crash, but if I kill the ChatGPT/Codex desktop application in task manager the WMI storm subsides and everything goes back to before I tried to launch.DukeTwoCan commentedon Aug 14, 2026
Windows 11 Pro, updated to ChatGPT/Codex desktop version 26.810.41047 and launched without seeing these issues anymore.