From ce5614cc76fc2fb455ecd57b7fbac9f99488ce53 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 23 Jul 2025 13:21:33 +0200 Subject: [PATCH] Reject pending tool call confirmations --- crates/acp_thread/src/acp_thread.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 7bec08a94886a568d0e9b80822532f2ffac3dfa1..efea78c666b6194cefb04ae3f6a5a8ed77895c6c 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -1,7 +1,6 @@ mod connection; pub use connection::*; -pub use acp_old::ToolCallId; use agent_client_protocol::{self as acp}; use agentic_coding_protocol as acp_old; use anyhow::{Context as _, Result}; @@ -1072,13 +1071,17 @@ impl AcpThread { mem::replace(&mut call.status, ToolCallStatus::Canceled); if let ToolCallStatus::WaitingForConfirmation { - respond_tx, .. + respond_tx, + possible_grants, } = curr_status { - // todo! do we need a way to cancel rather than reject? - respond_tx - .send(acp_old::ToolCallConfirmationOutcome::Cancel) - .ok(); + if let Some(grant_id) = possible_grants + .iter() + .find_map(|g| (!g.is_allowed).then(|| g.id.clone())) + { + // todo! do we need a way to cancel rather than reject? + respond_tx.send(grant_id).ok(); + } } } } @@ -1267,7 +1270,7 @@ impl OldAcpClientDelegate { pub async fn request_existing_tool_call_confirmation( &self, - tool_call_id: ToolCallId, + tool_call_id: acp_old::ToolCallId, confirmation: acp_old::ToolCallConfirmation, ) -> Result { let cx = &mut self.cx.clone();