fix: no unauthenticated path in live-server liveness

greptile-apps[bot]: the legacy fallback (server.json without port or
token) accepted a pid-only record on Windows without identity. Every
server.json this codebase has ever written records port and token, so a
record without them is malformed or foreign; it now classifies as not
live and resolution falls to the durable-session tier, the correct
recovery path for a crashed helper. The ps-based identity heuristic is
gone with it: authentication or nothing.

This work was produced with AI assistance (Claude Code).

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-07-28 15:03:10 -07:00
co-authored by Claude Code
parent 16a84bc390
commit 6997e4bdb5
+6 -8
View File
@@ -330,14 +330,12 @@ function hasLiveServer(appRoot) {
return false;
}
}
// Legacy server.json without a port/token: best-effort identity check.
if (process.platform === 'win32') return true;
try {
const command = execFileSync('ps', ['-p', String(pid), '-o', 'command='], { encoding: 'utf-8' });
return /live-server|\b(node|bun)\b/.test(command);
} catch {
return false;
}
// Every server.json this codebase has ever written records port + token
// (see writeLiveServerInfo). A record without them is malformed or foreign
// and cannot be authenticated, so it does not count as a live helper;
// resolution falls to the durable-session tier, which is the correct
// recovery path for a stopped or crashed helper anyway.
return false;
}
const TERMINAL_SESSION_PHASES = new Set(['completed', 'discarded']);