-
Notifications
You must be signed in to change notification settings - Fork 214
Allow user to enqueue messages #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| if queueLen == 1 { | ||
| notifyMsg = "Message queued (1 waiting) · Ctrl+X to clear" | ||
| } else { | ||
| notifyMsg = fmt.Sprintf("Message queued (%d waiting) · Ctrl+X to clear", queueLen) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just the else should be enough here
| queued := p.messageQueue[0] | ||
| p.messageQueue = p.messageQueue[1:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably not a big deal, but since messageQueue is a list of structs with pointers the references to the underlying elements would remain alive.. maybe we should be zeroing out the p.messageQueue[0] after grabbing the first element
p.messageQueue[0] = queuedMessage{}|
|
||
| // Truncate message and add prefix | ||
| truncated := toolcommon.TruncateText(msg, maxMsgWidth) | ||
| lines = append(lines, prefix+styles.MutedStyle.Render(truncated)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Kapture.2026-01-15.at.16.19.33.mp4
Implements a message queue in the TUI that allows users to enqueue up to 5 messages while the agent is busy processing. Queued messages are automatically sent when the previous message finishes, providing a smoother workflow without losing user input.
Changes
Core queue logic (
pkg/tui/page/chat/chat.go):queuedMessagestruct andmessageQueuefield tochatPagehandleSendMsg()– queues messages when agent is busy, processes immediately when idleprocessNextQueuedMessage()– pops and processes the next queued message (called when stream stops)handleClearQueue()– clears all queued messages withCtrl+XsyncQueueToSidebar()– syncs queue previews to sidebar displayEditor changes (
pkg/tui/components/editor/editor.go):workingguards that blocked sending – now delegates queuing decision tochatPageKey binding (
pkg/tui/tui.go,pkg/tui/messages/messages.go):Ctrl+Xbinding to clear the message queueClearQueueMsgmessage typeVisual feedback:
"Working… (3 queued)""Message queued (2 waiting) · Ctrl+X to clear"Sidebar (
pkg/tui/components/sidebar/sidebar.go):SetQueuedMessages()method andqueueSection()rendererBehavior
Esccancels current stream but preserves the queueCtrl+Xclears all queued messagesTests
pkg/tui/page/chat/queue_test.go– flow tests for queueing, rejection, clearing, FIFO orderpkg/tui/components/sidebar/queue_test.go– sidebar queue section renderingWIP