fix(broker): keep idle fleet agents active - #1500
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization 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)
📝 WalkthroughWalkthroughThe broker now sends an initial and periodic worker-inventory synchronization during connected node-control sessions. The refresh interval is 60 seconds. Tests cover idle agents, empty inventories, and reconnect handling. The changelog documents the fix. ChangesInventory refresh
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to The change periodically renews active idle workers while preserving immediate inventory updates and cleanup behavior; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant FleetBroker
participant ConnectedSession
participant NodeControlPeer
FleetBroker->>ConnectedSession: start session with 60-second refresh interval
ConnectedSession->>NodeControlPeer: send initial InventorySync
ConnectedSession->>ConnectedSession: wait for periodic interval
ConnectedSession->>NodeControlPeer: replay current InventorySync
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
971065c to
eb28e98
Compare
Summary
What #1494 fixed vs. this residual gap
#1494 made successful launches enter fleet_inventory, published snapshots reliably on changes, and replayed the inventory after reconnect. That fixes agents stranded offline by a provider disconnect. The remaining gap was time based: after the reconnect or launch snapshot, a healthy but idle worker produced no more agent-authenticated activity and no further inventory snapshot.
Root cause
Relaycast expires active agent presence after five minutes without authenticated agent activity. Broker node heartbeats run every 12 seconds, but they renew only the node/provider rows. inventory.sync refreshes each authoritative agent row, yet before this change the broker sent it only on inventory changes and reconnect. A live worker that stayed quiet for five minutes therefore aged offline while its node remained healthy and online.
The broker now replays authoritative inventory every 60 seconds, well inside that lease. Empty snapshots are sent too, both immediately after connecting and periodically, so Relaycast clears workers that no longer exist locally. Worker exit and release paths still remove workers and immediately publish the pruned inventory.
Verification
Test plan
Refs #1458. Follow-up to #1494.