Paginate TUI transcript history (#36950)

## What changed

- Load older transcript items in bounded pages as users scroll upward, and let `Home` continue fetching until the start of the thread.
- Show loading, partial-history, retry, and complete states in the transcript overlay while preserving the visible scroll position as pages are prepended.
- Use paginated history for resume, fork, retry, and prompt-edit flows, while falling back to legacy history requests when the app server does not support pagination.

## Testing

- Cover multi-page transcript loading, page-boundary prompt reconciliation, legacy-server fallback, bounded retry history, and transcript history-state rendering.

GitOrigin-RevId: cc6b764bc4185d079b2f68bedf235c1d08278dfb
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-04 19:12:46 +00:00
1 parent 3b8d22ec2c
commit dbcd837c20
16 files changed
+1019 -169

No files matched your search

+15 -13
View File
@@ -384,22 +384,24 @@ impl App {
error = %resume_err,
"failed to resume live thread for selection; falling back to thread/read"
);
let (thread, turns) = match app_server
.thread_read(thread_id, /*include_turns*/ true)
let mut thread = app_server
.thread_read(thread_id, /*include_turns*/ false)
.await?;
match app_server
.hydrate_initial_thread_history(
&mut thread,
/*turn_cursor*/ None,
/*item_cursor*/ None,
Some(&self.config),
crate::app_server_session::HistoryHydrationScope::Initial,
)
.await
{
Ok(thread) => {
let turns = thread.turns.clone();
(thread, turns)
}
Err(err) if Self::can_fallback_from_include_turns_error(&err) => {
let thread = app_server
.thread_read(thread_id, /*include_turns*/ false)
.await?;
(thread, Vec::new())
}
Ok(()) => {}
Err(err) if Self::can_fallback_from_include_turns_error(&err) => {}
Err(err) => return Err(err),
};
}
let turns = thread.turns.clone();
if turns.is_empty() {
// A `thread/read` fallback without turns would create a blank local replay
// channel with no live listener attached, which blocks later real re-attach.