Repository navigation
Closed
Description
Problem
The mcpx CLI in this repo never notices when the daemon it connected to was started by a different (older) binary. After an upgrade, a daemon started by the old binary keeps running, the new CLI talks to it over the socket/url ladder rungs, and a command or field the old daemon lacks fails confusingly instead of saying why.
This is the same defect as dezren39/darwin-nix#344 (fixed there by dezren39/nix PR #386, merged 2026-10-18); this repo's pkgs/mcpx copy does not have that fix.
Evidence (verified on main 2d56eb2, 2026-10-18)
- The daemon already reports its version:
pkgs/mcpx/internal/daemon/server.gohandleHealthreturns"version": s.versionin theGET /v1/healthanswer. - The CLI never reads that field:
- No
DaemonVersion()method inpkgs/mcpx/internal/cli/client.go— the neighbouringEndpoint()parses onlyendpointfrom the same/v1/healthanswer. - No
pkgs/mcpx/internal/cli/versioncheck.goexists (nodaemonVersionNotice,daemonVersionWarning, orcheckDaemonVersionanywhere inpkgs/mcpx/internal/cli/). App.ensure()inpkgs/mcpx/internal/cli/commands.go:81caches the client/ladder and returns without any version comparison.
- No
- Therefore a version mismatch is silent on every command that reuses an already-running daemon via the
socketorurlrungs (Connectinpkgs/mcpx/internal/cli/connect.go).
Why it matters
Upgrades are the normal path (mcpx upgrade, package updates). Without the notice, the first symptom of a stale daemon is a confusing per-command failure, with no hint that mcpx restart --daemon is the fix.
Suggested fix (mirrors dezren39/nix PR #386)
- Add
Client.DaemonVersion(ctx)inclient.go: GET/v1/health, parseversion; an older daemon reporting none yields""with no error (absence is not a mismatch). - Add
versioncheck.go:daemonVersionNotice(cli, daemon, remote)— empty when equal or either side empty; otherwise one line naming both versions, withmcpx restart --daemonadvice locally and "restart it where it runs" for a remote daemon.checkDaemonVersiononly runs forsocket/urlladder rungs (spawn/inline daemons run this binary by construction) and is best-effort (a failed health read stays silent). - Call
a.checkDaemonVersion(ctx, c, ladder)inensure()after a successful connect. - Port the regression tests from dezren39/nix (
versioncheck_test.go): notice table cases, health-server warning cases (mismatch / matching / no-version / unreachable), and the spawned-daemon skip.
Acceptance criteria
- With a daemon reporting a different version reached via socket/url, a CLI command prints exactly one stderr notice naming both versions and the restart command.
- Equal versions, a daemon reporting no version, and spawn/inline daemons produce no notice and no extra health call failure mode.
- New
versionchecktests pass;go test ./internal/cli/inpkgs/mcpxis green; ablation (removing theensure()call) makes the wiring test fail.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Merge pull request #266 from developing-today/creator/265-daemon-vers…