Symptom (production, 2026-08-31)
A failed `execute_seed --runtime gjc` run left 19 gjc worker (bun) processes and 18 nested `ouroboros mcp serve --runtime gjc` children alive 17+ minutes after the run ended, each holding DB connections — a major contributor to the pool-exhaustion incident.
Root causes (audited on main @ v0.52.0)
- `GjcRuntime._build_runtime_handle` (orchestrator/gjc_runtime.py:120-160) never calls `bind_controls`, so `can_terminate` is False and every existing termination path (per-AC finally in parallel_executor, run-level finallys in runner, cancel/escalation paths) is a silent no-op for gjc. Only codex/opencode bind a terminate callback.
- `GjcCoordinatorClient.stop_session` exists (gjc/sdk_client.py:390) but is never called from the agent-runtime path — the finally only disconnects the coordinator client (gjc_runtime.py:376-381). The success path leaks sessions too.
- gjc workers inherit the project env and cwd verbatim (sdk_client.py:104, bypassing `build_child_env`), read the project `.mcp.json`, and spawn one nested `ouroboros mcp serve` per AC attempt. claude has `--strict-mcp-config` and codex has `enabled=false`; gjc has no equivalent suppression.
- No run-scoped reaper: `execute_parallel` has no outer try/finally sweeping runtimes; `_close_adapter` only calls `aclose` where it exists (not on GjcRuntime).
Fix plan (single PR)
- Call `stop_session` in the gjc turn finally on terminal states.
- Bind a terminate callback on the gjc RuntimeHandle so the already-wired termination paths start working.
- Suppress project MCP config / route env through `build_child_env` for gjc workers to stop nested serve spawns.
Symptom (production, 2026-08-31)
A failed `execute_seed --runtime gjc` run left 19 gjc worker (bun) processes and 18 nested `ouroboros mcp serve --runtime gjc` children alive 17+ minutes after the run ended, each holding DB connections — a major contributor to the pool-exhaustion incident.
Root causes (audited on main @ v0.52.0)
Fix plan (single PR)