---
name: "Cancel button still discards queued messages (197 regression)"
---

# Bug 215: Cancel button still discards queued messages (197 regression)

## Description

Bug 197 fixed this: pressing Cancel during generation should preserve queued messages by appending them to the chat input box. The fix was merged (commit a65c751) but was subsequently overwritten by story 199 (commit 8d29956, "web UI submits all queued items at once"), which rewrote Chat.tsx without the 197 changes. The `chatInputRef`, `appendToInput()`, and `ChatInputHandle` are all gone from the current code.

## How to Reproduce

1. Start a chat session with an agent
2. Queue up multiple messages while the agent is responding
3. Press the Cancel button

## Actual Result

Queued messages are silently discarded (Chat.tsx line 417-418 just clears the ref).

## Expected Result

Queued messages are joined with newlines and placed into the chat input box so the user can review, edit, or resend them.

## Acceptance Criteria

- [ ] Cancel button appends queued message texts (joined with newlines) to the chat input box before clearing the queue
- [ ] If the chat input already has content, queued text is appended (not replaced)
- [ ] Regression test covers this scenario
