Skip to content

feat(mcpx): takeover becomes attach for supervised instances (#9962) - #10719

Merged
dezren39 merged 1 commit into
mainfrom
queue/16879-9962-mcpx-takeover-attach
Nov 16, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/16879-9962-mcpx-takeover-attach

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 2 of #1384: a successor daemon now adopts already-running supervised stdio instances by attaching to their supervisors, instead of leaving them out of the restart story. Supervised instances still exchange no kindPipe/pools handoff frames (Pool.Detach already excluded them); what was missing was the successor-side adoption and PID visibility.

Closes #9962.

Changes

  • mcpclient: AttachSupervised — attach-only entry point (never spawns; no socket, dead socket, or a live supervisor's refusal are all errors).
  • pool: dial/startLane thread an attach-only mode (dialMode/startLaneMode) that only changes the supervised branch. New Pool.AdoptRunningSupervised — the state-dir scan: for a supervised pool with no instance in the default lane, attach to the running supervisor and install the child as the pool's instance; quiet no-op when no supervisor is live, another daemon is attached, or the pool already serves the lane (no duplicates).
  • pool: Instance.PID() now surfaces the supervised child's PID from the attach handshake (was 0 — status could not distinguish attach from respawn).
  • daemon: Registry.AdoptSupervised runs the scan over all pools, called at daemon startup (Listen) and again in commitTakeover right after Adoption.Attach() — at startup a live predecessor may still be attached (scan no-ops); after the commit the predecessor has detached and the attach succeeds.

Tests

  • New E2E TestTakeoverAttachesToSupervisedChild: supervised variant of the takeover test — child PID identical before/after daemon --takeover, calls answered through the same child, child survives the predecessor's exit. The test retires the child itself at cleanup (it outlives every daemon by design).
  • Existing TestTakeoverKeepsTheChildAndTheListener and the rest of the takeover family pass unchanged (unsupervised handoff untouched).
  • internal/pool, internal/daemon, internal/mcpclient suites green; full pkgs/mcpx suite run recorded on mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances #9962.

Verified test-first: before the change the variant failed with the successor reporting PID 0 for the supervised instance (no adoption, PID not surfaced).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 11:43
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T11:43:08.947723Z
We couldn’t complete this review. Comment @codex review to try again.
f08ddae PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e91c9226-762e-4933-bbfa-3ca7edead05e
Commits

Reviewing files that changed from the base of the PR and between 67596fc and f08ddae.

Files selected for processing: 7

  • pkgs/mcpx/internal/daemon/registry_handoff.go
  • pkgs/mcpx/internal/daemon/server.go
  • pkgs/mcpx/internal/daemon/takeover.go
  • pkgs/mcpx/internal/e2e/takeover_test.go
  • pkgs/mcpx/internal/mcpclient/supervised.go
  • pkgs/mcpx/internal/pool/handoff.go
  • pkgs/mcpx/internal/pool/pool.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39

Copy link
Copy Markdown
Member Author

Picked up by repo-worker-code-c — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-c posts progress markers; after 30 minutes of silence any other worker may pick this up.)

@dezren39
dezren39 merged commit 71e67a6 into main Nov 16, 2026
1 check passed
@dezren39
dezren39 deleted the queue/16879-9962-mcpx-takeover-attach branch November 16, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx: Phase 2 of #1384 — takeover becomes attach for supervised stdio instances

1 participant