Stop/cancel becomes unresponsive when subagent MCP processes exhaust memory — Codex unrecoverable without killing processes externally
Primary bug: When a fleet of subagents accumulates enough MCP server processes to exhaust memory, the Stop control no longer interrupts the run. The app becomes unresponsive and the only recovery is killing processes from a terminal (kill -9 on the MCP children / the app-server). There is no in-app escape once the machine is under that memory/CPU pressure — which makes Codex effectively unusable for high-fan-out subagent work.
Root cause (what builds the pressure)
- The built-in
defaultsubagent inherits the parent's fullmcp_serversroster with no way to restrict it. The[agents]section only exposesmax_threads,max_depth,job_max_runtime_seconds— no MCP scoping. Only user-defined custom agent files support anmcp_serversoverride. - Per-spawn MCP processes are neither pooled (#12333, closed not-planned) nor reaped on subagent exit.
Observed
One long-running session, on a single app-server process, accumulated:
- 212 ×
SkyComputerUseClient(built-in Computer Use — not an[mcp_servers]entry, so config can't disable it) - 113 ×
npm exec @playwright/mcp@latest - 93 ×
previewsmcp serve - 78 ×
railway mcp - ~13 each of
ios-simulator-mcp,xcodebuildmcp,node_repl, bundled.server.{mjs,cjs,bundle}
Total: ~800+ node processes, ~16–27 GB RSS, with syspolicyd/trustd pegged from the trust-check churn of constant process spawns. Killing the children frees the RAM, but they rebuild to ~500 procs / ~16 GB in ~15 minutes as long as the app-server stays alive. The only reliable recovery was quitting Codex entirely.
Requests (priority order)
- Stop/cancel must stay responsive under memory pressure. Interrupting a run should forcibly tear down spawned subagents and their MCP processes even when the system is starved — give the user an in-app recovery path. (Critical — this is what makes it unusable rather than merely wasteful.)
- Reap dead MCP server processes when a subagent exits; cap or pool per-server instances.
- Allow
mcp_serversscoping on the built-indefaultagent (e.g. honoragents.default.config_file, or an[agents.default] mcp_serverskey) so high-fan-out fleets don't each inherit the full roster. - Document whether spawned subagents inherit the cwd/global
AGENTS.mdinstruction chain, and consider allowing a per-agent external instructions file.
Environment
- Codex.app, macOS (Apple Silicon), 64 GB RAM.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗