[fix]: auto-recover from unresponsive daemon
SH
6d ago+1048+1048+0123456789012345678901234567890123456789-16-16-01234567890123456789
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 / flow | Observed output | Confidence / sufficiency |
|---|---|---|
pnpm --filter browse build | Build and manifest succeeded | Validates the rebuilt CLI |
pnpm --filter browse lint | Formatting, lint, and TypeScript passed; existing unrelated lint warnings remain | Checks the complete CLI package |
pnpm --filter browse test:cli | 625 tests passed across 45 files | Includes 39 new process-identity and recovery regressions |
pnpm --filter browse test:smoke | Real Chrome smoke passed | Opens, interacts, stops, and restarts through separate CLI processes |
| Linux CLI recovery with a stale PID pointing to another session | New browser opened; the other session's PID remained alive and responsive | Exercises actual process inspection and session isolation |
Linux CLI recovery after freezing a daemon with SIGSTOP and removing its socket | Frozen daemon terminated; replacement daemon opened a new browser successfully | Exercises actual termination and respawn |
| Linux initialized-browser termination check | Owned Chrome exited after daemon termination | Confirms 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.