Skip to content

Recover orphaned queued messages immediately on server startup - #5785

Merged
ymichael merged 1 commit into
mainfrom
bb/c008-investigate-queued-message-visibility-1706-thr_b7t5akuicx
Oct 19, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/c008-investigate-queued-message-visibility-1706-thr_b7t5akuicx

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

A server process could die after claiming a queued message but before dispatch completed. The persisted claim hid the message from queue listings and prevented normal dispatch until the existing five-minute stale-claim timeout elapsed. This reproduces one visibility failure related to #1706; it does not establish the cause of every incident reported there.

What changed

Release claims left by the previous process during startup recovery, before the HTTP listener starts. Preserve claims actively owned by the current process, notify affected threads through the existing queue-change path, and log the number released. Ordinary stale-claim recovery retains its five-minute timeout.

How you verified

  • pnpm exec turbo run test --filter=@bb/server -- test/threads/requested-queue-drain.test.ts: all 21 tests passed.
  • The new regression test failed at the queue visibility assertion with the startup change removed, then the original source was restored.
  • pnpm exec turbo run typecheck --filter=@bb/server: passed (Turbo cache).
  • pnpm start:worktree: built and launched successfully. In the development instance, simulated an abandoned claim and killed only its server process. On restart the API immediately listed the message and logs reported one released claim. Confirmed the recovered message was visible and editable in the browser.
  • git diff --check: passed.

AGENT GENERATED

@ymichael
ymichael merged commit 36fdc4d into main Oct 19, 2026
47 of 49 checks passed
@ymichael
ymichael deleted the bb/c008-investigate-queued-message-visibility-1706-thr_b7t5akuicx branch October 19, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant