Keep grouped queued prompts atomic - #2821
Merged
ymichael merged 1 commit intoSep 1, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/fixer-keep-grouped-queued-prompts-atomic-thr_sshib6bv4r
branch
from
September 1, 2026 18:45
efb6c8e to
39e09f6
Compare
ymichael
deleted the
bb/fixer-keep-grouped-queued-prompts-atomic-thr_sshib6bv4r
branch
September 1, 2026 18:57
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.
Human comments
What was wrong
The durable queue stored prompt grouping separately from per-row wait eligibility. Scheduled and plugin-requested sweeps enumerated eligible row references and then claimed by one row ID. When a grouped prompt was postponed, only its lead row received the new wait, so a later row could retain an earlier deadline; after the pacing window expired, a later sweep could claim that follower alone, sever the group, and send an incomplete prompt. This follows up on the unified dispatch queue landing.
What changed
Queue persistence now accepts a whole-group eligibility check and evaluates it inside the same immediate transaction that claims the rows. Automatic scheduled and plugin-requested drains claim the complete group even when a sweep begins from a follower, and requeueing applies the same wait state to every claimed group member. Explicit Send now behavior remains unchanged. There are no wire, schema, CLI, SDK, guide, or documentation contract changes, so no host-daemon protocol bump is needed.
How you verified
The new production service/DB regression failed before the fix by recording a turn containing only
tailwhile leavingleadqueued, and passes after the fix.pnpm exec turbo run test --filter=@bb/server -- --run test/threads/requested-queue-drain.test.ts— 6 passedpnpm exec turbo run test --filter=@bb/db -- --run test/data/queued-thread-messages.test.ts— 30 passedpnpm exec turbo run typecheck --filter=@bb/serverpnpm exec turbo run typecheck --filter=@bb/dbpnpm exec turbo run build --filter=@bb/server