← Back to PRs

#19033: feat(ui): treat 'btw' as addendum while chat is busy

by KnottyDyes open 2026-02-17 08:21 View on GitHub →
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