feat(chat): queue messages while a turn is active#237
Merged
Conversation
Allow users to compose and queue follow-up messages while the current model turn is running. Display the pending FIFO queue directly above the chat input under the label **“Queued messages:”**, then submit each message as a separate turn after the preceding turn fully completes. --- Changes - Keep `ChatInput` editable during streaming; retain Esc/Ctrl+C as active-turn interruption controls. - In `Chat`, store queued `SubmittedInput` values separately from persisted conversation messages. - When a normal text prompt is submitted while `isLoading`, append it to the queue instead of starting another turn. Do not add it to session history until execution begins. - Drain one queued message when the chat becomes idle, provided no tool approval or plan review is pending. Preserve FIFO execution and start the next item through the existing turn flow. - Render a compact queue preview above `ChatInput`: - Header: `Queued messages:` - Show each message in submission order with a dimmed `↳` prefix. - Truncate only the visual preview; retain the full queued content. - When the input is empty during an active turn, Up Arrow removes the most recently queued message and restores it to the composer. The user can edit and resubmit it or clear the composer to delete it. Normal history navigation resumes when no queued messages remain. - Clear queued messages when switching sessions. Interrupting the active turn leaves the queue intact and allows it to continue afterward. - Do not queue slash commands, `!` shell commands, `/compact`, or image attachments in the initial version; keep their current behavior unavailable while a turn is active. --- Interfaces and State - Add queue state and dequeue/restore handlers at the `Chat` level. - Extend `ChatInput` with: - active-turn status distinct from full input disablement; - an optional callback for restoring the latest queued message; - queue-aware submission behavior and hints. - Add a small colocated queue-preview component if extracting the rendering keeps `Chat` focused; no public package API or persisted session format changes.
Added `src/components/Chat/hooks/useMessageQueue.ts` and exported it through the hooks barrel. The hook now owns: - FIFO queue draining - Pause handling - Duplicate-drain protection - LIFO restoration for editing - Session-reset clearing `Chat` retains message classification and rendering.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
What is the motivation for this pull request?
Feature: allow users to type and submit messages while a chat turn is in progress. Instead of discarding or blocking input, messages are queued and processed sequentially once the current turn completes.
plan.md
What is the current behavior?
When the chat is loading / processing a turn,
ChatInputis disabled (isDisabled) and any submitted input is silently dropped.What is the new behavior?
/,!) and image attachments cannot be queued; attempting to queue them shows an inline error.useMessageQueuehook encapsulates all queue state and drain logic, extracted fromChatfor clarity and testability.Checklist: