Repository navigation
fix: recover Relay broker startup after transient failures - #10147
Conversation
📝 WalkthroughWalkthroughAdds relay connection error classification and coordinator retry handling with exponential backoff and jitter. Reconciliation now tracks, cancels, and resets retry state, validates identity continuity, and fences pending retries during shutdown. Tests cover transient recovery, permanent authorization failures, demand cancellation, and identity changes. 🚥 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/relay/relay-auth-coordinator.ts (1)
181-189: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCaught connection error is never logged.
The error is swallowed here — neither the retry nor the "give up" (permanent-failure) path records what actually failed. For persistent transient failures or unexpected non-
RelayHttpErrorexceptions (see companion note onrelay-http-client.ts), operators only ever see repeatedofflinestatus callbacks with no way to diagnose the cause in production.🔍 Suggested logging addition
} catch (error) { if (this.isEpochCurrent(epoch)) { this.options.onStatus('offline') + console.error('[relay-auth-coordinator] reconcile failed', error) if (retryIdentityKey && shouldRetryRelayConnectionError(error)) { this.scheduleRetry(epoch, retryIdentityKey) } } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 86ad0e1c-8491-4e4a-abf4-f65e93f03c1e
📒 Files selected for processing (3)
src/main/runtime/relay/relay-auth-coordinator-recovery.test.tssrc/main/runtime/relay/relay-auth-coordinator.tssrc/main/runtime/relay/relay-http-client.ts
…-transient-recovery
…-transient-recovery
|
looking into it |
|
thanks for reporting. looking into it |
Summary
Why
A transient startup failure currently leaves an entitled, demanded desktop in
offlineuntil the process restarts or another auth event occurs. This restores the control automatically without changing pairing credentials or existing direct transport behavior.The longer sustained-outage cap prevents a large desktop population from retrying every 30 seconds on average after the service has already been unavailable for several minutes. The initial 1/2/4/8-second exponential sequence is unchanged.
Validation
pnpm typecheckpasses on Node 24.18git diff --checkpassmain30044441630passed the full lint, typecheck, Git compatibility, test, unpacked build, and packaged CLI workflow on reviewed head5dfd5d29a9This PR is intentionally not authorized for merge yet; it is separate from the production cloud hotfix.