[fix]: auto-recover from unresponsive daemon

SH
6d ago
+1048-16

When a session has a live daemon PID but cannot answer status requests, Browse now waits for startup and automatically replaces a verified stuck daemon. Stale PIDs can be recovered without terminating another session.

Recovery verifies the exact daemon invocation and session before signaling. Failed or ambiguous inspection preserves the process and its files. The startup grace period waits for a successful status response, and recovery rechecks process identity and the PID file before termination and cleanup. A daemon exiting during recovery no longer causes a spurious failure.

E2E Test Matrix

Command / flowObserved outputConfidence / sufficiency
pnpm --filter browse buildBuild and manifest succeededValidates the rebuilt CLI
pnpm --filter browse lintFormatting, lint, and TypeScript passed; existing unrelated lint warnings remainChecks the complete CLI package
pnpm --filter browse test:cli625 tests passed across 45 filesIncludes 39 new process-identity and recovery regressions
pnpm --filter browse test:smokeReal Chrome smoke passedOpens, interacts, stops, and restarts through separate CLI processes
Linux CLI recovery with a stale PID pointing to another sessionNew browser opened; the other session's PID remained alive and responsiveExercises actual process inspection and session isolation
Linux CLI recovery after freezing a daemon with SIGSTOP and removing its socketFrozen daemon terminated; replacement daemon opened a new browser successfullyExercises actual termination and respawn
Linux initialized-browser termination checkOwned Chrome exited after daemon terminationConfirms existing browser-disconnect cleanup; forced termination can leave its temporary profile directory

Live checks ran on Linux. macOS and Windows command-line handling is covered by fixtures; native platform results depend on CI.