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 <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 22:31:00 -04:00 committed by Kent Overstreet
parent 5fe22a5f23
commit c31d531954
2 changed files with 12 additions and 3 deletions

View file

@ -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();