Repository navigation
test(mcpx/e2e): retire the state-dir test's daemon and supervisor under its own overrides - #17127
Merged
Merged
Conversation
added 4 commits
November 30, 2026 05:42
…not leak TestStateDirectoryIsReachableAsASetting starts its daemon under an overridden state directory (MCPX_PATHS_STATE) and retired it with a plain `mcpx stop`. Plain stop recomputes the socket path from the environment, misses the socket the daemon actually bound, and reports 'not running' with a nil error, so the daemon and its fake server survived every run and tripped the suite-wide leak sweep (#1971) as the sole failure of the first post-#16797-fix main mcpx run (46347206165, see #3016). Stop it with `stop --all` while the override is still in the env — --all finds the daemon through the info files recorded in the overridden state directory, the same mechanism newEnv's cleanup uses — and assert the stop landed, so a future miss fails in this test instead of leaking silently.
…override The daemon stop alone is not the whole leak: the daemon's supervisor and its fake server are registered under the overridden state directory, and supervisors are built to outlive the daemon. A process listing after a stop --all run shows the daemon dead but the supervisor (mcpx supervise) and fakemcp still running — the pair the suite sweep reports. newEnv's cleanup StopSupervisors aims at the env's original state directory and cannot see them; retire them in the test, under the override, with the harness's own mechanism.
Correction to the previous commit's aim: the daemon's registry handoff keys supervisor sockets by mcpclient.StateDir() — the environment-derived state directory (MCPX_STATE_DIR, else $HOME/.local/state/mcpx) — not by paths.state. This test removes MCPX_STATE_DIR, so its daemon's supervisor registered under <dir>/home/.local/state/mcpx (in the hashed fallback dir for that string), and a reap keyed on the paths.state override globs an empty directory and returns success. Aim StopSupervisors at the directory the supervisor actually registered under.
Second correction to the aim: mcpclient.StateDir() checks XDG_STATE_HOME before HOME, and testsupport.ChildEnv sets XDG_STATE_HOME=<dir>/.local/state for every child, so this test's daemon registered its supervisor under <dir>/.local/state/mcpx — not under $HOME/.local/state/mcpx as the previous commit aimed. The hashed fallback directory the supervisor was observed in is keyed by exactly that string.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
TestStateDirectoryIsReachableAsASetting(pkgs/mcpx/internal/e2e) was the leaking test behind the #3016 criterion-3 wake failure: the #1971 post-suite sweep found exactly its two survivors — a supervisor and its fakemcp child — deterministically. This PR makes the test retire both halves of what it started:stop --allwhile the paths.state override is still active, and asserts the stop landed. The old plainstoprecomputes the socket path from the environment, misses the socket this daemon bound (its state lived under the override), prints "daemon: not running" and returns a nil error — a silent miss that read as success.<dir>/.local/state). Every reap keyed on paths.state misses it, including the StopSupervisors in newEnv's cleanup (aimed at the env's MCPX_STATE_DIR). The test now callstestsupport.StopSupervisorson the directory the supervisor actually registered under.Identification (all remote, on main @ c19554e)
TestStateDirectoryIsReachableAsASettingleaks alone, 2 processes; the other five clean (run 46360137399).mcpx supervise --socket /tmp/mcpx-sup/<hash>/sup-….sock, reparented to init) and its fakemcp child.Verification (this branch, fleet-command)
-count=3— package ok, no sweep line; the six-test sub-chunk-count=1— package ok, no sweep line. (Earlier gate iterations against intermediate fix attempts leaked on both legs: 46361736865, 46364333207, 46366657217.)Scope
Test-only change (one file). References #3016 (blocker (a) of the three standing blockers for a green criterion-3 follow-up) and #1971. This does not close #3016: the InlineDaemonPoll timing failure and the macOS supervisor failures from run 46347206165 remain open there.
One observation for maintainers, recorded on #3016: newEnv's cleanup aims StopSupervisors at the env's MCPX_STATE_DIR (
<dir>/state), while supervisors register under the XDG-derived mcpclient state dir (<dir>/.local/state/mcpx). For ordinary tests the daemon's own exit path covers the difference; this test is where it surfaced. Not changed here — test-local fix only.— lane 0640-KT (Felix)
{ "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-30T07:30:04Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch", "repo": "developing-today/code", "branch": "main", "sha": "010b47d1c4cecdcd1b7d6ea260b7c9b0a61fb89e" }, "auth_subject": "felix", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.