GeezerVison is showing github.com — design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio · Issue #1384 · developing-today/code
design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio #1384Todo 2 / 32 of 3 issues completedTodo 2 / 32 of 3 issues completed DescriptionDecision needed (one line): Adopt the per-instance mcpx supervisor design — stdio children owned by a supervisor that outlives the daemon, Phases 2–3 make it the default — or keep investing in the takeover handoff instead?
Summary
Replace the stdio half of mcpx's takeover handoff with one supervisor per stdio instance: a tiny process (the same mcpx binary re-executed as a hidden mcpx supervise subcommand) that spawns each stdio MCP server, owns its pipes for the child's whole life, and serves whichever daemon is currently attached over a unix socket in the state directory. A daemon upgrade then becomes a plain restart of the front end — the new daemon attaches to supervisors that are already running. No pipes move, no descriptors are passed, nothing is detached or restored.
This extends — does not duplicate — the repo's own design thread: pkgs/mcpx/TODO.md item 1 ("Replace the takeover handoff with a supervisor… The current handoff is a stopgap") and planning/roadmaps/mcpx.md → Next → "A supervisor that owns each stdio child's pipes" (status: idea, no issue until now). Full design doc: files/designs/code-mcpx-stdio-supervisor.md in the keep-the-four-repos-healthy goal workspace (registered in files/potential-projects.md).
Current state (evidence)
pkgs/mcpx/internal/daemon/takeover.go is 726 lines of framed handoff protocol (hello/listener/state/pools/pipe/conn/end/ack/commit), one fd per frame, a single commit point after which nothing can be put back.
pkgs/mcpx/internal/pool/handoff.go (390 lines): pool Detach refuses while calls are in flight (ErrBusy), parks every other instance, carries stdio pipes beside the JSON as raw fds.
pkgs/mcpx/internal/mcpclient/stdio.go: plain os.Pipe()s instead of cmd.Std*Pipe so the ends can be passed to another process; a pending buffer for a partial frame interrupted by handoff; a detached state while another process owns the pipes.
- Costs already on record: takeover is unsupported on darwin (mcpx: takeover/upgrade/handoff unsupported on darwin; Linux-only tests break the darwin build #237); a takeover bug orphaned a removed server's upstream HTTP session (mcpx: takeover orphans a removed server's upstream HTTP session — never DELETEd, left to expire upstream #260, closed).
- Cross-repo theme (
ROADMAP.md): "Handing a running service to its successor."
Proposal (point of view)
- Per-instance, not per-daemon: the failure unit stays one server instance; the supervisor protocol never multiplexes, so the one component that must stay trivial stays trivial.
- Byte pump, not frame proxy, in v1: framing stays in the daemon's existing
StdioTransport reader (one home for the partial-frame logic). Child output produced while no daemon is attached goes to a bounded supervisor buffer; overflow keeps the tail and reports the dropped byte count on attach — loss visible, never silent.
- Same binary re-exec (pattern already used by
internal/cli/explore.go and the takeover successor path), not a second artifact: mcpx ships as one Nix package.
- Alternatives that lose, with reasons, are in the design doc: keep improving the handoff; one supervisor for all children; delegate to systemd/launchd (portability — the mcpx: takeover/upgrade/handoff unsupported on darwin; Linux-only tests break the darwin build #237 wound); separate supervisor binary.
Phased breakdown
- Phase 1 — supervised transport behind a flag. Hidden
mcpx supervise subcommand; supervised mcpclient transport with the same interface; per-server opt-in flag, default off. Defining test: SIGKILL the daemon mid-session, start a new one — child PID unchanged, next call succeeds. (Filed as a sub-issue of this design issue and enqueued for triage.)
- Phase 2 — takeover becomes attach for supervised instances. Successor attaches via state-dir scan; no
kindPipe/pools frames for supervised instances; listeners/HTTP keep the existing handoff. E2E supervised variant of internal/e2e/takeover_test.go asserting no pipe frames + PID continuity. (Not filed yet — its exact diff depends on Phase 1's socket protocol as built.)
- Phase 3 — supervised by default + lifecycle hygiene. Adopt-or-reap scan on daemon start,
mcpx restart through the supervisor, protocol-version refusal surfaced in status, darwin build/test parity shrinking mcpx: takeover/upgrade/handoff unsupported on darwin; Linux-only tests break the darwin build #237's skip list to the legacy handoff. (Not filed yet — the default-flip is part of the decision above.)
Open questions (in the design doc, deliberately not filed as issues)
- Buffer bound/policy for unattached child output (tail-drop vs backpressure).
- Opportunistic supervisor refresh on binary upgrade vs protocol versioning alone.
- Supervisor socket authentication beyond state-dir 0600 precedent (
internal/daemon/sessions.go).
Non-goals
- Cold-restart resume of upstream HTTP sessions (
TODO.md item 3) — a sibling design, separable, not bundled here.
- SSE upstream session mobility (
TODO.md item 2); ExecIdentity semantics (TODO.md item 4) — unchanged.
Related
Acceptance criteria
- The decision in the first line is recorded on this issue (adopt the per-instance supervisor, or keep investing in the takeover handoff), with the decider named.
- If adopted: implementation issues exist for each phase (supervisor subcommand + attach protocol; stdio instances migrated; takeover handoff retired for stdio), each with its own acceptance criteria, and this design issue links them.
- If not adopted: the rationale is recorded here and
pkgs/mcpx/TODO.md item 1 / the roadmap entry are updated to match, so the design thread does not stay dangling.
- No code changes land under this design issue itself.
Sub-issuesCollapse Sub-issuesSub-issues2 of 32 of 3 Issues completedLoading 3 sub-issues Activitydeveloping-today commented on Oct 27, 2026 added epicMeta-issue grouping multiple items (org Project Type=Epic) effort/lLarge: multi-day or open-ended; expect staged check-ins kind/designA design proposal (design-architect): multi-step, phased, decision-bearing on Oct 27, 2026dezren39 commented on Oct 27, 2026 dezren39 commented on Oct 27, 2026 Intake review
Related: pkgs/mcpx/TODO.md item 1 and planning/roadmaps/mcpx.md (the design thread this issue formalizes); #237 (takeover unsupported on darwin) and #260 (takeover orphaned-session bug) are the recorded costs of the status quo. Full design doc is in the fleet goal workspace (files/designs/code-mcpx-stdio-supervisor.md).
Notes: the issue is well-formed — evidence is file:line grounded (takeover.go, handoff.go, stdio.go) and the decision is stated in one line at the top, which is why it carries user/review. This is a design/decision item, not an implementation task.
Risks: a supervisor per instance adds a long-lived process per stdio server; the v1 byte-pump scope is the right constraint to keep it trivial.
Suggested approach: Drew/Muse decision first; on adoption, file the phase implementation issues in the same pass (per the fleet rule that a design never sits without an implementation link).
— fleet monitor intake enrichment, 2026-10-27. dezren39 commented on Oct 27, 2026 Decision recorded — Drew, 2026-10-27
Adopt the per-instance mcpx supervisor design. Drew approved it in the main chat (2026-10-27 ~13:04 CDT): "yes supervisor if that's the more sophisticated approach has strong advantages."
Direction:
- The stdio half of the takeover handoff is replaced by one supervisor per stdio instance (the mcpx binary re-executed as
mcpx supervise), owning each child's pipes for the child's whole lifetime and outliving the daemon.
- Phases 2–3 proceed with the supervisor as the default, per this issue's design.
- Stop investing in the takeover handoff for stdio; the HTTP half is unaffected by this decision.
This unblocks the gated mcpx tasks #1463, #1483, and #1484. The user/review label is removed with this comment — the decision the review was waiting on is made. dezren39 commented on Nov 19, 2026 Program tending — epic completion (tracking: #1352)
- Child progress: 4 of 4 children closed (0 open).
- Last movement: 2026-11-17T01:46:28Z.
- All recorded children are closed. Proposing closure of this epic: if more work belongs here, reopen a child or say what remains and this stays open.
dezren39 commented on Nov 26, 2026 Program tending — epic completion (tracking: #1352)
- Child progress: 4 of 4 children closed (0 open).
- Last movement: 2026-11-26T18:16:44Z.
- All recorded children are closed. Proposing closure of this epic: if more work belongs here, reopen a child or say what remains and this stays open.
developing-today-fleet commented on Nov 26, 2026 agent-note:v1
event: triaged
task: 24948 (repo-health-code-pilot, lane oc-code-05, coverage reconciliation)
verdict: #1384 stays OPEN. Not a small fix: no code change is needed here. Phase 1 (#1385) and Phase 2 are closed, Phase 3 PR #10767 merged, and the remaining open work is #9963, which needs Darwin runtime verification of #237 (existing blocked task 17495 waits on a Darwin runner). Related open defect #15407 (darwin supervisor socket path length, changed-server child retirement) is tracked separately.
next: when the Darwin check passes, close #9963, then close #1384. No new queue task is filed; the existing follow-up owns the remaining work. dezren39 commented on Nov 27, 2026 agent-note:v1 — xaltha lane, hourly work-loop 2026-11-26 18:41 CST, queue task 25451 (triage follow-on from 24948)
Triage verdict — #1384 stays OPEN; remainder is covered and blocked on #15407, not on a decision
Fresh claim-check this run (2026-11-27T00:49Z claim):
- Decision: ADOPTED and recorded here 2026-10-27 (comment 6449925704, Drew). Acceptance item 1 met; no owner decision remains.
- Sub-issues (API readback this run): mcpx: Phase 1 of #1384 — supervised stdio transport behind a flag (supervisor owns the child's pipes) #1385 Phase 1 CLOSED, mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962 Phase 2 CLOSED, mcpx: Phase 3 of #1384 — supervised stdio by default + lifecycle hygiene #9963 Phase 3 OPEN — so the program-tending "4 of 4 children closed" notes do not match the sub-issue record; mcpx: Phase 3 of #1384 — supervised stdio by default + lifecycle hygiene #9963 is the live remainder.
- mcpx: Phase 3 of #1384 — supervised stdio by default + lifecycle hygiene #9963 criteria 1–3 are met on main (PR feat(mcpx): supervised stdio by default + adopt-or-reap + restart through supervisor (#9963) #10767, plus PR mcpx: restore supervised stdio as the default (#9963) #15398 merged 2026-11-26 restoring supervised-by-default with per-instance socket keying and stop-reaping). Criterion 4 (darwin skip list) is partial: PR test(mcpx): shrink darwin skip list to legacy-handoff tests (#15397) #15414 shrank the list; 2 e2e takeover tests remain skipped, explicitly blocked on mcpx darwin: supervised takeover defects — supervisor socket path exceeds darwin limit; changed server's child not retired #15407.
- Blocker mcpx darwin: supervised takeover defects — supervisor socket path exceeds darwin limit; changed server's child not retired #15407 is already PR'd and claimed by that work, not duplicated here: PR mcpx: shorten supervisor socket path for darwin 104-byte limit (#15407) #15550 (branch
sweep/15407-sup-socket, head a6d9f96) is OPEN, mergeable/clean, but its Darwin acceptance run 45895786817 FAILED both tests (scoped child not adopted, pid -> 0; changed server's old child still running). Merge-watch task 24424 is parked until the PR head changes or a Darwin run passes on a new head. Pushing a competing fix or taking over that branch from this triage lane would duplicate live work.
- No code changes land under this design issue itself (acceptance item 3) — none were made.
Next / resume condition (not a person): when PR #15550's head changes and a Darwin run of TestClientLeaseSurvivesDaemonTakeover + TestTakeoverRestartsAChangedServerAndKeepsTheRest passes, #15407 lands, the 2 tests unskip, #9963 closes, and then this epic closes. Queue task 25451 is parked on that condition. developing-today-fleet commented on Nov 28, 2026
Lane 0937-D (alpha DRIVE 2026-11-28) fresh re-check, concurring with 0837-E: gate unchanged. All 20 comments on #1384 read (newest 2026-11-27T00:53:10Z). Firsthand this run: #9963 OPEN (unchanged since 2026-11-27T01:21:20Z), #15407 OPEN (unchanged since 2026-11-26T23:11:03Z), PR #15550 OPEN at the same head a6d9f96 (CLEAN/MERGEABLE) whose darwin acceptance already failed — no new head, so no new verification is possible. #1384 has no held/user/* label; its close is gated on #9963. Queue task 25451 re-parked with ready condition issue_closed #9963. Wake: #9963 closes (darwin verification passes / PR #15550 lands on a new head), then close #1384.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|