Skip to content

Conversation

@alexhancock
Copy link
Collaborator

Fixes cancellation by properly storing the cancel token on the session. Prior to this, hitting the cancel button in clients like zed etc didn't do anything during tool calling loops. Now it works.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes cancellation functionality in the ACP implementation by ensuring the cancellation token is properly stored on the session object. Previously, cancellation requests from clients during tool calling loops were ineffective because the token wasn't accessible.

Key Changes:

  • Added code to store the cancellation token in the session after creation
  • Implemented proper session lookup and mutation within a lock scope

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +547 to +549
let session = sessions
.get_mut(&session_id)
.ok_or_else(acp::Error::invalid_params)?;
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The error acp::Error::invalid_params doesn't clearly indicate that the session was not found. Consider using a more specific error that indicates the session ID is invalid or the session doesn't exist, such as acp::Error::session_not_found or providing a custom error message.

Copilot uses AI. Check for mistakes.
@alexhancock
Copy link
Collaborator Author

Replacing this with #5588 which also makes ToolCallLocations work with line numbers and file names for the developer extension tools

@alexhancock alexhancock closed this Nov 5, 2025
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.

2 participants