Paginate transcript history in the TUI (#36948)

## Why

Paginated threads should not require the TUI to load and render their entire
history when a session is resumed.

## What changed

- Hydrate a bounded initial history page for paginated resumes and forks,
  respecting the configured terminal reflow row budget.
- Load older transcript items in the background as users navigate upward, while
  preserving the viewport, live output, and backtrack selection.
- Reconcile review-mode prompts across page boundaries and keep restored token
  usage hidden until it can be attributed to a persisted turn.

## Testing

- Added coverage for paginated resume and fork hydration, older-page merging,
  transcript prepending, backtrack behavior, review prompt filtering, and token
  usage restoration.

GitOrigin-RevId: 42160b943a9f6a1ba0cfe4b195c24ddf410b747d
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-04 18:59:32 +00:00
1 parent 989a0b053e
commit 8bfa49e350
26 files changed
+1360 -90

No files matched your search

+12 -8
View File
@@ -715,14 +715,18 @@ impl ChatWidget {
StatusLineItem::ContextWindowSize => self
.status_line_context_window_size()
.map(|cws| format!("{} window", format_tokens_compact(cws))),
StatusLineItem::TotalInputTokens => Some(format!(
"{} in",
format_tokens_compact(self.status_line_total_usage().input_tokens)
)),
StatusLineItem::TotalOutputTokens => Some(format!(
"{} out",
format_tokens_compact(self.status_line_total_usage().output_tokens)
)),
StatusLineItem::TotalInputTokens => (!self.token_usage_pending).then(|| {
format!(
"{} in",
format_tokens_compact(self.status_line_total_usage().input_tokens)
)
}),
StatusLineItem::TotalOutputTokens => (!self.token_usage_pending).then(|| {
format!(
"{} out",
format_tokens_compact(self.status_line_total_usage().output_tokens)
)
}),
StatusLineItem::SessionId => self.thread_id.map(|id| id.to_string()),
StatusLineItem::FastMode => Some(
if self.current_service_tier() == Some(ServiceTier::Fast.request_value()) {