From c31d531954c5717892f6e22dd2691581345ce481 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 9 Apr 2026 22:31:00 -0400 Subject: [PATCH] Fix status bar timer: use activity start time, tick every 1s The status bar timer was showing turn/call elapsed times (0s, 0/60s) instead of the activity's actual elapsed time. Use activity_started from the ActivityEntry directly. Add a 1s tick to the UI select loop when an activity is active so the timer updates live. Co-Authored-By: Proof of Concept --- src/user/chat.rs | 7 ++++--- src/user/mod.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/user/chat.rs b/src/user/chat.rs index 800bf2a..3d2a2b6 100644 --- a/src/user/chat.rs +++ b/src/user/chat.rs @@ -902,9 +902,8 @@ impl InteractScreen { // Draw status bar with live activity indicator let timer = if !app.activity.is_empty() { - let total = self.turn_started.map(|t| t.elapsed().as_secs()).unwrap_or(0); - let call = self.call_started.map(|t| t.elapsed().as_secs()).unwrap_or(0); - format!(" {}s, {}/{}s", total, call, self.call_timeout_secs) + let elapsed = app.activity_started.map(|t| t.elapsed().as_secs()).unwrap_or(0); + format!(" {}s", elapsed) } else { String::new() }; @@ -1057,6 +1056,8 @@ impl ScreenView for InteractScreen { app.activity = st.activities.last() .map(|a| a.label.clone()) .unwrap_or_default(); + app.activity_started = st.activities.last() + .map(|a| a.started); } if let Ok(ctx) = self.agent.context.try_lock() { let window = crate::agent::context::context_window(); diff --git a/src/user/mod.rs b/src/user/mod.rs index 8904dcd..6904234 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -358,7 +358,11 @@ async fn run( let mut startup_done = false; let mut dirty = true; // render on first loop + let mut activity_tick = tokio::time::interval(std::time::Duration::from_secs(1)); + activity_tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); + loop { + let has_activity = !app.activity.is_empty(); tokio::select! { biased; @@ -380,6 +384,10 @@ async fn run( Some(channels) = channel_rx.recv() => { app.set_channel_status(channels); } + + _ = activity_tick.tick(), if has_activity => { + dirty = true; + } } // State sync on every wake