---
name: "Cancel button discards queued messages instead of preserving them in chat input"
---

# Bug 197: Cancel button discards queued messages instead of preserving them in chat input

## Description

Story #187 was supposed to make the cancel button preserve queued messages by putting them into the chat input box. The implementation queues messages correctly when the agent is busy, but the cancelGeneration function at Chat.tsx:414-416 simply discards them (clears the ref and state) instead of joining them and setting them as the chat input value.

## How to Reproduce

1. Start a chat with the bot so it's generating a response (loading=true)
2. Type and submit one or more messages while it's busy (they get queued)
3. Press the Cancel button

## Actual Result

Queued messages are silently discarded. The chat input remains empty.

## Expected Result

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

## Acceptance Criteria

- [ ] On cancel, queued message texts are joined with newlines and set as the chat input value
- [ ] The queued messages queue is cleared after being moved to the input
- [ ] If the chat input already has text, queued messages are appended (not replacing existing text)
