ui(stream): show reconnecting spinner and surface init failures

This commit is contained in:
James Peter
2025-11-25 09:24:57 +10:00
parent 936cca8f74
commit 47e3cc7669
3 changed files with 18 additions and 4 deletions
+6
View File
@@ -6082,6 +6082,12 @@ async fn try_run_turn(
Ok(stream) => stream,
Err(e) => {
turn_latency_guard.mark_failed(Some(format!("stream_init_failed: {e}")));
sess
.notify_stream_error(
&sub_id,
format!("[transport] failed to start stream: {e}"),
)
.await;
return Err(e);
}
};
@@ -488,6 +488,9 @@ impl ChatComposer {
|| lower.contains("stream error")
|| lower.contains("stream closed")
|| lower.contains("timeout")
|| lower.contains("transport")
|| lower.contains("network")
|| lower.contains("connection")
{
"Reconnecting".to_string()
}
+9 -4
View File
@@ -4847,16 +4847,21 @@ impl ChatWidget<'_> {
fn mark_reconnecting(&mut self, message: String) {
// Keep task running and surface a concise status in the input header.
self.bottom_pane.set_task_running(true);
self.bottom_pane.update_status_text(message.clone());
self.bottom_pane.update_status_text("Reconnecting...".to_string());
if !self.reconnect_notice_active {
self.reconnect_notice_active = true;
self.push_background_tail("Connection lost. Auto-retrying…".to_string());
self.push_background_tail(format!(
"Connection lost. Auto-retrying… ({})",
message
));
}
// Brief toast so users notice recovery attempts.
self.bottom_pane
.flash_footer_notice_for("Reconnecting…".to_string(), Duration::from_secs(2));
self.bottom_pane.flash_footer_notice_for(
format!("Reconnecting… ({})", message),
Duration::from_secs(2),
);
// Do NOT clear running state or streams; the retry will resume them.
self.request_redraw();