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 3 times, most recently from c179662 to a83abdc Compare November 14, 2025 00:57
Allows users to queue multiple messages while AI is streaming:
- Messages sent during streaming are queued instead of interrupting
- Queued messages auto-send when stream completes
- On stream abort (Ctrl+C), queued messages restore to chat input

Implementation includes:
- MessageQueue service for accumulating text + images + options
- AgentSession integration with stream-end/abort handlers
- QueuedMessage component with edit functionality
- Extended ChatInput to support message restoration
- Full test coverage (27 unit tests + 10 integration tests)

Generated with cmux
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