What issue are you seeing?
Codex appears to leak stdio-based MCP child processes over time, especially when using @playwright/mcp.
In long-lived sessions, resumed sessions, VS Code app-server sessions, or flows involving subagents, new MCP child processes keep getting spawned, but old ones are not terminated. Over time this leads to dozens or hundreds of stale processes and multiple GB of RAM usage.
This looks like a lifecycle / process-reaping bug in Codex rather than an issue in the MCP server itself.
What steps can reproduce the bug?
I cannot give a perfect deterministic reproduction yet, but this reproduces reliably over normal use:
- Configure a stdio MCP server such as
@playwright/mcp
- Start Codex in CLI or via the VS Code extension
- Use MCP-backed tools repeatedly over time
- Resume sessions and/or use subagents
- Inspect processes with
ps
What is the expected behavior?
- MCP child processes should be reused where possible, or
- terminated reliably when their owning session / subagent / app-server no longer needs them
- idle MCP servers should not live forever
- ending a session should clean up the entire MCP subprocess tree
Additional information
No response
What issue are you seeing?
Codex appears to leak stdio-based MCP child processes over time, especially when using
@playwright/mcp.In long-lived sessions, resumed sessions, VS Code app-server sessions, or flows involving subagents, new MCP child processes keep getting spawned, but old ones are not terminated. Over time this leads to dozens or hundreds of stale processes and multiple GB of RAM usage.
This looks like a lifecycle / process-reaping bug in Codex rather than an issue in the MCP server itself.
What steps can reproduce the bug?
I cannot give a perfect deterministic reproduction yet, but this reproduces reliably over normal use:
@playwright/mcppsWhat is the expected behavior?
Additional information
No response