diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index f25ef59f..14fff6da 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -4093,6 +4093,7 @@ fn reconcile_turn_liveness(app: &mut App, now: Instant, has_running_agents: bool { app.is_loading = false; app.dispatch_started_at = None; + app.turn_started_at = None; app.push_status_toast( "Turn dispatch timed out; the engine may have stopped. Please try again.", StatusToastLevel::Error, @@ -4112,6 +4113,7 @@ fn reconcile_turn_liveness(app: &mut App, now: Instant, has_running_agents: bool { app.is_loading = false; app.dispatch_started_at = None; + app.turn_started_at = None; app.push_status_toast( "Recovered from an inconsistent busy state.", StatusToastLevel::Warning, diff --git a/crates/tui/src/tui/ui/tests.rs b/crates/tui/src/tui/ui/tests.rs index 285155e7..a2e8ddae 100644 --- a/crates/tui/src/tui/ui/tests.rs +++ b/crates/tui/src/tui/ui/tests.rs @@ -2291,12 +2291,14 @@ fn turn_liveness_watchdog_clears_stale_dispatch() { app.is_loading = true; app.dispatch_started_at = Some(Instant::now() - DISPATCH_WATCHDOG_TIMEOUT - Duration::from_millis(1)); + app.turn_started_at = Some(Instant::now()); let recovered = reconcile_turn_liveness(&mut app, Instant::now(), false); assert!(recovered); assert!(!app.is_loading); assert!(app.dispatch_started_at.is_none()); + assert!(app.turn_started_at.is_none()); let toast = app.status_toasts.back().expect("watchdog toast"); assert_eq!(toast.level, StatusToastLevel::Error); assert!(toast.text.contains("Turn dispatch timed out")); @@ -2308,12 +2310,14 @@ fn turn_liveness_reconciles_completed_busy_state() { app.is_loading = true; app.runtime_turn_status = Some("completed".to_string()); app.dispatch_started_at = Some(Instant::now()); + app.turn_started_at = Some(Instant::now()); let recovered = reconcile_turn_liveness(&mut app, Instant::now(), false); assert!(recovered); assert!(!app.is_loading); assert!(app.dispatch_started_at.is_none()); + assert!(app.turn_started_at.is_none()); let toast = app.status_toasts.back().expect("reconciliation toast"); assert_eq!(toast.level, StatusToastLevel::Warning); assert!(