mirror of https://github.com/garrytan/gstack.git
startServer polls /health for MAX_START_WAIT, then throws "Server failed to start within Ns" on timeout. But the server is spawned detached + unref'd, so it keeps booting independently of the CLI's poll loop. On a loaded machine the daemon can become healthy in the gap between the loop's final tick and the throw — the very next `browse status` shows it listening and healthy. The probe timed out; the launch did not. - Add a final readState() + isServerHealthy() re-check before the timeout throw, mirroring the post-loop recovery already in ensureServer(). A genuinely failed server stays unhealthy and falls through to the existing error report. - Make the startup budget overridable via BROWSE_START_TIMEOUT (ms) through a new pure, exported resolveStartTimeout() — matching the BROWSE_* tunable convention in server.ts — so hosts where even the platform ceiling is too low have an escape hatch. Complements #1732 (which only raised the constant): this removes the false-negative at the throw site itself, on any platform/load. Test: browse/test/cli-start-final-healthcheck.test.ts — behavioral coverage of resolveStartTimeout overrides + a static invariant that the final re-check sits between the poll loop and the throw. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||