Skip to content

Conversation

@ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Nov 13, 2025

Allows users to send multiple messages while AI is streaming without interrupting the active response.

Demo:

queuedmessagesdemo3.mp4

Closes #522.

A follow-up PR will add 'soft-interruptions', which take effect at the end of the next content block (text-delta, reasoning-end, tool-result, tool-error)

Behavior

While streaming:

  • Additional messages get queued instead of starting a new stream

  • Queued message displays below streaming content with muted styling

  • User can edit queued message before stream completes by pressing up arrow (like regular messages) or the "Edit" button.

On stream completion:

  • Queued messages auto-send immediately

  • Queue supports text, images, and combined messages

On stream abort (Ctrl+C):

  • Queued message restores to chat input for editing

  • Images are preserved

Known Issues

  • Compaction during streaming: Cannot queue messages while compaction is running. This will be fixed in a follow-up PR.

Implementation

  • MessageQueue service - Accumulates text, images, and options with special handling for slash commands

  • AgentSession integration - Stream-end triggers auto-send, stream-abort triggers restore

  • QueuedMessage component - Displays queued content with edit functionality

  • IPC handlers - Queue management and message routing

  • Test coverage - 27 unit tests + 10 integration tests (requires ANTHROPIC_API_KEY)

Testing

# Unit tests (no API keys required)

bun test src/services/messageQueue.test.ts



# Integration tests (requires ANTHROPIC_API_KEY)

TEST_INTEGRATION=1 bun x jest tests/ipcMain/queuedMessages.test.ts

Generated with cmux

@ethanndickson ethanndickson force-pushed the queued-messages branch 5 times, most recently from fb4e0db to 41c5c32 Compare November 14, 2025 02:31
@ethanndickson ethanndickson added this pull request to the merge queue Nov 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 17, 2025
@ethanndickson ethanndickson added this pull request to the merge queue Nov 17, 2025
Merged via the queue into main with commit 61dd396 Nov 17, 2025
13 checks passed
@ethanndickson ethanndickson deleted the queued-messages branch November 17, 2025 04:03
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.

Send message should avoid interrupting stream

1 participant