Skip to content

test(mcpx): terminate examples supervisors in cleanup (#10853) - #10857

Merged
dezren39 merged 1 commit into
mainfrom
queue/17545-10853-supervise-leak
Nov 16, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/17545-10853-supervise-leak

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Fixes #10853.

Problem

go test ./examples/ passed every test but failed the #1971 testsupport sweep: each example's daemon spawns a supervised fixture server, and a supervisor outlives its daemon by design (so a later daemon can reattach to the same child). The suite's state directory is throwaway — nothing ever reattaches — and the only reap path (the daemon's adopt-or-reap scan) runs at daemon start and only for servers no longer configured. So every example leaked its mcpx supervise process and its fakemcp child past the suite, the sweep failed the package, mcpx's nix checkPhase failed with it, and the amd toplevel build for the 2026-11-16 nixpkgs update (PR #10817) could not complete.

Fix

Suite-side, in the examples cleanup: after mcpx stop --all, terminate this test's supervisors explicitly via mcpclient.TerminateSupervisorSocket over the test state dir's sup-*.sock sockets (with a short retry loop, since a supervisor refuses while a daemon is still attached and stop --all detaches asynchronously). Production behaviour is unchanged: supervisors still survive daemon restarts wherever a future daemon may reattach.

Tests

  • Before: go test ./examples/ -count=1 — all tests PASS, sweep FAIL (8 surviving processes); single subtest TestExamples/discover reproduces with 2 survivors.
  • After: go test ./examples/ -count=1 — ok github.com/developing-today/code/pkgs/mcpx/examples 52.970s, no sweep failure.
  • go vet ./examples/ clean.
  • mcpx nix derivation: nix build .#mcpx — see PR checks / comment.

Queue: task 17545, lane any-b. Unblocks task 17502 (dep-blocked on #10853) and PR #10817.


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

Summary by CodeRabbit

  • Tests
    • Example test cleanup now also terminates remaining background supervisors, with retries to improve cleanup reliability. Cleanup errors are logged without causing the test to fail.

@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 18:54
@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-16T18:54:48.055573Z
We couldn’t complete this review. Comment @codex review to try again.
37e0f1b 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

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Example-test cleanup now stops all mcpx daemons, then locates supervisor sockets in the test state directory and retries supervisor termination up to 10 times with 200 ms delays. Glob and final termination errors are logged without failing the test.

Changes: Example-test supervisor cleanup

Layer / File(s) Summary
Terminate test supervisors
pkgs/mcpx/examples/examples_test.go
Cleanup calls a new helper after mcpx stop --all. The helper finds supervisor sockets, retries termination, and logs glob or final termination errors without failing the test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 37e0f

This adds cleanup so the examples test suite terminates the supervisors it starts, which should stop the process-sweep failure. Production behavior is unchanged and no actionable risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test(mcpx): terminate examples supervisors in cleanup (#10853)" matches the main change. The PR adds cleanup to the examples test that terminates the test's supervisors through sup-*.sock f…
Linked Issues check Passed Linked issue #10853 is the only active direct target. Its coding requirement is that go test ./examples/ -count=1 leave no surviving supervise or fakemcp processes. The diff at examples_test.go …
Out of Scope Changes check Passed The whole-PR diff against the merge base touches one file, pkgs/mcpx/examples/examples_test.go, with +33 lines. It adds the mcpclient import, a call in the existing cleanup, and the `terminateSupervis…
Full details: Title check

Explanation

The title "test(mcpx): terminate examples supervisors in cleanup (#10853)" matches the main change. The PR adds cleanup to the examples test that terminates the test's supervisors through sup-*.sock files after mcpx stop --all. It is a test-only change and the title names the scope (mcpx), the action (terminate supervisors), and the location (cleanup). It references the linked issue #10853 in parentheses, which is acceptable.

Full details: Linked Issues check

Explanation

Linked issue #10853 is the only active direct target. Its coding requirement is that go test ./examples/ -count=1 leave no surviving supervise or fakemcp processes. The diff at examples_test.go adds a terminateSupervisors call to the runExample t.Cleanup, after mcpx stop --all. That helper globs sup-*.sock in the test state directory and calls mcpclient.TerminateSupervisorSocket with 10 attempts at 200 ms intervals. This directly targets the leak described in the issue. The PR does not change production supervisor lifecycle, which matches the issue's acceptance scope for the examples suite. The issue's acceptance also names the mcpx Nix derivation build and the amd toplevel build. These are build outcomes, not coding requirements, and this review does not verify them. The PR description reports go test ./examples/ -count=1 passing with no sweep failure, but the review did not run the test. The call target TerminateSupervisorSocket is not in the changed files; it compiles only if it already exists at the merge base in internal/mcpclient, which the diff does not touch. That existence was inferred from the unchanged package, not read directly.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches one file, pkgs/mcpx/examples/examples_test.go, with +33 lines. It adds the mcpclient import, a call in the existing cleanup, and the terminateSupervisors helper. Every change serves the objective of issue #10853, which is to stop supervisor leaks from the examples suite. No unrelated code, production behaviour, or configuration changes appear in the diff.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

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: 8c84e958-d003-47f7-b8fd-5f4c6412a2f1
Commits

Reviewing files that changed from the base of the PR and between 443b1c2 and 37e0f1b.

Files selected for processing: 1

  • pkgs/mcpx/examples/examples_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@dezren39

Copy link
Copy Markdown
Member Author

agent-note:v1 — Codex disposition (task 17545, lane any-b): the Codex code review FAILED on usage limits (chatgpt-codex-connector[bot], 2026-11-16T18:54Z) and posted zero inline findings; the summary's has_unresolved_findings flag reflects the failed review state, not a finding. Nothing to fix or rebut. CodeRabbit: SUCCESS, no findings. Local verification stands in for CI: go test ./examples/ -count=1 ok; nix build .#mcpx full checkPhase NIX_EXIT=0. Merging under the standing criteria.

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.

main-breakage: mcpx examples suite leaks supervise processes — nix checkPhase fails, amd toplevel blocked

1 participant