Skip to content

fix(chat): cancel tool call when user sends message without accepting/rejecting diff#12095

Open
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
octo-patch:fix/issue-12051-cancel-tool-call-on-diff-reject
Open

fix(chat): cancel tool call when user sends message without accepting/rejecting diff#12095
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
octo-patch:fix/issue-12051-cancel-tool-call-on-diff-reject

Conversation

@octo-patch
Copy link
Copy Markdown
Contributor

@octo-patch octo-patch commented Apr 10, 2026

Fixes #12051

Problem

When multi_edit (or similar tools with respondImmediately: false) presents a diff and the user sends a new message without clicking Accept or Reject, the tool call remains in calling state with no output. constructMessages emits "No tool output", making the model assume the edit succeeded. Subsequent multi_edit calls then fail because their old_string values no longer match the actual (unmodified) file.

Solution

When pending apply states (status "done") are rejected because the user sends a new message, we now also dispatch cancelToolCall for any associated tool call IDs. The tool call transitions from calling to canceled status before messages are constructed and sent to the model.

The model now receives "The user cancelled this tool call." instead of "No tool output", correctly signaling that the edit was not applied.

Testing

  • Ask the agent to edit a file using multi_edit
  • When the diff appears, type a new message in chat without clicking Accept or Reject
  • Before: model receives "No tool output" and proceeds as if edit succeeded
  • After: model receives cancellation message and knows the edit was not applied

Summary by cubic

Cancel multi_edit (and other respondImmediately: false tools) when the user sends a new chat message without accepting/rejecting the diff. The tool call now moves to canceled, and the model sees a clear cancellation instead of "No tool output."

  • Bug Fixes
    • Dispatch cancelToolCall when rejecting pending apply states on new message.
    • Prevents false assumptions about applied edits and multi_edit failures from mismatched old_string values.

Written for commit 25bd83d. Summary will update on new commits.

…/rejecting diff

When multi_edit (or similar tools) presents a diff and the user sends a new
message without clicking Accept or Reject, the tool call was left in calling
state with no output. This caused constructMessages to emit No tool output,
which made the model assume the edit succeeded and proceed with incorrect
assumptions about file contents.

Now, when pending apply states are rejected because the user sends a new message,
we also cancel any associated tool calls. This changes the tool result from
No tool output to the cancellation message, correctly signaling
to the model that the edit was not applied.

Fixes continuedev#12051
@octo-patch octo-patch requested a review from a team as a code owner April 10, 2026 03:17
@octo-patch octo-patch requested review from sestinj and removed request for a team April 10, 2026 03:17
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Replying to chat without clicking Accept or Reject on multi_edit produces "No tool output"

1 participant