[Windows] Completed subagents leave STDIO MCP Node.js processes running (245 processes / 18 GB)
What version of the Codex App are you using (From “About Codex” dialog)?
Codex Desktop 26.715.8383.0 (x64)
What subscription do you have?
Chatgpt pro
What platform is your computer?
Windows 11 Home, 64-bit, version 10.0.26200 (build 26200)
What issue are you seeing?
Node.js version
Node.js v24.15.0, installed at %ProgramFiles%\nodejs\node.exe
When a Codex task spawns subagents while multiple local STDIO MCP servers are enabled, each subagent starts its own copy of every enabled Node-based MCP server. After a subagent records task_complete, those MCP processes remain alive instead of being stopped.
The process count therefore grows approximately linearly with the number of subagents created during the lifetime of the Codex Desktop process. In the observed session, this reached 245 Node.js processes and approximately 18.3 GB of working-set memory.
What steps can reproduce the bug?
- On Windows, enable several local Node-based STDIO MCP servers. My configuration included:
npx -y @cyanheads/pubmed-mcp-server@latestnpx -y clinicaltrialsgov-mcp-server@latest- a local
cas_journalNode MCP server - Node-based MCP servers bundled with the Data Analytics, Sites, and OpenAI Developers plugins
- Start Codex Desktop.
- Run a task that creates multiple subagents.
- Wait for the subagents to finish and record
task_completein their session transcripts. - Inspect the remaining Node processes and their command lines:
$nodes = Get-CimInstance Win32_Process |
Where-Object Name -EQ 'node.exe'
$nodes |
Group-Object CommandLine |
Sort-Object Count -Descending |
Select-Object Count, Name
$workingSet = Get-Process -Name node -ErrorAction SilentlyContinue |
Measure-Object WorkingSet64 -Sum
[math]::Round($workingSet.Sum / 1GB, 2)
- Observe that each new subagent adds another repeated set of MCP processes, but completing the subagent does not reduce the process count.
Expected behavior
When a subagent finishes, Codex should close or dispose of that subagent's STDIO MCP clients and terminate their child processes. Alternatively, MCP clients could be shared or pooled with a bounded lifetime across subagents.
The number of local MCP processes should not continue increasing after subagents complete.
Actual behavior
Each subagent created approximately eight Node processes:
| MCP source | Node processes per subagent | Why |
|---|---:|---|
| PubMed MCP | 2 | One npx-cli.js process and one server process |
| ClinicalTrials MCP | 2 | One npx-cli.js process and one server process |
| CAS Journal MCP | 1 | Direct Node server |
| Data Analytics plugin | 1 | Plugin-provided server.cjs |
| Sites plugin | 1 | Plugin-provided server.mjs |
| OpenAI Developers plugin | 1 | Plugin-provided server.mjs |
| Total | 8 | Per subagent/session |
Observed totals:
- 30 repeated MCP process sets × 8 Node processes = 240 Node processes attributable to Codex MCP initialization.
- 5 additional unrelated/orphaned
tests/run_fixture_validators.jsprocesses were present, resulting in 245 Node processes overall. - Total Node working-set memory was approximately 18.3 GB.
- The count remained at 245 across repeated samples several minutes apart.
Evidence that completed subagents retain their MCP processes
- Codex Desktop's
codex.exeprocess started at09:23:19. - MCP process sets were then created repeatedly from
09:23:57through10:19:05. - Their creation timestamps closely matched the creation timestamps of subagent session files.
- 25 inspected subagent transcripts ended with an
event_msgwhose payload type wastask_complete. - The corresponding MCP process sets were still alive after those completion records.
- For one concrete example:
- Subagent and its MCP processes started at
09:26:18. - The subagent recorded
task_completeat09:30:24. - Its CAS Journal MCP process was still alive when checked at
10:24:23. - Process ancestry showed the MCP processes were direct or indirect descendants of Codex Desktop's
codex.exe(somenpxservers had intermediatecmd.exeandnode.exeprocesses).
Process distribution at the time of capture
| Command | Count | Approx. working set |
|---|---:|---:|
| PubMed server | 30 | 3,349 MB |
| PubMed npx-cli.js | 30 | 2,488 MB |
| ClinicalTrials server | 30 | 3,222 MB |
| ClinicalTrials npx-cli.js | 30 | 2,484 MB |
| Plugin server.mjs processes | 60 | 3,007 MB |
| CAS Journal server | 30 | 1,912 MB |
| Data Analytics server.cjs | 30 | 1,593 MB |
Why this does not appear to be a Node.js process-spawning issue
All 240 MCP-related Node processes followed the same Codex/subagent creation pattern and were launched as descendants of the active Codex Desktop process. Multiple independent MCP implementations remained alive in identical per-subagent groups. This points to the Codex session/MCP manager lifecycle rather than one MCP package spawning copies of itself.
I have not changed Node versions yet, because the multiplication is initiated by Codex when sessions/subagents are created. Testing with another supported Node version may still be useful as a secondary compatibility check.
Impact
- Hundreds of Node processes remain after the related subagent work is complete.
- Memory usage can grow into tens of gigabytes during multi-agent workflows.
- The machine becomes slow and may experience memory pressure or paging.
- Fully restarting Codex is currently the practical way to reset the accumulated MCP processes.
Additional context
The strongest current hypothesis is that each subagent initializes its own MCP manager, but the manager or its STDIO child processes are not disposed when the subagent reaches task_complete.
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks for the additional reproduction. I see the same behavior: simply creating a new task, before it does any actual work, causes many new Node.js processes to appear. They are repeated instances of the configured MCP servers, so this seems related to MCP servers being started again for each task and not being cleaned up properly afterward.
Independent corroboration from a separate Windows 11 Pro / ChatGPT Pro long-running Codex Desktop session on July 23, 2026:
I did not capture a clean per-command process inventory before restarting, so this is corroborating impact evidence rather than a second exact reproduction of the 245-Node-process count. The visible symptom and recovery pattern match this issue closely: multi-agent/MCP activity accumulates unreaped descendants, memory rises into tens of gigabytes, and restarting Codex is the practical cleanup.
A useful built-in diagnostic would expose, per root thread/subagent: MCP client PID tree, ownership, creation time, task completion time, disposal status, and aggregate working set. Codex should also enforce a bounded process/memory ceiling and terminate orphaned MCP clients after the owning subagent reaches a terminal state.
Reproduced on Windows with ChatGPT/Codex Desktop 26.810.7004.0 the best flagship vibecoded application.
Task Manager showed 253 ChatGPT processes using 8.1 GB RAM. Shortly afterward, there were 139 node.exe processes using 12.5 GB, mostly repeated MCP servers such as GitLab, Jira, Confluence, and Chrome DevTools.