Steps to reproduce
- Run a multi-agent session with MCP servers configured (e.g. MongoDB MCP)
- Let the session complete, or kill the coordinator
- Run
ps aux | grep mcp-server
Expected behavior
All MCP server processes are terminated when the agent session or coordinator that spawned them exits.
MCP server processes remain running indefinitely. After several multi-agent runs, 20+ orphaned instances were found:
ps aux | grep mongodb-mcp-server
andreaswest 53222 ... node .../mongodb-mcp-server --readOnly --connectionString mongodb://localhost:27017/worker
andreaswest 25472 ... node .../mongodb-mcp-server
andreaswest 21498 ... node .../mongodb-mcp-server --readOnly --connectionString mongodb://localhost:27017/worker
# ... 18 more instances
All orphaned processes had PPID 1 (reparented to launchd), confirming the parent agent process exited without cleaning up its children.
Impact
- Sustained high CPU and memory usage between sessions
fseventsd thrashing from open file handles across worktrees
- System load average remained elevated (25+) long after all sessions were stopped
- Required manual
pkill -f mongodb-mcp-server to recover
Suggested fix
Agent teardown (session-end hook, coordinator stop, and crash recovery paths) should explicitly terminate any MCP server child processes. A process group kill (kill -TERM -<pgid>) on the spawned process group would catch all descendants. Alternatively, tracking spawned MCP PIDs in the .overstory/ SQLite DB and killing them on cleanup would also work.
A ov clean command that kills known orphaned MCP/agent processes would also be a useful complement.
Workaround
pkill -f mongodb-mcp-server
Actual behavior
Summary
When agent sessions end (normally or via crash/interrupt), MCP server child processes are not terminated. They accumulate as orphaned processes reparented to launchd, consuming memory and CPU indefinitely.
overstory version
0.9.1
Bun version
1.3.10
Operating system
macOS 26.3.1
Steps to reproduce
ps aux | grep mcp-serverExpected behavior
All MCP server processes are terminated when the agent session or coordinator that spawned them exits.
MCP server processes remain running indefinitely. After several multi-agent runs, 20+ orphaned instances were found:
All orphaned processes had
PPID 1(reparented to launchd), confirming the parent agent process exited without cleaning up its children.Impact
fseventsdthrashing from open file handles across worktreespkill -f mongodb-mcp-serverto recoverSuggested fix
Agent teardown (session-end hook, coordinator stop, and crash recovery paths) should explicitly terminate any MCP server child processes. A process group kill (
kill -TERM -<pgid>) on the spawned process group would catch all descendants. Alternatively, tracking spawned MCP PIDs in the.overstory/SQLite DB and killing them on cleanup would also work.A
ov cleancommand that kills known orphaned MCP/agent processes would also be a useful complement.Workaround
Actual behavior
Summary
When agent sessions end (normally or via crash/interrupt), MCP server child processes are not terminated. They accumulate as orphaned processes reparented to
launchd, consuming memory and CPU indefinitely.overstory version
0.9.1
Bun version
1.3.10
Operating system
macOS 26.3.1