GeezerVison is showing github.com — feat(mcpx): supervised stdio by default + adopt-or-reap + restart through supervisor (#9963) by dezren39 · Pull Request #10767 · developing-today/code
Conversation
dezren39
commented
Nov 16, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Phase 3 of epic #1384 (issue #9963), on top of Phase 2 attach (#9962, PR #10719):
- Supervised stdio by default.
Extras.Supervised is now a *bool; parse materializes the default (true) for stdio servers in file-loaded configs, and "supervised": false is the opt-out into the legacy direct-spawn path. Aliases inherit only the supervised bit from their target — per-view extras (e.g. excludeTools) stay the alias's own. SupervisedEnabled() reads the resolved value; programmatically built configs keep the Phase 1 explicit opt-in.
- Restart through the supervisor. The supervisor protocol gains
restart and terminate handshake actions. RestartSupervised has the supervisor kill and respawn its child and attaches the requester to the new child (new PID; supervisor and socket survive). Pool.Restart uses it for supervised pools with no busy instances; busy instances keep the generic drain path.
- Adopt-or-reap scan.
mcpclient.ScanSupervisorSockets runs at daemon startup (via Registry.ReapOrphanedSupervisors, after the Phase 2 adoption scan): configured supervisors are left for adoption, orphaned supervisors are reaped via the terminate action with the reap logged, refusals (attached / version mismatch) are logged and left in place, stale socket files are removed.
- Protocol refusal in status. A protocol-version refusal during adoption is recorded as the pool's last error, so
mcpx status names it; mcpclient.IsProtocolRefusal classifies both refusal spellings.
- Test-binary re-exec guard.
testsupport.SuperviseReExec is wired into the pool and daemon test mains: with supervised as the default, a suite that dials stdio re-execs its own binary as the supervisor, and without the guard that re-exec runs the whole suite recursively.
Acceptance (#9963)
- Fresh daemon start with default config runs stdio servers supervised —
TestDefaultConfigStdioRunsSupervised (load file → resolve → acquire → supervisor socket + child PID), plus TestSupervisedDefaultsOnForStdioFromFile for the opt-out.
- Adopt-or-reap scan covered for both branches —
TestScanSupervisorSocketsAdoptAndReap (configured/adopt, orphan reap with log, stale removal).
- Status names a supervisor protocol-version refusal —
TestAdoptProtocolRefusalSurfacesInStatus + TestSupervisorProtocolRefusalIsClassified.
- mcpx: takeover/upgrade/handoff unsupported on darwin; Linux-only tests break the darwin build #237 darwin skip list shrinks to legacy-handoff only — not in this PR: all four affected test packages now cross-compile for darwin/arm64 (
go vet with GOOS=darwin, verified), but unskipping the takeover tests needs a darwin runner to prove they pass at runtime; this lane has no darwin machine. Recorded on mcpx: Phase 3 of #1384 — supervised stdio by default + lifecycle hygiene #9963 as the remaining item.
Tests
On the laptop, against this branch (rebased on current main):
go test ./internal/config/ ./internal/mcpclient/ ./internal/pool/ ./internal/daemon/ ./internal/buildcheck/ ./internal/testsupport/ — all pass.
go test ./internal/e2e/ -run TestTakeoverAttachesToSupervisedChild — passes.
- New tests: restart changes the child PID and keeps echo working (
TestSupervisedRestartThroughSupervisor), terminate reaps the child and removes the socket (TestSupervisedTerminateReapsChild).
Task 17484, lane any-d.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ough supervisor (#9963)
Phase 3 of #1384 (issue #9963), on top of Phase 2 attach (#9962):
- Supervised is now a *bool; parse materializes the default (true)
for stdio servers in file-loaded configs, with supervised:false
as the opt-out into the legacy direct-spawn path. Aliases inherit
only the supervised bit from their target (per-view extras like
excludeTools stay the alias's own). SupervisedEnabled reads the
resolved value; programmatically built configs keep Phase 1
explicit opt-in.
- Supervisor protocol gains restart and terminate actions.
RestartSupervised has the supervisor kill and respawn its child
and attaches the requester to the new child; Pool.Restart uses it
for supervised pools with no busy instances. Terminate is the
reap mechanism: it refuses while a daemon is attached.
- Adopt-or-reap scan (mcpclient.ScanSupervisorSockets): at daemon
startup, configured supervisors are left for the Phase 2 adoption
scan, orphaned supervisors are reaped with the reap logged,
refusals are logged and left in place, stale socket files are
removed. Registry.ReapOrphanedSupervisors wires it into Listen.
- A protocol-version refusal during adoption is recorded as the
pool's last error, so mcpx status names it (with
mcpclient.IsProtocolRefusal classifying both refusal spellings).
- Test binaries that dial stdio through pools (pool, daemon) handle
the supervisor re-exec via testsupport.SuperviseReExec: without
it the re-exec runs the whole suite as the supervisor.
Tests: config default + opt-out, pool fresh-daemon acceptance
(default config acquires supervised, socket present), adoption
refusal surfacing in Status().LastError, restart changes the child
PID and keeps working, terminate reaps the child and removes the
socket, scan adopt/reap/stale branches, protocol refusal
classification. Suites green: config, mcpclient, pool, daemon,
buildcheck, testsupport; e2e supervised takeover test passes.
Darwin (#237): all four affected test packages now cross-compile
for darwin/arm64 (go vet GOOS=darwin), but the package.nix
darwinSkip runtime list is unchanged in this PR: shrinking it
needs a darwin runner to verify the takeover tests actually pass
there, which this change does not have. Recorded on #9963.
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-16T13:51:28.352765Z We couldn’t complete this review. Comment @codex review to try again. |
0a5b9e0 |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 19 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:
2fcc83d2-b7e0-413d-9018-a0388bee8f2e
Commits
-
Reviewing files that changed from the base of the PR and between d644088 and 0a5b9e0.
Files selected for processing: 13
-
pkgs/mcpx/internal/config/config.go
pkgs/mcpx/internal/config/supervised_default_test.go
pkgs/mcpx/internal/daemon/main_test.go
pkgs/mcpx/internal/daemon/registry_handoff.go
pkgs/mcpx/internal/daemon/server.go
pkgs/mcpx/internal/mcpclient/supervised.go
pkgs/mcpx/internal/mcpclient/supervised_phase3_test.go
pkgs/mcpx/internal/mcpclient/supervised_scan.go
pkgs/mcpx/internal/pool/handoff.go
pkgs/mcpx/internal/pool/main_test.go
pkgs/mcpx/internal/pool/pool.go
pkgs/mcpx/internal/pool/supervised_default_test.go
pkgs/mcpx/internal/testsupport/supervise.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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
agent-note:v1
state: merge_ready
task: 17484
lane: any-d
Codex gate disposition: the Codex review run on this PR failed on Codex usage limits ("You have reached your Codex usage limits for code reviews") and produced no findings — pulls/10767/comments is empty and there are no review threads to disposition. CodeRabbit is likewise rate-limited. There is nothing substantive to fix or reply to; merging under the standing criteria on local verification instead: config, mcpclient, pool, daemon, buildcheck, testsupport suites all pass on this branch (rebased on current main), and the e2e supervised takeover test passes. CI runs on main.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 16, 2026
dezren39
pushed a commit
that referenced
this pull request
Nov 26, 2026
Phase 3 of #1384 landed the supervised default in #10767; #11343
paused it back to opt-in for two defects: the supervisor socket was
keyed by server name alone, so a server's second scoped instance was
refused by the first one's supervisor, and supervisors outlived
`mcpx stop`, breaking the no-orphan guarantee. This restores the
default with both defects fixed:
- parse materializes supervised=true for stdio servers again, so a
file-loaded config runs its stdio servers supervised unless it
opts out with "supervised": false.
- Supervisor sockets are keyed per instance (pool identity + scope
key): SupervisorSocketPathForInstance gives every scoped instance
its own socket, while the primary instance (empty or global scope
key) keeps the historical name-only socket, so supervisors started
before per-instance keying are adopted, not orphaned.
- The adopt-or-reap scan classifies sockets by the server segment
of the file name, so every instance of a configured server counts
as configured.
- `mcpx stop` (single and --all) reaps the stopped config's
supervisors via the new mcpclient.ReapSupervisors: supervisors
still outlive daemon restarts for adoption, but an explicit stop
terminates every instance of the config's servers.
Tests: config default test flipped to default-on semantics; new
mcpclient tests for socket keying, two instances of one server with
distinct supervisors and children, frontend-restart survival of a
scoped instance, and scan/reap across instances; pool headline test
now runs a default config with no supervised key, plus a two-scope
acquire test; cli test that stop --all reaps the stopped config's
supervisor and leaves another config's alone.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|