Skip to content

Footer shows the same duration twice on a session's first turn (turn clock == worked chip) #6041

Description

@Hmbown

Symptom

The footer prints one elapsed time twice:

using tool 22m 39s · 1 shell, ⏱ 2 scheduled · worked 22m 39s

Founder: "we consistently have the same timer twice."

It is not constant. An earlier session showed sub-agents underway 13m 11s … worked 27m 36s — different, and both useful.

Cause

working_clock in crates/tui/src/tui/phase_strip.rs:1095 returns two halves from the same base:

let turn = app.turn_started_at.map(|started| started.elapsed());
// turn half:    "{phase_label} {turn}"
let worked = app
    .cumulative_turn_duration
    .saturating_add(turn.unwrap_or_default());
// session half: "worked {worked}"

cumulative_turn_duration is the sum of finished turns. On the first turn of a session it is zero, so worked == turn exactly, and the two chips render the identical string. The doc comment above the function already describes the session clock as "the sum of finished turns plus the live turn" — on turn one there are no finished turns, so the second chip is tautological.

That is why it collides on a long first turn (22m 39s here) and separates later: the 13m/27m screenshot was a session that already had ~14m of completed turns behind it.

The CLOCK_SESSION_FLOOR_SECS = 60 floor makes it more visible, not less — the chip only appears once the turn passes a minute, which on a first turn is precisely when it starts duplicating.

Suggested fix

Suppress the session half while it carries no information beyond the turn half — when cumulative_turn_duration.is_zero(), or more defensively when the two formatted strings are equal. The turn half is the more informative of the two (it names the phase: using tool, sub-agents underway, waiting on you), so the worked chip is the one to drop.

Keep both as soon as a turn has finished, which is when worked starts saying something the turn clock cannot.

Evidence

crates/tui/src/tui/phase_strip.rs:1095-1131, screenshot from the founder's 0.9.13 dogfood session.

Milestone is a guess — filed into the 0.9.13 line as requested; move it if the release scope is closed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions