aws / aws/amazon-q-developer-cli

Cancelled requests completely removed from conversation history causing context loss

Open
#3,224 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

Linux 5.15.167.4-microsoft-standard-WSL2 - Ubuntu 24.04.3 LTS

### Expected behaviour

When a user cancels an AI response mid-generation, the AI should retain the original user request in conversation history. This allows follow-up requests that reference the cancelled interaction (like "try again but shorter" or "approach this differently") to have proper context about what the user originally asked for.

### Actual behaviour

Both the original user request and the partial AI response are completely scrubbed from the AI's conversation history. The AI has no memory of what was requested, making follow-up refinement requests disconnected and usually wrong since the AI doesn't know what it's supposed to retry or improve.

[chat-transcript]
> hello I am trying to recreate a bug.

Hello! I'm ready to help you recreate a bug. To assist you effectively, I'll need some details:

• What bug are you trying to recreate?
• What system, application, or code is involved?
• Do you have any error messages, logs, or symptoms to work with?
• What environment or conditions are needed to trigger it?

Once you provide these details, I can help you set up the reproduction steps or analyze what might be causing the issue.
[Tool uses: none]

> step 1: I am going to pre-pend steps to my requests. At some point I want you to tell me which steps you see in your context/chat history

Understood. I see "step 1" in your current message where you're explaining that you'll be pre-pending steps to your requests, and you want me to track and report back which steps I can see in our chat history when you ask.

I'm ready for the next step when you are.
[Tool uses: none]

> step 2: do you understand?

Yes, I understand. You're testing something related to step tracking in our conversation history. I can see:

• Step 1: You explained you'll pre-pend steps to requests and want me to report which steps I see
• Step 2: You're asking if I understand

I'm ready for step 3.
[Tool uses: none]

> step 3: write me a long poem about aws

The Cloud Architect's Ode to AWS

In the realm where data flows like rivers wide,
Amazon's cloud stands tall with digital pride,
From humble S3 buckets storing dreams,
To Lambda functions processing ^C
[Tool uses: none]

> step 4: can you tell me what steps you see?

I can see these steps in our chat history:

• Step 1: You explained you'll pre-pend steps to requests and want me to report which steps I see
• Step 2: You asked if I understand
• Step 4: You're asking me what steps I see

I notice there's no "step 3" in our conversation - we went directly from step 2 to step 4. Is this gap part of the bug you're trying to recreate?
[Tool uses: none]

> did you see a cancellation of any sort?

No, I didn't see any cancellation in our conversation. The messages I received were:

1. Your initial hello about recreating a bug
2. Step 1: Explaining the step tracking
3. Step 2: Asking if I understand
4. Step 4: Asking what steps I see
5. This current question about cancellation

There was no step 3 or any indication of a cancelled message/request. The conversation flow appears to have skipped directly from step 2 to step 4 without any visible cancellation event on my end.

Is the missing step 3 related to the bug you're investigating? Are you testing whether cancelled requests leave traces or gaps in the conversation history?
[Tool uses: none]

> Usually I cancel and then say something "try again but better this time" and you are confused.

Exactly! That makes perfect sense now. When you cancel my response and then say "try again but better this time," I'm completely confused because:

1. I have no memory of what I tried the first time (the cancelled response is gone)
2. I have no context about what was wrong with my approach
3. I don't even know what request I'm supposed to be "trying again"

From my perspective, "try again but better" comes out of nowhere with no preceding context to improve upon. The cancellation creates a gap in my understanding where I'm missing both:
• Your original request that prompted my verbose/wrong response
• My actual response that you found problematic

This explains why I often respond with confusion or ask for clarification when you use phrases like "try again" after a cancellation - I literally don't know what I'm supposed to be trying again or what to do better.

It's a significant UX issue where the cancellation mechanism removes too much context, making follow-up interactions unnecessarily difficult.
[Tool uses: none]

### Steps to reproduce

1. Send "step 1: I am going to pre-pend steps to my requests. At some point I want you to tell me which steps you see in your context/chat history"
2. Send "step 2: do you understand?"
3. Send "step 3: write me a long poem about aws"
4. AI begins responding with verbose output
5. Cancel the response using Ctrl+C
6. Send "step 4: can you tell me what steps you see?"
7. Observe AI reports seeing steps 1, 2, and 4 - but no step 3
8. Send follow-up like "try again but better this time"
9. Observe AI confusion due to missing context

### Environment

```yaml
[q-details]
version = "1.18.1"
hash = "5610605baef17b76ef41448f2e943f021c2b2273"
date = "2025-10-13T22:32:38.147244Z (8d ago)"

[system-info]
chip = "AMD Ryzen 5 PRO 7540U w/ Radeon 740M Graphics"
total-cores = 6
memory = "15.26 GB"

[system-info.os.linux]
kernel_version = "5.15.167.4-microsoft-standard-WSL2"
id = "ubuntu"
name = "Ubuntu"
pretty_name = "Ubuntu 24.04.3 LTS"
version_id = "24.04"
version = "24.04.3 LTS (Noble Numbat)"

[environment]
cwd = "/home/USER"
cli-path = "/home/USER"
install-method = "unknown"
in-wsl = true

[env-vars]
DISPLAY = ":0"
PATH = "/home/USER/.local/bin:/home/USER/.nvm/versions/node/v22.20.0/bin:/home/USER/.toolbox/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/ffmpeg/bin:/mnt/c/Program Files/Python312/Scripts/:/mnt/c/Program Files/Python312/:/mnt/c/Program Files/itacsvc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/PuTTY/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Users/USER/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/USER/AppData/Local/GitDefender/bin:/mnt/c/Users/USER/Documents/terraform_1.9.8_windows_amd64:/mnt/c/Program Files/Go/bin:/mnt/c/Program Files/Amazon/AWSCLIV2/:/Docker/host/bin:/mnt/c/Program Files (x86)/ACMEGuardian/:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/Amazon/FOPAzureADMAnagementApp/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Program Files (x86)/Quarantine/:/mnt/c/Program Files/GitDefender/bin:/mnt/c/Program Files/Common Files/AmazonMidwayClientSuite/bin/:/mnt/c/ffmpeg/bin:/mnt/c/Users/USER/Documents/terraform_1.9.8_windows_amd64:/mnt/c/Users/USER/go/bin:/mnt/c/Users/USER/AppData/Local/nvm:/mnt/c/nvm4w/nodejs:/mnt/c/Users/USER/AppData/Local/Box/Box Edit/:/mnt/c/Users/USER/AppData/Local/Programs/Kiro/bin:/snap/bin:/home/USER/.local/bin"
QTERM_SESSION_ID = "5c0e6285690948468bf41c0844f7117a"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.18.1"
SHELL = "/bin/bash"
TERM = "xterm-256color"

[chat-settings]

[chat-trusted_tools]
@awslabs.aws-documentation-mcp-server=trusted
fs_read=trusted

[chat-failed_request_ids]
none

[chat-context]
current_profile=amzn-default
profile_context=
AmazonQ.md
README.md
.amazonq/rules/**/*.md
/home/USER/.config/amazonq/rules/**/*.md

files=
/home/USER/.config/amazonq/rules/global-context.md, 2290 tkns
total context size=2290 tkns
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.