Repository navigation
fix(relay): tolerate wall-clock skew in host-proof validation - #10474
Conversation
A few seconds of local clock lag made challenge issuedAt appear in the future, so host-proof rejected every handshake and Mobile Relay looped connecting forever. Allow ±30s skew while keeping the 10s challenge window (stablyai#10401).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughRelay host proof transcript validation now uses named clock-skew and maximum-window constants. Timestamp checks allow bounded differences between the local clock and challenge issuance or expiration while retaining challenge ordering and lifetime constraints. A Vitest suite adds binary transcript helpers, encrypted challenge fixtures, expected HMAC proof generation, and accepted and rejected clock-skew, oversized-window, and invalid-order cases. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/relay/relay-host-proof.test.ts (1)
140-204: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGood coverage of the skew boundaries; consider adding exact-limit (inclusive) cases.
Current tests exercise "well within skew" (4.4s) and "1ms past the skew/window limit" (rejected), but there's no test asserting the exact boundary (
localNowexactlyissuedAt - SKEWorexpiresAt + SKEW, and window exactlyMAX_HOST_PROOF_CHALLENGE_WINDOW_MS) is accepted. Since the production checks use<=, an inclusive-boundary test would guard against a future off-by-one regression at the edges.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d231ba4e-9706-4aa8-b51d-ddf284c99cbc
📒 Files selected for processing (2)
src/main/runtime/relay/relay-host-proof.test.tssrc/main/runtime/relay/relay-host-proof.ts
|
Thanks for the focused fix — the bounded skew tolerance preserves the signed challenge window, and the regression coverage gives us good confidence. Merged! |
|
Thanks @brennanb2025 — glad the bounded skew + regression tests were enough to land cleanly. Appreciate the merge! |
…ai#10474) * fix(relay): tolerate wall-clock skew in host-proof validation A few seconds of local clock lag made challenge issuedAt appear in the future, so host-proof rejected every handshake and Mobile Relay looped connecting forever. Allow ±30s skew while keeping the 10s challenge window (stablyai#10401). * fix(relay): preserve host-proof challenge bounds --------- Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Summary
Date.now()with zero skew tolerance against a ≤10s challenge windowissuedAtlook "in the future", so every handshake failed and Relay looped connecting → unavailable with no useful UI reasonCloses #10401
Root cause
From the issue: with local clock ~4.4s behind NTP, server-issued
issuedAtalways failedissuedAt <= now, so the desktop rejected host-proof itself. Broker retries could not recover until the clock was corrected.Change
In
validateTranscript(relay-host-proof.ts):Test plan
relay-control-clienthost-proof flow passesNotes
UI/logging for host-proof failures (also requested in the issue) is left as follow-up so this PR stays a minimal handshake fix.
ELI5
Mobile Relay handshakes failed when the phone clock was a few seconds off the server, looping connect → unavailable. Host-proof validation allows a small clock skew so normal lag no longer blocks pairing.