Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Handle authorization send errors instead of silently dropping with .ok() (#48639)
Richard Feldman4a89623977be
diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex 7a97b4e0582..57aca268ed9 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| {