Skip to content

Allow user to enqueue messages#1374

Merged
krissetto merged 4 commits intodocker:mainfrom
stanislavHamara:enqueue-messages
Jan 16, 2026
Merged

Allow user to enqueue messages#1374
krissetto merged 4 commits intodocker:mainfrom
stanislavHamara:enqueue-messages

Conversation

@stanislavHamara
Copy link
Contributor

@stanislavHamara stanislavHamara commented Jan 15, 2026

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):

  • Added queuedMessage struct and messageQueue field to chatPage
  • handleSendMsg() – queues messages when agent is busy, processes immediately when idle
  • processNextQueuedMessage() – pops and processes the next queued message (called when stream stops)
  • handleClearQueue() – clears all queued messages with Ctrl+X
  • syncQueueToSidebar() – syncs queue previews to sidebar display

Editor changes (pkg/tui/components/editor/editor.go):

  • Removed working guards that blocked sending – now delegates queuing decision to chatPage

Key binding (pkg/tui/tui.go, pkg/tui/messages/messages.go):

  • Added Ctrl+X binding to clear the message queue
  • Added ClearQueueMsg message type

Visual feedback:

  • Resize handle shows queue count: "Working… (3 queued)"
  • Sidebar displays "Queue (N)" section with truncated message previews
  • Notifications inform users: "Message queued (2 waiting) · Ctrl+X to clear"

Sidebar (pkg/tui/components/sidebar/sidebar.go):

  • Added SetQueuedMessages() method and queueSection() renderer
  • Queue section shows tree-style list of pending messages with clear hint

Behavior

  • Messages sent while agent is busy are queued (max 5)
  • When agent finishes, next queued message auto-starts
  • Esc cancels current stream but preserves the queue
  • Ctrl+X clears all queued messages
  • Queue full → warning notification, message rejected

Tests

  • pkg/tui/page/chat/queue_test.go – flow tests for queueing, rejection, clearing, FIFO order
  • pkg/tui/components/sidebar/queue_test.go – sidebar queue section renderingWIP

@stanislavHamara stanislavHamara marked this pull request as ready for review January 15, 2026 16:23
@stanislavHamara stanislavHamara requested a review from a team as a code owner January 15, 2026 16:23
@krissetto krissetto merged commit ba54353 into docker:main Jan 16, 2026
5 checks passed
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.

2 participants