fix(runtime): Keep deferred messages out of active turns#1014
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
marked this pull request as ready for review
July 23, 2026 19:27
Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: David Cramer <david@sentry.io>
Resolve mailbox acknowledgements and deferrals through one atomic drain operation while keeping agent steering terminology at the runtime boundary.
Describe how pending input is delivered into turn execution without overloading routing terminology used for destinations and handlers.
Version and strictly validate durable mailbox messages, preserve interrupt delivery across duplicate ingress, and keep metadata mirroring aligned with actual drain mutations.
Assign interrupts only to Slack mentions, queue all other inbound work as deferred, and batch pending work by delivery priority.
dcramer
force-pushed
the
fix/resource-events-follow-up-queue
branch
from
July 23, 2026 20:41
70307fd to
df3835d
Compare
When a duplicate Slack mention promotes deferred work to an interrupt, retain the mention metadata while preserving attachments already captured from its twin event.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ff86163. Configure here.
Derive interrupts from explicit Slack mentions instead of broad DM routing, and ignore legacy injected markers without rejecting otherwise valid pending work.
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.

Each inbound mailbox message now has one delivery mode:
interruptis used only for Slack@mentions and may join the active turn at the next safe point.deferis used for every other inbound message and waits for the next normal turn.Messages are batched by delivery mode. All pending interrupts are handled together first, regardless of when they were queued. When no interrupts remain, all deferred messages are handled together in the next turn.
The delivery mode is stored with the mailbox message, so retries and worker restarts do not change it. Older mailbox records are upgraded to
defer, invalid current records fail instead of silently dropping work, and a later mention event can promote a duplicate deferred Slack message tointerrupt.Queue callbacks remain small conversation wake-ups; the persisted mailbox owns the destination, message content, and delivery mode.
Requested by David Cramer via Junior.
--
View Junior Session