Skip to content

feat: compact historical turns with archived per-turn stats - #445

Merged
mohitranka merged 1 commit into
mainfrom
feat/compact-historical-turns
Aug 27, 2026
Merged

mohitranka merged 1 commit into
mainfrom
feat/compact-historical-turns

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

What

Long sessions currently scroll away under full-detail history. This change collapses every historical (non-latest) turn to one line — request, outcome glyph (warning on error, check on clean completion), and real stats when the turn completed cleanly — so the transcript stays readable through long sessions while full detail remains one keystroke away.

  • Ctrl+T toggles expanding the most recently compacted turn back to full detail (TurnExpansionState, keyed by ChatItem::User index so it survives transcript-window scrolling).
  • Per-turn stats (secs · chars · tok/s · tools) are archived by turn ordinal at clean completion (record_turn_summary), so a cancelled or paused turn can never desync the ordinals of later turns. Compact rows show real archived stats instead of derived placeholders; turns without stats fall back to a derived summary.
  • The render cache key now includes the expanded-turn index and the stats-archive length, so toggles invalidate correctly.

Also in this change

  • Activity groups: per-category icons; an "N retries" badge once a recovering group reaches Success; outcome merging is now recovery-aware (latest activity wins, so a later success supersedes an earlier failure instead of a stale red state sticking); thinking narration during exploration folds into the group instead of fragmenting it.
  • Validation grouping: exec_command/write_stdin summaries now group as Validating the same way bash does (regression test included — previously they rendered as bare tool cards).
  • Busy status debounce: the pinned "Waiting for the model… / Thinking… / Running {tool}…" line only appears after 150ms of turn time (gated on turn_started, so it doesn't flicker at step boundaries); hiding is never debounced.

Tests

  • New motion_timing.rs (debounce entrance/hide behavior), turn_stats.rs (ordinal-keyed archive + cancelled-turn desync regression), plus transcript unit tests for compact rendering, turn boundaries, recovery-aware outcome merging, and the exec_command validation grouping.
  • Highlight-cache test fixture updated: all fenced blocks share one user message, because a completed historical turn compacts to a single line and would otherwise silently drop the measurement to 1 block.

Fixes observed live: exec_command-run cargo check rendered as an ungrouped card; compiled-minute-then-compact behavior dropped highlight-cache test coverage.

Historical (non-latest) turns collapse to a single line showing the request, outcome, and real archived stats when the turn completed cleanly; Ctrl+T toggles expanding the last compacted turn back to full detail. Stats are archived by turn ordinal at clean completion so a cancelled turn cannot desync later ordinals.

Also: activity groups gain per-category icons and an N-retries badge once a failing group recovers, outcome merging is now recovery-aware (latest activity wins), thinking narration folds into routine activity groups, exec_command/write_stdin validation summaries group as Validating, and the pinned busy-status line gets a 150ms debounced entrance so near-instant responses never flash it.
@mohitranka
mohitranka merged commit f69a6db into main Aug 27, 2026
7 checks passed
@mohitranka
mohitranka deleted the feat/compact-historical-turns branch August 27, 2026 05:37
mohitranka added a commit that referenced this pull request Sep 11, 2026
Historical (non-latest) turns collapse to a single line showing the request, outcome, and real archived stats when the turn completed cleanly; Ctrl+T toggles expanding the last compacted turn back to full detail. Stats are archived by turn ordinal at clean completion so a cancelled turn cannot desync later ordinals.

Also: activity groups gain per-category icons and an N-retries badge once a failing group recovers, outcome merging is now recovery-aware (latest activity wins), thinking narration folds into routine activity groups, exec_command/write_stdin validation summaries group as Validating, and the pinned busy-status line gets a 150ms debounced entrance so near-instant responses never flash it.

Co-authored-by: Mohit Ranka <[email protected]>
mohitranka added a commit that referenced this pull request Sep 11, 2026
Historical (non-latest) turns collapse to a single line showing the request, outcome, and real archived stats when the turn completed cleanly; Ctrl+T toggles expanding the last compacted turn back to full detail. Stats are archived by turn ordinal at clean completion so a cancelled turn cannot desync later ordinals.

Also: activity groups gain per-category icons and an N-retries badge once a failing group recovers, outcome merging is now recovery-aware (latest activity wins), thinking narration folds into routine activity groups, exec_command/write_stdin validation summaries group as Validating, and the pinned busy-status line gets a 150ms debounced entrance so near-instant responses never flash it.
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