GeezerVison is showing github.com — mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances · Issue #9962 · developing-today/code
mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962DescriptionPhase 2 of epic #1384 — takeover becomes attach for supervised instances
Parent design: #1384 (adopted by Drew 2026-10-27: per-instance mcpx supervisor replaces the stdio takeover handoff). Phase 1 (#1385, supervised stdio transport behind a flag) closed 2026-10-28, so the socket protocol this phase depends on now exists as built.
Scope
- A successor daemon attaches to already-running supervisors via a state-dir scan; supervised stdio instances are adopted, not handed off.
- No
kindPipe / pools handoff frames are exchanged for supervised instances; child PIDs are unchanged across a daemon restart.
- Listeners and upstream HTTP sessions keep the existing takeover handoff unchanged.
Acceptance criteria
- E2E supervised variant of
internal/e2e/takeover_test.go: daemon restarts, asserts no pipe frames for supervised instances and PID continuity of the stdio child.
- Unsupervised (legacy) instances still take the existing handoff path, covered by the existing takeover tests.
- A daemon started against a state dir with running supervisors attaches without spawning duplicate children for the same server instance.
Filed by fleet triage (task 15159, lane code-d, 2026-11-14) per #1384's acceptance item 2: implementation issues exist for each phase. Activitydeveloping-today commented on Nov 14, 2026 dezren39 commented on Nov 14, 2026
agent-note:v1
state: triaged
Triage verdict (fresh, 2026-11-14): Phase 2's scope is confirmed against current main and packaged.
- Surface located:
pkgs/mcpx/internal/daemon/takeover.go carries the kindPipe/kindPools handoff this phase retires for supervised instances; the Phase 1 transport it builds on is pkgs/mcpx/internal/mcpclient/supervised.go (+ internal/cli/supervise.go); the E2E harness to variant is pkgs/mcpx/internal/e2e/takeover_test.go.
- Follow-on: queue task 16879 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:9962) — state-dir scan + attach on daemon startup, no handoff frames for supervised instances, PID continuity, duplicate-child guard, legacy path untouched, acceptance = the issue's own criteria.
Task 16787 completes as triaged naming task 16879.
dezren39 commented on Nov 16, 2026
agent-note:v1
state: parked
Verified against current main (2026-11-16) before parking on the run's wall clock. The packets's stated problem is materially narrower than the code — recording it so the next worker does not plan against the wrong surface:
- No pipe frames are currently sent for supervised instances, and none can be.
pool.Detach type-switches on the transport (pkgs/mcpx/internal/pool/handoff.go:111-125): only *mcpclient.StdioTransport and *mcpclient.HTTPTransport are handed on; *mcpclient.SupervisedTransport falls to default: continue. So acceptance item 1's "zero kindPipe frames" is already true by accident.
- The real defect is instance loss, not handoff churn. Because the supervised instance never enters
PoolHandoff.Instances (and never p.handed), Pool.Commit (handoff.go:132-150) closes it as "parked, not released" → SupervisedTransport.Close() detaches from the supervisor. The child survives (the supervisor owns it) but the successor loses the instance: MCP session state (era, calls, subscribed, StartedAt, exec identity) is dropped and the server is re-initialized lazily on the next call. That is the observable "restart disturbs instances" symptom Phase 2 must end, not a duplicate-child or pipe-frame symptom.
Client.Detach cannot be reused as-is: pkgs/mcpx/internal/mcpclient/handoff.go:181 returns only a stdio session can be handed off for any non-StdioTransport.
- No competing work: no open PR mentions mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962, no remote branch matches
9962/supervis (checked 2026-11-16T11:03Z). Issue open, unheld (held, user/owned, do-not-merge, do-not-auto-edit all absent).
Implementation shape the next worker can start from (not yet written):
pool.InstanceHandoff gains a supervised marker (server name is enough — the supervisor socket is mcpclient.SupervisorSocketPath(stateDir, name)), and Detach records supervised instances without calling Client.Detach, adding them to p.handed so Commit releases instead of closes them.
- Successor side (
daemon.takeover reception → commitTakeover): for a supervised instance, NewSupervised attaches to the live supervisor socket (attach-in-place, no spawn, PID continuous) and the client is built over the handed Session state without a fresh initialize.
sendChildren needs no pipe-frame work; the supervised marker must be carried in the existing kindPools frame.
- Tests: supervised variant of
pkgs/mcpx/internal/e2e/takeover_test.go (Mcpx.Supervised: true) asserting child-PID continuity across restart, exactly one child, and the session state surviving; the existing legacy takeover tests must stay unchanged. pkgs/mcpx suite (or clean-main failure set) per packet acceptance.
Resume condition: claim task 16879 again — the worktree/branch exist and are empty, and the four findings above are the whole starting context. dezren39 commented on Nov 16, 2026
agent-note:v1
state: in-progress (resumed)
Resume verified fresh (2026-11-16, lane code-c):
- Implementation already landed by the prior session: PR feat(mcpx): takeover becomes attach for supervised instances (#9962) #10719, head f08ddae, branch queue/16879-9962-mcpx-takeover-attach in worktree ~/git/fleet/queue-16879-9962-mcpx (7 files, +164/-6: daemon registry_handoff/server/takeover, pool handoff/pool, mcpclient supervised, e2e takeover_test with new TestTakeoverAttachesToSupervisedChild).
- PR feat(mcpx): takeover becomes attach for supervised instances (#9962) #10719 is OPEN, not draft, MERGEABLE / CLEAN, no labels (no hold). Issue mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962 OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels.
- Review bots: Codex review FAILED TO RUN (usage limits, zero findings — dispositioned as no findings to address); CodeRabbit rate-limited / skipping (no findings).
- The PR body says the full pkgs/mcpx suite run was recorded on mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962, but no such comment exists here — so this lane is re-running the targeted suites itself before merging: e2e TestTakeover* plus internal/pool, internal/daemon, internal/mcpclient on the laptop at the PR head.
- Note: an unverified claim payload for a different task (task 17477) was briefly acted on at this shift's start; it was disproven against the queue's claimed list + timeline (this lane's real claim is task 16879, claimed 12:10:04Z) and the stray fallback-claim attempt on PR feat(mcpx): takeover becomes attach for supervised instances (#9962) #10719 was killed before it posted anything.
Next: merge PR feat(mcpx): takeover becomes attach for supervised instances (#9962) #10719 when the re-run suites pass, then complete task 16879.
dezren39 commented on Nov 16, 2026
Done — PR #10719 merged (71e67a6a5c8dd73371098ec01325ac1ac1dd96f7), task 16879, lane any-c, 2026-11-16
Phase 2 landed as designed in #1384: takeover becomes attach for supervised instances.
- State-dir scan / adoption:
Registry.AdoptSupervised runs at daemon startup (Listen) and again in commitTakeover immediately after Adoption.Attach() — the point where the predecessor's commit has detached it from the supervisors. Each supervised pool with a live supervisor and no instance in its default lane adopts the child via Pool.AdoptRunningSupervised (attach-only startLaneMode/dialMode → mcpclient.AttachSupervised, which never spawns). No live supervisor, another daemon attached, or an instance already serving the lane are quiet no-ops — no duplicate children.
- No handoff frames: supervised instances remain excluded from
Pool.Detach's handoff (no kindPipe, no pools-frame entries) — adoption replaces handoff.
- PID visibility:
Instance.PID() now surfaces the supervised child's PID from the attach handshake (was 0, which made attach indistinguishable from respawn in status).
Acceptance, verified test-first (the new E2E failed before the change: successor reported PID 0 / no adopted instance):
TestTakeoverAttachesToSupervisedChild (new): child PID identical across daemon --takeover, calls answered through the same child, child survives the predecessor's exit.
- Existing takeover tests pass unchanged (
TestTakeoverKeepsTheChildAndTheListener, family in the full run).
internal/pool, internal/daemon, internal/mcpclient suites green.
- Full
pkgs/mcpx suite vs clean-main baseline at the branch's fork point (43766b9): every test passes on both. Package-level failures are identical in kind and unattributable to this change — internal/settings TestTheEnvironmentDocIsCurrent fails byte-identically on baseline (pre-existing stale doc), and the e2e package guards (feature-coverage ledger; real-daemon disturbance mcpx testing: e2e inherits the caller's environment -- build it from an allowlist so tests never reach the user's daemon #1992) fail on baseline too, with run-dependent identity on this loaded machine. TestThePluginSuiteRunsAgainstARealDaemon failed once inside the loaded full run and passes standalone on both branch and baseline.
dezren39 commented on Nov 16, 2026
agent-note:v1
state: done (verified independently by lane code-c)
Outcome: PR #10719 MERGED 2026-11-16T12:20:52Z (merge sha 71e67a6) by the parallel session holding the earlier claim; task 16879 completed in the queue at 12:21:45Z; this issue is CLOSED (status:done).
Independent verification by this lane at PR head f08ddae (run on the laptop in the PR worktree, via fleet-build-lock, module root pkgs/mcpx):
- go test ./internal/e2e/ -run TestTakeover -count=1 -v — PASS, all 5: TestTakeoverAttachesToSupervisedChild (new, 0.62s), TestTakeoverKeepsTheChildAndTheListener, TestTakeoverRestartsAChangedServerAndKeepsTheRest, TestTakeoverWithNoDaemonToTakeOverFails, TestTakeoverLosesNoCallsWhileAClientKeepsCalling.
- go test ./internal/pool/ ./internal/daemon/ ./internal/mcpclient/ -count=1 — ok pool 23.5s, ok daemon 81.3s, ok mcpclient 13.3s.
- Codex review on PR feat(mcpx): takeover becomes attach for supervised instances (#9962) #10719 failed to run (usage limits, zero findings); CodeRabbit rate-limited/skipping — no findings to disposition.
The full ./... suite re-run was cut short when the merge removed the worktree; every package the PR touches was covered by the targeted runs above.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|