#19033: feat(ui): treat 'btw' as addendum while chat is busy
app: web-ui
size: S
## What
When the control UI already has an active run in progress, messages that start with "btw" are treated as *addenda* to the in-flight request instead of being queued as a new independent message.
## Behavior
- Recognizes case-insensitive prefixes: `btw`, `btw:`, `btw,`, `btw -`
- Strips the prefix + optional punctuation
- Enqueues the addendum at the **front** of the queue (ahead of already-queued normal messages) so context arrives before any later questions
- Merges consecutive addendums into a single queue item (separated by a blank line)
- Labels addendum queue items as `Addendum: ...` in the queue widget
- If not busy, or the message is just `btw` with no body (and no attachments), falls back to normal enqueue behavior
## Notes
- Adds `ChatQueueItemKind = 'message' | 'addendum'` (optional `kind` for backwards compatibility)
- Adds unit tests for the addendum queue logic
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR introduces an addendum queue feature that treats messages starting with "btw" as context additions to in-flight chat requests rather than separate messages. When the chat is busy, `btw`-prefixed messages are inserted at the front of the queue and consecutive addendums are merged with blank line separators. The UI labels these as "Addendum: ..." in the queue widget.
Key changes:
- Added `ChatQueueItemKind` type (`'message' | 'addendum'`) with optional `kind` field for backwards compatibility
- Implemented `parseBtwAddendum()` to detect `btw`, `btw:`, `btw,`, `btw -` prefixes (case-insensitive)
- Implemented `enqueueChatAddendum()` to insert at queue front and merge consecutive addendums
- Updated queue rendering to display "Addendum:" prefix for addendum items
- Added comprehensive unit tests covering main scenarios
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with one known issue already identified
- The implementation is clean, well-tested, and follows existing patterns. The multiline regex issue was already identified in previous review threads. The feature adds new functionality without breaking existing behavior due to the optional `kind` field for backwards compatibility. Type definitions are properly updated and the UI changes are minimal and focused.
- No files require special attention beyond the already-noted multiline regex issue in `ui/src/ui/app-chat.ts`
<sub>Last reviewed commit: 46b7749</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#7522: fix(webchat): auto-scroll when message queue changes
by alsoknownasfoo · 2026-02-02
73.8%
#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles
by opnsec · 2026-02-21
73.0%
#6690: UX: clearer /queue and /subagents output
by kamb5686 · 2026-02-01
72.7%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
72.5%
#22119: feat(tui): queue user messages while a run is active
by joshuajerin · 2026-02-20
72.5%
#13548: feat(control-ui): Add quote reply and send message to session features
by Annaxiebot · 2026-02-10
72.0%
#14966: fix(webchat): preserve user message visibility after chat.send
by BenediktSchackenberg · 2026-02-12
71.4%
#23073: fix(ui): strip reply directive tags from assistant messages in WebC...
by x4v13r1120 · 2026-02-22
71.1%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
70.9%
#20473: feat(ui): add auto-send with configurable triggers
by pborgen · 2026-02-19
70.7%