Skip to content

test(mcpx/e2e): retire the state-dir test's daemon and supervisor under its own overrides - #17127

Merged
developing-today-fleet[bot] merged 4 commits into
mainfrom
kt-3016-state-dir-stop
Nov 30, 2026
Merged

developing-today-fleet[bot] merged 4 commits into
mainfrom
kt-3016-state-dir-stop

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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:

  1. The daemon — the test now stops it with stop --all while the paths.state override is still active, and asserts the stop landed. The old plain stop recomputes 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.
  2. The supervisor + fake server — supervisors are built to outlive the daemon, and this one never registered under paths.state: the supervised transport keys supervisor sockets by the environment-derived mcpclient state dir (MCPX_STATE_DIR, which this test removes; then $XDG_STATE_HOME/mcpx — the harness sets XDG_STATE_HOME to <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 calls testsupport.StopSupervisors on the directory the supervisor actually registered under.

Identification (all remote, on main @ c19554e)

  • 14 daemon-manipulating tests: clean (run 46355360165).
  • All 634 e2e tests in 14 chunks: only chunk 12 leaked (runs 46356352563, 46356408604).
  • Chunk 12 in sub-chunks of 8: sub-chunk 6 leaked (run 46358801206).
  • Singles: TestStateDirectoryIsReachableAsASetting leaks alone, 2 processes; the other five clean (run 46360137399).
  • Process evidence (run 46363066302 and follow-ups): the daemon itself dies (idle-exit backstop); the persistent survivors are the supervisor (mcpx supervise --socket /tmp/mcpx-sup/<hash>/sup-….sock, reparented to init) and its fakemcp child.

Verification (this branch, fleet-command)

  • Gate run 46372919277: the single test -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-bot with what you need.

FELIX 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.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: dad9b9e9-e0b7-443a-851d-2c1468907f4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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 nightly stress failure

0 participants