Skip to content

Comments

fix: prevent head-of-line blocking in OutgoingMessageQueue#699

Open
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/outgoing-queue-head-of-line-blocking
Open

fix: prevent head-of-line blocking in OutgoingMessageQueue#699
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/outgoing-queue-head-of-line-blocking

Conversation

@davidrimshnick
Copy link

Summary

  • Changes processQueueInternal() to skip unreleased items instead of stopping entirely when encountering one at the head of the queue
  • This prevents immediately-ready messages (e.g., background task results, sidechain responses) from being blocked behind delayed tool call messages
  • The "one behind" symptom occurs because tool call messages have a 250ms delay, and any messages enqueued during that delay are blocked until it expires

Fixes #639

Test plan

  • Added 8 unit tests covering ordering, delay, head-of-line bypass, releaseToolCall, flush, and interleaved messages
  • Core test: "should NOT block released messages behind unreleased ones" verifies the fix
  • Verify in production that background task responses appear immediately instead of one step behind

🤖 Generated with Claude Code

Change processQueueInternal to skip unreleased items instead of
stopping entirely, so immediately-ready messages (e.g. background
task results) are not blocked behind delayed tool call messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

OutgoingMessageQueue head-of-line blocking causes 'one behind' responses with background tasks

1 participant