Title: design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio · Issue #1384 · developing-today/code · GitHub
Open Graph Title: design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio · Issue #1384 · developing-today/code
X Title: design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio · Issue #1384 · developing-today/code
Description: Decision 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 Replac...
Open Graph Description: Decision 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 ...
X Description: Decision 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 ...
Opengraph URL: https://github.com/developing-today/code/issues/1384
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio","articleBody":"**Decision 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?\n\n\u003c!-- decision above is why this carries user/review; the rest routes through normal fleet triage -->\n\n## Summary\n\nReplace 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.\n\nThis 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`).\n\n## Current state (evidence)\n\n- `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.\n- `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.\n- `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.\n- Costs already on record: takeover is unsupported on darwin (#237); a takeover bug orphaned a removed server's upstream HTTP session (#260, closed).\n- Cross-repo theme (`ROADMAP.md`): \"Handing a running service to its successor.\"\n\n## Proposal (point of view)\n\n- **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.\n- **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.\n- **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.\n- 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 #237 wound); separate supervisor binary.\n\n## Phased breakdown\n\n1. **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.)*\n2. **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.)*\n3. **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 #237's skip list to the legacy handoff. *(Not filed yet — the default-flip is part of the decision above.)*\n\n## Open questions (in the design doc, deliberately not filed as issues)\n\n- Buffer bound/policy for unattached child output (tail-drop vs backpressure).\n- Opportunistic supervisor refresh on binary upgrade vs protocol versioning alone.\n- Supervisor socket authentication beyond state-dir 0600 precedent (`internal/daemon/sessions.go`).\n\n## Non-goals\n\n- Cold-restart resume of upstream HTTP sessions (`TODO.md` item 3) — a sibling design, separable, not bundled here.\n- SSE upstream session mobility (`TODO.md` item 2); `ExecIdentity` semantics (`TODO.md` item 4) — unchanged.\n\n## Related\n\n- #237 (darwin takeover tests), #260 (closed; takeover orphan), #308/#309 (mcpx single-source), #1351 (design-architect job)\n- Files: `pkgs/mcpx/TODO.md`, `planning/roadmaps/mcpx.md`, `pkgs/mcpx/internal/daemon/takeover.go`, `pkgs/mcpx/internal/pool/handoff.go`, `pkgs/mcpx/internal/mcpclient/stdio.go`\n\n## Acceptance criteria\n\n- [ ] 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.\n- [ ] 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.\n- [ ] 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.\n- [ ] No code changes land under this design issue itself.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-27T10:08:42Z","url":"https://github.com/developing-today/code/issues/1384"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2dcb131e-14a1-270f-a2e4-a526ef52d4bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C520:3AABA8:329930:43F871:6B06180B |
| html-safe-nonce | 05322db91021d1b16b30559cd09048a792d906225e3c16bdb47c08da1bee3d49 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTIwOjNBQUJBODozMjk5MzA6NDNGODcxOjZCMDYxODBCIiwidmlzaXRvcl9pZCI6Ijc3NTU4MzEzMjQ3NzQzNzMzODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2109b34398de5b85ab9022886a760905b106816b1fde8a3783f17587004f9221 |
| hovercard-subject-tag | issue:6057078972 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1384/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b20b215bdc6e87495c0b40cde20cad8b7a89334cf2407289bcd99e36d4a953e7/developing-today/code/issues/1384 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b20b215bdc6e87495c0b40cde20cad8b7a89334cf2407289bcd99e36d4a953e7/developing-today/code/issues/1384 |
| og:image:alt | Decision 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width