feat(recovery): bound remote health and runner-busy recovery by the command's deadline
Summary
Before, callers wrapped read-only commands in their own retry loops because recovery used fixed counts. This PR bounds two recovery paths by the command's own deadline. 15 files.
- Remote
/healthgate (daemon-client): when the probe before the first send gets a 5xx or times out, it probes again every second, for up to the command's request timeout. Nothing was sent, so this is safe for UI actions too. A refused connection still fails at once, so a URL with nothing listening never waits. The wait does not shorten the dispatched command's budget, because a command sent with too little time left could time out after reaching the device.remote_daemon_unavailablenow reportsdetails.attempts. - Apple
RUNNER_BUSY(apple-runner): read-only commands resend until 2 s before the request deadline (getRequestDeadlineMs, added to the runner host port), instead of 8 attempts (≈5.4 s). Transport resends keep 3 attempts. Mutations are sent once. The final refusal reportsdetails.attempts. A busy read now takes up to about 58 s to fail instead of about 5 s.
Not in this PR (follow-ups for #4522):
- Android: a typed
device not foundobservation and deadline-bounded waits after boot or helper install. This stays after #4426, which owns the typed adb boot observations (still unpublished). - The re-probe on the instance-mismatch restart retry.
- Known edge: inside
batch/replay(60 s execution deadline), a busy resend the runner executes in the last ~1 s can end as the request-deadline error withoutattempts. Plain reads are unaffected.
Part of #4522 (not closing: Android remains). Related: #4426.
Validation
At head 43fd323c2a: focused vitest, all passing: apple-runner project (963), daemon-client remote-health/index/explicit-lifecycle/transport + CLI refusal (70), platform-apple core + test-kit (467). pnpm typecheck, pnpm format, and oxlint are clean. Mutation check: reverting each production change fails the new tests. CI owns check:affected. No device run: these are host-side retry decisions, tested at each owner without devices.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.