clear activity indicator on error paths

"thinking..." was getting stuck in the status bar when a turn
ended with a stream error, context overflow, or model error —
only the success path cleared it. Now all error returns clear
the activity indicator.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 17:53:51 -04:00
parent a360607fad
commit 35f231233f

View file

@ -351,11 +351,13 @@ impl Agent {
tokio::time::sleep(std::time::Duration::from_secs(2)).await; tokio::time::sleep(std::time::Duration::from_secs(2)).await;
continue; continue;
} }
let _ = ui_tx.send(UiMessage::Activity(String::new()));
return Err(err); return Err(err);
} }
if finish_reason.as_deref() == Some("error") { if finish_reason.as_deref() == Some("error") {
let detail = if content.is_empty() { "no details".into() } else { content }; let detail = if content.is_empty() { "no details".into() } else { content };
let _ = ui_tx.send(UiMessage::Activity(String::new()));
return Err(anyhow::anyhow!("model stream error: {}", detail)); return Err(anyhow::anyhow!("model stream error: {}", detail));
} }