codex - 💡(How to fix) Fix Codex Desktop leaks MCP server processes from internal title-generation sessions on Windows [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19858Fetched 2026-04-28 06:35:58
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×5closed ×1commented ×1

Fix Action

Fix / Workaround

Local workaround

I added a repo-local health/cleanup workaround that detects logical MCP instances, distinguishes raw wrapper processes from logical server roots, attributes owners (Codex:<pid>, Claude:<pid>, Other/Detached), and can dry-run or reap stale recognized MCP process trees:

Code Example

python .codex/skills/tool-health/scripts/mcp_health.py --cleanup-dry-run
python .codex/skills/tool-health/scripts/mcp_health.py --cleanup-stale-processes --fail-on-process-pressure

---

total_mcp_processes: 0
total_mcp_instances: 0
warnings: []
RAW_BUFFERClick to expand / collapse

What version of the Codex App are you using?

Observed in Codex Desktop logs as app.version=0.125.0-alpha.3.

What platform is your computer?

Windows, PowerShell environment.

Related issues

Possibly related to #12491 and #18333, but this report has Windows-specific evidence and shows MCP stacks being launched for internal title-generation/helper sessions, not only normal visible task sessions.

What issue are you seeing?

Codex Desktop appears to start the full project MCP server set for internal helper/title-generation sessions and does not reliably reap those MCP subprocess trees after the helper/visible thread lifecycle ends.

This led to runaway MCP process pressure even when only two visible Codex sessions were open.

Evidence gathered

  • MCP config was clean: no duplicate Codex MCP definitions and no missing expected MCP servers.
  • Live process inventory showed repeated full six-server MCP launch clusters under one Codex app-server PID.
  • Each cluster contained the configured project MCP servers: code_intel, context7, filesystem, lumen, playwright, and sem.
  • Several launch times lined up exactly with Codex Desktop internal title-generation prompts, e.g. prompt text like Generate a concise UI title, rather than user-visible coding work.
  • Archived/closed visible threads did not correspond to process cleanup; MCP roots remained after those threads were archived or inactive.
  • On Windows, npx-based MCP servers also expand into wrapper/child trees (cmd.exe plus node.exe), and child node.exe server processes can remain after wrapper cleanup if the full tree is not reaped.

Expected behavior

Internal title-generation/helper sessions should not start the full project MCP stack unless they actually need MCP tools. If they do start MCP servers, those server process trees should be reaped when the helper session completes.

Actual behavior

The app-server accumulated stale MCP server process trees across internal/helper sessions. Visible chat count substantially underreported active MCP load, and new sessions/agent work became unreliable under the accumulated process pressure.

Impact

  • Codex Desktop/agent startup can stall or become very slow.
  • Host-wide MCP process pressure grows even when the visible number of sessions is small.
  • Restarting/closing visible chats may not fully clean up orphaned or stale MCP server processes.

Local workaround

I added a repo-local health/cleanup workaround that detects logical MCP instances, distinguishes raw wrapper processes from logical server roots, attributes owners (Codex:<pid>, Claude:<pid>, Other/Detached), and can dry-run or reap stale recognized MCP process trees:

python .codex/skills/tool-health/scripts/mcp_health.py --cleanup-dry-run
python .codex/skills/tool-health/scripts/mcp_health.py --cleanup-stale-processes --fail-on-process-pressure

After manually reaping the stale MCP process trees, the local health check returned:

total_mcp_processes: 0
total_mcp_instances: 0
warnings: []

Suggested fix

  • Avoid attaching the full project MCP stack to internal title-generation/helper sessions unless required.
  • Ensure Codex Desktop reaps the entire MCP process tree, including npx wrapper descendants, when helper sessions or visible sessions end.
  • Consider surfacing internal/helper MCP sessions in diagnostics so visible chat count does not hide process pressure.

extent analysis

TL;DR

The most likely fix involves modifying Codex Desktop to avoid attaching the full project MCP stack to internal title-generation/helper sessions unless required and ensuring it reaps the entire MCP process tree when sessions end.

Guidance

  • Review the Codex Desktop code to identify where the full project MCP stack is being attached to internal title-generation/helper sessions and modify it to only attach when necessary.
  • Update the session cleanup logic to ensure it reaps the entire MCP process tree, including npx wrapper descendants, when helper sessions or visible sessions end.
  • Consider adding diagnostics to surface internal/helper MCP sessions to provide a more accurate visible chat count and prevent hidden process pressure.
  • Utilize the provided mcp_health.py script as a temporary workaround to detect and reap stale MCP process trees.

Example

python .codex/skills/tool-health/scripts/mcp_health.py --cleanup-stale-processes --fail-on-process-pressure

This command can be used to reap stale MCP process trees as a temporary workaround.

Notes

The provided mcp_health.py script can be used to detect and reap stale MCP process trees, but a permanent fix will require modifications to the Codex Desktop code.

Recommendation

Apply the workaround using the mcp_health.py script until a permanent fix can be implemented, as it can help mitigate the issue of accumulating stale MCP process trees.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Internal title-generation/helper sessions should not start the full project MCP stack unless they actually need MCP tools. If they do start MCP servers, those server process trees should be reaped when the helper session completes.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING