Skip to content

fix(tui): full-view age tracks last message, surviving daemon restarts#943

Merged
edwin-zvs merged 1 commit into
mainfrom
last-message-age
Jul 22, 2026
Merged

fix(tui): full-view age tracks last message, surviving daemon restarts#943
edwin-zvs merged 1 commit into
mainfrom
last-message-age

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Summary

After a daemon restart, every resumed session's xx ago in the full session-list view snapped back to 0s even with no new messages. Root cause: the age read SessionSummary::last_event_at, which the daemon stamps for every persisted transcript event — and startup resume writes Status events (RunningAwaitingInput) for each non-terminal session, so "last event" genuinely became "just now" on restart. The same mechanism let tool blocks, usage reports, and /model changes refresh the age without any conversation movement.

Fix — make the age mean "since the conversation last moved":

  • protocol: new SessionSummary::last_message_at, stamped only when a chat Message event persists; cleared on Reset (the transcript truncates there anyway).
  • daemon: restored at load from the transcript's newest Message event's own timestamp, in the existing self-healing recount walk (same pattern as message_count/tokens) — so it survives restarts and backfills sessions recorded before the field existed.
  • tui: the full view's idle branch prefers last_message_at and falls back to last_event_at for sessions with no messages (plain shells keep "any recorded activity" semantics). The busy Xs running branch is unchanged.

Spec 0106's activity wording updated to record the semantics.

Testing

  • cargo test --workspace green.
  • Extended load_recounts_chat_messages_from_the_transcript: last_message_at restores from the newest Message event's timestamp while trailing non-message events (with newer stamps) don't move it.
  • Extended the full-view detail-line test: with both fields set, the age tracks the older message stamp, not the newer event stamp.

🤖 Generated with Claude Code

The full session-list view's 'xx ago' read last_event_at, which every
persisted transcript event refreshes — including the Status rows that
daemon-restart resume writes — so idle sessions snapped back to '0s ago'
on every restart without any new conversation.

- protocol: add SessionSummary::last_message_at, stamped only when a chat
  Message event persists; cleared on Reset.
- daemon: restore it at load from the transcript's newest Message event
  timestamp (the same self-healing recount walk as message_count), so it
  survives restarts and backfills pre-field sessions.
- tui: the full view's idle age prefers last_message_at, falling back to
  last_event_at for sessions with no messages (plain shells).
@edwin-zvs
edwin-zvs merged commit 751a548 into main Jul 22, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the last-message-age branch July 22, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant