commit 32ba61c34bd3606e978719c28103363caf0c21ec
parent e064961ad518a31df01af79ba0605cf9d4ef9436
Author: William Casarin <jb55@jb55.com>
Date: Mon, 9 Feb 2026 11:27:07 -0800
dave: handle send result for tool calls to prevent panic
Replace unwrap() with is_ok() check when sending tool calls response,
only calling request_repaint() on success. This prevents the task from
panicking when the UI receiver is dropped.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/crates/notedeck_dave/src/backend/openai.rs b/crates/notedeck_dave/src/backend/openai.rs
@@ -155,9 +155,12 @@ impl AiBackend for OpenAiBackend {
}
if !parsed_tool_calls.is_empty() {
- tx.send(DaveApiResponse::ToolCalls(parsed_tool_calls))
- .unwrap();
- ctx.request_repaint();
+ if tx
+ .send(DaveApiResponse::ToolCalls(parsed_tool_calls))
+ .is_ok()
+ {
+ ctx.request_repaint();
+ }
}
tracing::debug!("stream closed");