perf(daemon-client): replay a built checkout's code signature from the stat cache
Summary
A client in a checkout fingerprints the daemon entry it would launch on every request. The source entry already replayed its walk from the stat-validated cache (code-signature-cache.ts). The built (dist) entry re-read all ~130 bundle chunks (~11 MB) each time, because its walk was assumed to cost ~5 ms. Both entries now use the same cache, which replays the identical signature from statSync alone and falls back to the full walk on any change. Installed trees are unaffected (they carry no fingerprint).
Value
Checkout bin/agent-device.mjs, iPhone 17 Simulator, snapshot -i over MCP:
- Client attach (
daemon_startupdiag): 12–13 ms → 1–2 ms. - Profile:
readFileUtf8in the MCP process fell from 1.5 s to 0.06 s over 200 calls.
Validation
-
Part of a read-latency series (#5193–#5197). Combined, on the external sign-in harness (iPhone 17 Simulator, iOS 27.0, checkout, warm runner):
snapshot -imedian 61–73 ms → 38–42 ms; press, fill, flow and batch unchanged or faster (all ops succeeded, flow reply tokens identical). -
daemon-launch-spec.test.ts: the cache test now runs for both the built and the source entry; the built case fails onorigin/main(it re-readsdist). -
code-signature-cache.test.tspasses. -
CI owns the full gates.
🤖 Generated with Claude Code