fix(plugins): serverIsLive() falsely reported a server as running

resolveAllDashboardPorts() falls back to [DEFAULT_PORT] when the discovery
file has no live entry — a reasonable guess for the CLI/hook handler, but
wrong for the bootstrap's own liveness check: with no server running at all,
the bootstrap believed one was already up and never called startDashboard(),
confirmed against a real plugin install where the dashboard never started.
plugin-doctor.js's "Server" row had the same bug. Both now read the discovery
file directly and check PID liveness via the new liveServers() (livePids()
reused it instead of duplicating the read).
This commit is contained in:
2026-08-10 16:22:13 +07:00
parent 022b2384ac
commit a65ee1512e
3 changed files with 57 additions and 22 deletions
+4 -11
View File
@@ -16,7 +16,6 @@ const path = require("path");
const boot = require("./plugin-bootstrap");
const { isOurEntry } = require("./install-hooks");
const { getSettingsPath, getDataDir } = require("../server/lib/claude-home");
const { resolveAllDashboardPorts } = require("../server/lib/server-info");
const { mcpBuildStatus } = require("./check-mcp-build");
const PLUGIN_ROOT = path.resolve(__dirname, "..");
@@ -63,18 +62,12 @@ function diagnose() {
deps ? path.join(rt, "node_modules") : "missing — run /ccam-update"
);
const ports = (() => {
try {
return resolveAllDashboardPorts();
} catch {
return [];
}
})();
const live = boot.liveServers();
add(
ports.length ? "ok" : "fail",
live.length ? "ok" : "fail",
"Server",
ports.length
? `listening on ${ports.map((p) => `http://localhost:${p}`).join(", ")}`
live.length
? `listening on ${live.map((s) => `http://localhost:${s.port}`).join(", ")}`
: `not running — see ${path.join(rt, "server.log")}`
);