fix doctor/background control-plane health diagnostics for HTTP mode
Summary
Two CLI diagnostics paths currently misreport healthy HTTP control-plane setups:
memorix doctorprobes/health, but the HTTP control plane exposes/api/teamand/mcpin real usage.memorix background statuscan classify a livememorix serve-httpprocess as an unrelated reused PID when health probing fails transiently, even when the process command is actually Memorix.
Reproduction
Bug 1: doctor false negative
- Start the HTTP control plane with
memorix background startormemorix serve-http --port 3211. - Confirm the control plane responds on
http://127.0.0.1:3211/api/teamand completes MCP init/tool listing onhttp://127.0.0.1:3211/mcp. - Run
memorix doctor --json.
Expected
Doctor reports a healthy background control plane.
Actual
Doctor reports Background process is alive but health check failed. Try "memorix background restart". because it probes /health.
Bug 2: background status false reused-PID warning
- Start a real
memorix serve-httpprocess. - Arrange for a transient health probe failure or stale state path.
- Run
memorix background status.
Expected
Status distinguishes between a real Memorix process and an unrelated PID.
Actual
Status can print PID reused by unrelated process and clear state even when the PID command is actually memorix serve-http.
Verified locally
I verified the HTTP control plane responds via /api/team and MCP tool listing on /mcp, then reproduced the false CLI diagnostics against v1.0.6.
Proposed fix
- Reuse a shared control-plane health helper that probes
/api/team. - Add a narrow process-command check before treating a live PID as an unrelated reused process.
- Add CLI regression tests for the health path and PID classification helper.
I have a PR ready from a fork with the minimal fix and regression coverage.
Fixed in v1.0.7 memorix doctor now probes /api/team (the actual health endpoint) instead of /health which did not exist. This eliminates the false negative where doctor reports health check failed even when the control plane is running fine.
memorix background start on a current tsup build can spawn dist/index.js (stdio) instead of dist/cli/index.js serve-http, so the daemon exits immediately (stdin closed). Separate issue: the child may be $HOME/node_modules/memorix rather than the global install.
New write-ups: #219, #220. Fix direction: #214.