Fall back to summary history for read-only conversations (#45980)

## Why

History paging failures can prevent the TUI from opening a conversation that is already open elsewhere, even when its prompts and final replies are available through turn summaries.

## What changed

- When paginated read-only history loading fails, request the latest 100 turns from `thread/turns/list` with `itemsView: summary` and display them in chronological order.
- Clear history pagination state and show a notice that intermediate messages and tool activity are unavailable. Surface the notice during startup, session selection, and command center selection.
- Show a concise retry message when the command center cannot load the conversation, preserving the current conversation.

## Testing

Extend read-only history tests to cover summary recovery, the 100-turn limit and ordering, the user notice, and preservation of the current conversation when both history loading methods fail.

GitOrigin-RevId: c9f06ad58ed5573ce0b4578f429558bfd475830f
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-16 16:46:10 +00:00
1 parent 5761102868
commit d7104e268b
6 files changed
+239 -42

No files matched your search

+15 -5
View File
@@ -491,6 +491,7 @@ impl App {
crate::app_server_session::ResumeModelSettings::PreserveExistingThread
}
};
let mut history_notice = None;
let (resumed, read_only) = if let Some((_, started)) = started {
(started, false)
} else if !unloaded
@@ -519,11 +520,16 @@ impl App {
)
.await
{
Ok(thread) => (thread, true),
Err(error) => {
self.add_agents_overview_error(format!(
"Failed to view task open elsewhere: {error}"
));
Ok((thread, notice)) => {
history_notice = notice;
(thread, true)
}
Err(_) => {
tracing::warn!("Failed to load read-only conversation history");
self.add_agents_overview_error(
"Couldn't load this conversation. Please try again."
.to_string(),
);
return Ok(AppRunControl::Continue);
}
}
@@ -606,6 +612,10 @@ impl App {
self.ensure_thread_channel(root_thread_id)
.mark_external_writer();
self.chat_widget.show_external_writer_thread();
if let Some(notice) = history_notice {
self.chat_widget
.add_info_message(notice.to_string(), /*hint*/ None);
}
}
let mut destination_config = self.chat_widget.config_ref().clone();
if self.app_server_target.uses_remote_workspace() {