Skip to content

feat(tui): press up to edit queued messages#656

Open
euxaristia wants to merge 2 commits into
Gitlawb:mainfrom
euxaristia:feat/tui-queued-message-edit
Open

feat(tui): press up to edit queued messages#656
euxaristia wants to merge 2 commits into
Gitlawb:mainfrom
euxaristia:feat/tui-queued-message-edit

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What

Pressing the up arrow while a message is queued pops it back into the composer for editing, instead of navigating input history. While a message is queued, the empty composer shows a placeholder hint: "Press up to edit queued messages".

Why

Once a prompt was queued during an active run there was no way to take it back for editing; the only options were letting it send or discarding it with Esc. This mirrors the flow in other agent TUIs where up recalls the queued message.

Changes

  • Up arrow pops the queued message into the composer, taking priority over history recall. A draft already being typed is preserved below the queued text.
  • Empty composer shows the edit hint as its placeholder while a message is queued, and reverts once popped.
  • Bug fix: queueing a second prompt during the same run used to silently replace the first. It now stacks under it, so both send as one message.

Testing

Four new tests in queued_message_test.go cover the pop, queued-above-draft ordering, hint visibility, and stacking. Full internal/tui suite passes.

Summary by CodeRabbit

  • New Features
    • Enabled editing queued follow-ups with the Up arrow by moving them into the composer.
    • When composing is in progress, queued text is placed above the existing draft.
    • Added a visual hint while a queued message is available, and it disappears after popping it into the editor.
    • If multiple follow-ups are queued in a row, new queued text is appended to the existing queued message.
  • Tests
    • Added unit tests for queued-message edit, stacking, cursor placement, and hint behavior.

Pressing up with a message queued pops it back into the composer for
editing, taking priority over history recall. While a message is queued
the empty composer shows a hint placeholder. A second prompt queued
during the same run now stacks under the first instead of replacing it.
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1512a3a1-fd29-4f1f-a1f6-0e954e64e609

📥 Commits

Reviewing files that changed from the base of the PR and between 5dc6b58 and 5b90840.

📒 Files selected for processing (1)
  • internal/tui/queued_message.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/tui/queued_message.go

Walkthrough

Changes

Queued follow-up messages now stack, can be restored into the composer with ArrowUp, and display an edit hint while pending. Tests cover restoration, draft merging, hint visibility, and stacking.

Queued message editing

Layer / File(s) Summary
Queue state and edit restoration
internal/tui/queued_message.go
Queued messages append with newline separators, and queued content is restored above any existing draft with the cursor moved to the end.
ArrowUp wiring and composer feedback
internal/tui/model.go, internal/tui/queued_message_test.go
ArrowUp prioritizes queued-message editing, the composer shows the queued-edit hint, and tests validate the updated behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Composer
  participant Model
  participant QueuedMessage
  Composer->>Model: ArrowUp
  Model->>QueuedMessage: popQueuedMessageForEdit
  QueuedMessage->>Model: queued text plus draft
  Model->>Composer: restore composer value and cursor
Loading

Suggested reviewers: gnanam1990, jatmn, kevincodex1, anandh8x

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main TUI change: pressing Up to edit queued messages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@anandh8x anandh8x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real UX fix, tight scope. Up-arrow pop + hint + stacking-second-prompt all land cleanly; the silent overwrite was a data-loss class worth fixing. CI green, CodeRabbit approved, tests cover the new behavior. Approving.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the up-arrow priority carefully: with a message queued, up pops it back into the composer (above any in-progress draft), and with an empty queue the existing history-recall still works. The new branch sits between composer cursor movement and history recall, and since queueing clears the composer there's no collision with either. The edit path routes through setComposerState/syncInputFromComposer, so multiline text and the draft are preserved correctly. Build and vet are clean, and the full internal/tui suite passes apart from the pre-existing TestAltScreenTranscriptScrollKeepsFooterFixed failure that also fails on main. The four new tests cover the pop, draft ordering, hint, and stacking.

One small thing before merge: the two new comments in queued_message.go attribute the behavior to a specific external project by name. Could you drop that and just describe the behavior on its own? Otherwise this looks good to me.

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.

3 participants