Skip to content

fix(core): clarify user-directed tool cancellation - #10280

Draft
AaronZ345 wants to merge 1 commit into
QwenLM:mainfrom
AaronZ345:fix/10170-esc-cancel-stop
Draft

fix(core): clarify user-directed tool cancellation#10280
AaronZ345 wants to merge 1 commit into
QwenLM:mainfrom
AaronZ345:fix/10170-esc-cancel-stop

Conversation

@AaronZ345

Copy link
Copy Markdown
Contributor

What this PR does

  • Updates the model-facing message for post-completion tool cancellations to make the user's Esc action explicit.
  • Keeps the existing discarded-output signal while telling the model to stop and await further instructions instead of retrying or working around the cancelled tool call.
  • Adds a regression assertion for the post-completion cancellation branch.

Why it's needed

When a user presses Esc while a tool is running, the cancellation can arrive after the tool has already produced output. The previous message only said the tool had already completed and its output was discarded, which can be misread as a transient tool/runtime issue and cause the model to retry. This makes the user intent clear.

Reviewer Test Plan

  • npm -w @qwen-code/qwen-code-core test -- src/core/coreToolScheduler.test.ts -t "post-completion cancellation"
  • npm -w @qwen-code/qwen-code-core test -- src/core/coreToolScheduler.test.ts
  • npm -w @qwen-code/qwen-code-core run lint

Risk & Scope

  • Low risk: only changes the cancellation text returned to the model for the post-completion cancellation branch.
  • No scheduler state-machine or tool execution behavior changes.

Linked Issues

Fixes #10170

Make post-completion tool cancellations tell the model to stop and await instructions instead of implying a transient completion race, so Esc is less likely to trigger retries.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(cli): Esc during tool execution feeds a misleading 'Operation Cancelled' tool_result; model misattributes it and keeps looping instead of stopping

1 participant