opencode PR adds regression test for MCP subprocess leak that exhausted memory
sugarless-sweet · ghdev · 2026-09-12
PR #48595 in anomalyco/opencode addresses issue #47727: polling clients interacting via /mcp/:name/connect-style endpoints kept spawning stdio MCP child processes that were never disposed, eventually exhausting memory.
The PR adds regression tests against the instance HttpApi route handlers to lock in the intended lifecycle:
- POST /mcp/demo/connect spawns exactly one live MCP stdio child
- Repeated status + connect for the same directory keeps a single live child, no accumulation
- POST /mcp/demo/disconnect reaps the child, dropping live processes to zero
The test fixture is a standard MCP stdio server that appends its pid on every spawn; the test counts live children via process.kill(pid, 0), so any spawned-but-never-disposed process fails the assertion. Verification: new test passed 5/5 runs, full test/server/ suite at 298 pass / 0 fail.
More from coding & agent
- Training a messaging agent for format adherence with dual-ring protocol before RL — cephaloform · 2026-09-12
- A 70-char character-level tokenizer for brainfuck coding agents lands on Hugging Face — cephaloform · 2026-09-12
- Dev Ditches Claude Code for Codex: 'No More Found the Smoking Gun' — TheMoonMidas · 2026-09-12
- The benchmarking problem: we're evaluating adapter-harness-model triplets, not models — teortaxesTex · 2026-09-12
- Git AI Duo Joins OpenAI as Company Pledges to Keep Agent-Tracking Tool Open Source — Dimillian · 2026-09-12
- Tasking an AI agent to buy 4 Tokyo concert tickets: the 'Math Olympiad' of assistants — annbordetsky · 2026-09-12