Repository navigation
fix(relay): gate relay control work on proven broker liveness - #16021
Conversation
Pairing a phone would fail with relay_control_not_active after the desktop had been asleep or off Wi-Fi, and stayed broken until the app was restarted — retrying the QR code just reproduced the same error. The auth coordinator keeps its broker ownership marked valid across a control socket death; only reconcile applied a liveness gate before republishing 'registered'. Control work went through getActiveBroker/waitForActiveBroker, which returned that still-"valid" ownership, so create_pairing_relay and get_endpoints kept driving the dead control instead of letting the coordinator open a replacement. Control paths now use getLiveBroker/waitForLiveBroker, which apply the same liveness gate reconcile uses, so a dead broker is withheld and the demand wait resolves on its replacement. getActiveBroker stays the raw ownership handle for revoke identity matching, which must still match the broker it queued against. Liveness stays proof-based: only a broker that reports isLive() === false is withheld. A broker that cannot report liveness is unverifiable, not exited, and remains usable — silence never costs a working relay.
|
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 (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe relay authentication coordinator now provides 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
Description
After a relay control socket died, broker ownership could remain valid while the control itself was unusable. Pairing and endpoint work read that stale ownership handle and failed with
relay_control_not_activeinstead of waiting for the reconcile already replacing it.Control work now uses a liveness-gated broker accessor and wait path. The raw ownership accessor remains available only for revoke identity matching, where retaining the original owner is required for durable retry.
ELI5
Orca remembered which relay phone line belonged to it, but sometimes that line had already gone dead. Pairing grabbed the remembered-but-dead line while Orca was already connecting a replacement. Now pairing waits for the working replacement; revocation still remembers the old line long enough to finish its bookkeeping.
Reliability contract
isLive() === false.unverifiable, notexited, and stays usable.relay_control_not_activeterminal error.Readiness review
Validation
src/main/runtime/relay: 12 files / 84 tests passedpnpm run typecheck:node: passedpnpm run check:code-quality:changed: passed with 0 findingsReview verdict
Ready to land.