Repository navigation
fix(delivery): wake owed agents when a Runner attaches (RIG-4166) - #1465
Merged
trunk-io[bot] merged 1 commit intoOct 2, 2026
Conversation
A mention made after a restart, before the Runner re-enrolls, failed its wake with Unavailable and nothing retried it. When a Runner command stream attaches, the hub now notifies the delivery consumer, which wakes every agent with an owed mention. WakeAgent skips live agents and coalesces duplicates. Co-authored-by: Matt Wilkinson <matt@rigel.build>
This was referenced Oct 2, 2026
Merged
|
Compass engineering docs preview: https://compass-server-rig-4166-wake.compass-eng-docs.pages.dev Deployed from |
rigel-mintaka
marked this pull request as ready for review
October 2, 2026 01:59
mattwilkinsonn
added this pull request to stack #1467
October 2, 2026 03:19
mattwilkinsonn
approved these changes
Oct 2, 2026
|
This pull request was merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack containing 4 PRs:
mainFixes RIG-4166. Stacked on #1464.
Problem
A mention made after a restart, before the Runner's command stream attaches, records an owed row and wakes the agent. The wake fails with
Unavailable: no runner enrolled. Nothing retries it, so the agent never replies.Change
runnerhub.RunnerReadySink.Hub.fireRunnerReadycalls it when a Runner's Sessions stream attaches. That is the same edge the supervisor seed uses: after the stream is live, so a wake can be served.delivery.Consumer.OnRunnerReadysets a flag and notifies the loop.drainOwedRewakelistsOwedMentionAccounts(a newSELECT DISTINCT agent_account_id FROM owed_mentions) and wakes each account. The wakes run off the loop, because each one is a Runner round trip.WakeAgentalready skips live agents and coalesces duplicate wakes for the same agent.Tests
TestMentionBeforeRunnerEnrollsWakesOnAttach(server pgtest): the consumer runs with no Runner, then @mention an agent; the wake fails and an owed row lands. A Runner then attaches, and the agent gets a session.-race.drainOwedRewakedisabled it fails: "no session started for the owed agent after the Runner attached".-race). sqlc drift is clean. Lint reports 0 issues.Notes
agent_sessionsrow is stamped withtenant_id ''. This predates this PR and is filed as RIG-4167.Live check after merge: redeploy, @mention an agent within 10s, and it replies.