perf(remote): let lease admission check a reused lease instead of a heartbeat
Summary
Admission already renews a lease, so the CLI skips the heartbeat on a reused one when that request's /health reports lease-admission with every instance ID (a proxy's only through its upstream). An undispatched inactive-lease refusal, or the client's own unsent refusal, reruns once. Device commands go from 3 requests to 2.
The heartbeat stays for macos-app and runtime-backed leases, admission-exempt commands, installs, batch/replay/test, fill --text-stdin, --save-script, Metro preparation, non-canonical lease IDs, another daemon or owner scope than the saved connection, and by-spec opens naming a spec, selector, or no stored device. Marked requests never take /rpc/checked; one request per step there is a follow-up.
Daemon: device work on a dead lease is refused before teardown. close and lease commands still end the session; for a removed lease they start its lease end without waiting. The CLI daemon transport moved modules (line limit).
Security
No resend on timeouts, 5xx, scope mismatch, a daemon-claimed unsupported capability, or missing no disclosure. Refusals after teardown claim no verdict. Fill redaction restores only typed dispatched and lease reason.
Validation
Head 53800bd02 on b69cf45: 233 lease, changed, wire-compat and eager-closure test files (3069 tests), lint, typecheck, layering and Fallow pass (6082299 ran 828 files). Review fixes have tests failing without them; Metro open after lease expiry heartbeats, allocates, sets up the bridge, then opens on one lease. Not run on a device; CI pending.
Hot-path timing from an earlier head (50 ms each way, emulator, n=10):
command base req p50/p90 head req p50/p90
open repeat 3 2064/2375 2 1986/2306
snapshot -i 3 878/930 2 710/1018
press 3 580/647 2 577/623
fill 3 950/995 2 925/1610
screenshot 4 826/948 3 670/845
round trips/call ~312 -> ~208 ms; 10-step loop 30 -> 21 requests
š¤ Generated with Claude Code