Repository navigation
fix(daemon-client): decide that a daemon is unresponsive with the same three probes on every path - #4808
Conversation
…e three probes on every path A timed-out request retired a daemon after one missed 1 s liveness probe, while ensureDaemon required three. Both now ask one helper in the probe module, so the evidence for ending a daemon is the same everywhere. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
|
This PR is ready at 06f1bc6. The code has no problems, all 19 checks pass at this commit, and there are no conflicts. This change is daemon-client liveness policy, so no live device run is needed. Not blocking, and you can take or leave these: the route test at daemon-client-timeout-route.test.ts:286 asserts the probe count, but no row covers the reported failure, where a healthy daemon misses the first probe and answers a later one (a row with |
* origin/main: refactor(apple-runner): generate the Swift runner error-code enums from runner-contract.ts (#4810) fix(daemon-client): report a newer daemon that won a startup race as daemon-incompatible (#4801) feat(shake): add a shake command for iOS simulators and Android emulators (#4741) fix(daemon): give a closing daemon its full teardown before anything kills it (#4806) fix(android): use typed evidence in the readiness boot poller (#4717)
…nswers a later one Also makes the unanswered-probe hints plural and corrects the pin comment. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Review notes addressed in e20757d (main merged in; no conflict with #4806).
|
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
Problem
Two paths end a daemon because it answers nothing, and they required different evidence:
ensureDaemon()asks three liveness probes (1 s each, 200 ms apart) before it force-retires a daemon.daemon-client-timeout.ts) asked one probe, then sent SIGKILL.One missed probe is the weaker evidence on the path that kills without a grace period. On an overloaded shared host a healthy daemon can miss a single 1 s window.
Change
answersLivenessProbemoves fromdaemon-client-ensure.tsintodaemon-client-liveness-probe.ts, with its probe count and gap, and takes the samesessionparameter as one probe. Both paths call it. The copy and its two constants indaemon-client-ensure.tsare deleted.Cost: a timed-out request against a daemon that answers nothing reports its error up to 2.4 s later (three windows and two gaps, 3.4 s in total, was 1 s). A daemon that answers the first probe costs the same as before. The verdict stays far under the shortest reset-eligible request envelope (90 s default).
Evidence
daemon-client-timeout-route.test.ts: the rows "resets a daemon that answers no probe endpoint" and "an attach client leaves a daemon that answers no probe running" now observe 4 connections (the request and three probes). They fail onmain's code, which makes 2.packages/daemon-client: 39 files, 348 tests pass. Typecheck, lint, the production-exports audit, the eager-closure gate and the layering scan pass. No allowlist, baseline or budget rows.Size
Production: +24 −16, net +8 lines (the helper's doc comment and the
sessionparameter). No new module on an entry closure, so the built CLI startup cost does not change.Note: this touches lines next to #4806 in
daemon-client-ensure.ts; whichever merges second needs a trivial rebase.Part of #4649.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.