Skip to content

fix(cursor): close tool calls for every cancelled turn - #5990

Closed
404Wolf wants to merge 1 commit into
mainfrom
wolf/cursor-cancel-tool-cleanup
Closed

404Wolf wants to merge 1 commit into
mainfrom
wolf/cursor-cancel-tool-cleanup

Conversation

@404Wolf

@404Wolf 404Wolf commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #5960.

Summary

  • centralize open tool-call cleanup after the final cancelled verdict so client, Cursor-reported, and polled cancellations all close lingering calls
  • discard learned tool kinds when calls finish or are force-closed, without resurrecting them from Cursor's late completion descriptor
  • cover Cursor-reported cancellation with an open call and call-ID reuse using recorded event ordering

Testing

  • cargo fmt --check
  • cargo test -p cursor_cloud_agents

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dbc2e8d9-3a26-4560-9173-5cda793bab45

📥 Commits

Reviewing files that changed from the base of the PR and between b1f738d and 8db4c55.

📒 Files selected for processing (4)
  • crates/cursor_cloud_agents/src/domain/service.rs
  • crates/cursor_cloud_agents/src/domain/service/test.rs
  • crates/cursor_cloud_agents/src/domain/translate.rs
  • crates/cursor_cloud_agents/src/domain/translate/test.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Cancelled runs now consistently close any unfinished tool calls and report them as failed.
    • Reused tool-call identifiers no longer inherit metadata from previously completed calls.
    • Tool-call classification is now cleared when calls finish or are force-closed.
    • Call identifiers are normalized for more reliable tracking.

Walkthrough

Cancelled runs now centralize open tool-call cleanup in prompt. The service test verifies that an in-flight call receives a failed update. Translation state now removes learned tool kinds for completed or force-closed calls and records interaction metadata only for open calls. Tests verify that reused call IDs receive fresh tool classification.

Merge Risk: 🔵 Low · up to 8db4c

Cancellation now closes lingering tool calls across all supported cancellation paths, but delayed metadata for reused call identifiers could briefly mislabel activity, and notification failures could leave a client showing a stale in-progress call. The PR is mergeable with explicit owner awareness of these bounded follow-ups.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses conventional commit format with the fix type and cursor scope. It clearly describes the cancellation cleanup change and is 54 characters long, below the 72-character limit.
Description check ✅ Passed The description directly explains centralized cleanup for cancelled turns, tool-kind state handling, tests, and validation commands. It is related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@404Wolf 404Wolf closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant