diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 7a97b4e05828452d674a307dd50d2689390e19ce..57aca268ed9eb43949c0a761cfb83aac34e7c91f 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -3128,7 +3128,8 @@ impl ToolCallEventStream { } let (response_tx, response_rx) = oneshot::channel(); - self.stream + if let Err(error) = self + .stream .0 .unbounded_send(Ok(ThreadEvent::ToolCallAuthorization( ToolCallAuthorization { @@ -3172,7 +3173,12 @@ impl ToolCallEventStream { context: None, }, ))) - .ok(); + { + log::error!("Failed to send tool call authorization: {error}"); + return Task::ready(Err(anyhow!( + "Failed to send tool call authorization: {error}" + ))); + } let fs = self.fs.clone(); cx.spawn(async move |cx| { @@ -3224,7 +3230,8 @@ impl ToolCallEventStream { let options = context.build_permission_options(); let (response_tx, response_rx) = oneshot::channel(); - self.stream + if let Err(error) = self + .stream .0 .unbounded_send(Ok(ThreadEvent::ToolCallAuthorization( ToolCallAuthorization { @@ -3237,7 +3244,12 @@ impl ToolCallEventStream { context: Some(context), }, ))) - .ok(); + { + log::error!("Failed to send tool call authorization: {error}"); + return Task::ready(Err(anyhow!( + "Failed to send tool call authorization: {error}" + ))); + } let fs = self.fs.clone(); cx.spawn(async move |cx| {