Repository navigation
fix(mcpx): scan classifies a terminate dropped by an exiting supervisor as stale (#16639 part 1) - #16654
Conversation
…#16639) Failing-first for part 1 of #16639: a supervisor already exiting after an earlier terminate drops the scan's second terminate handshake without replying, and the scan reports terminate-failed (supervisor terminate: EOF) instead of stale. The new test stands up a fake listener that accepts and closes without replying, in both the clean-exit (EOF) and reset shapes.
…or as stale (#16639) A supervisor that accepted an earlier terminate replies, then kills its child and exits — but its listener and socket file outlive the reply until the child is dead. A second terminate in that window (the adopt-or-reap scan after mcpx stop --all already reaped) dials the still-open listener and the supervisor process goes away mid-handshake: the reply read sees EOF, a reset, or a broken pipe. isStaleSocketErr now classifies those alongside the dial-side gone signals, so the scan reports stale-removed instead of terminate-failed. A live supervisor always answers a terminate (success or refusal), so a dropped handshake never classifies a live supervisor as stale. Fixes the nine darwin e2e cleanup failures in run 46226123783 (supervisor terminate: EOF).
|
Warning Review limit reachedYou'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 51 minutes. View limit details
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. |
|
Lane 0156-W-E verification dispatched at head
Merge only on concluded SUCCESS at this exact head. |
|
Verification update at head
|
|
Lane 0252-C (bravo SUSTAIN landings) — merging on full-diff verification. Diff read in full (2 files, +70/-1): |
|
Final verification record (lane 0156-W-E): the baseline control has now concluded and confirms the merge adjudication.
Merged at exact head |
Closes #16639 (part 1; part 2 landed in #16641)
Problem
On darwin, the mcpx nix build's checkPhase failed nine
internal/e2etests whose assertions had all passed — they failed at cleanup
(
e2e_test.go:133) with:(fleet-command run 46226123783 on main
9d3c4ffc9b.)Root cause
The e2e cleanup first runs
mcpx stop --all, which reaps everysupervisor (sends terminate), and then
testsupport.StopSupervisorsscans the state dir and sends a second terminate to any socket
still present. A supervisor that accepted the first terminate
replies, then kills its child and exits — but until the child is
dead the listener stays open and the socket file stays on disk.
On darwin the child teardown is slow enough that the scan's second
terminate reliably lands inside that exit window: the dial succeeds
against the still-open listener, the supervisor process goes away
mid-handshake, and the reply read returns EOF (or the connection
resets / the write hits a broken pipe).
terminateScanSocketclassified that as
terminate-failed, andStopSupervisorssurfaced it as a cleanup error.
A live supervisor always answers a terminate — success or refusal —
so a dropped handshake means the supervisor is already gone or
going: for a reap, the goal is already met.
Fix
isStaleSocketErrininternal/mcpclient/supervised_scan.gonowalso classifies
io.EOF,ECONNRESET, andEPIPEfrom theterminate handshake as stale, alongside the existing dial-side
signals (
ECONNREFUSED,ENOTSOCK, not-exist). The scan removesthe socket file and reports
stale-removedinstead ofterminate-failed. No skip-list changes; no test was skipped.Test
Failing-first:
TestScanClassifiesExitingSupervisorAsStaleinsupervised_phase3_test.gostands up a fake listener that acceptsthe scan's connection and closes it without replying — the
clean-exit (EOF) shape and the reset shape. Before the fix it
reports
terminate-failed/supervisor terminate: EOF; after,stale-removed.Verification
8eae21c43): fleet-command run46241151672 — FAILURE as expected (exact output in the run log).
go test ./internal/mcpclient/ -count=1plus the new test under-race -shuffle=on -count=5.—
nix build .#packages.aarch64-darwin.mcpx --print-build-logsat the exact PR head; checkPhase passes with no
supervisor terminate: EOFcleanup failures.{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-29T08:13:54Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch/workspace/github-work/code-16639", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch/workspace/github-work/code-16639", "repo": "developing-today/code", "branch": "xaltha/16639-supervisor-terminate-eof", "sha": "12dd3b32db45d348d38bdefa772cc6ffee96f780" }, "auth_subject": "xaltha", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.