Batch persistent history reads during reverse search (#33905)

## Why

Reverse search fetched persistent history one entry at a time, making a deep or unsuccessful search require a lookup for every older entry.

## What changed

- Keep the newest-entry probe lightweight, then scan older persistent history in bounded batches.
- Cache batch results by absolute offset and preserve continuation cursors across repeated searches.
- Ignore stale responses, retry failed batch reads a bounded number of times, and restore the draft without reporting a false “no match” state when history is unavailable.

## Testing

- Cover batch continuation, caching after query changes or cancellation, stale metadata, retry exhaustion, and thread routing.
- Verify that scanning 1,024 entries uses one single-entry lookup and eight batch lookups.

GitOrigin-RevId: efc791fcbd5290050af703dd31c5c21b33240e23
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-07-17 21:16:07 +00:00
1 parent 025db22058
commit 7ed19a9758
13 files changed
+965 -107

No files matched your search

+1 -7
View File
@@ -1175,13 +1175,7 @@ impl ChatWidget {
}
pub(crate) fn handle_history_entry_response(&mut self, event: HistoryLookupResponse) {
let HistoryLookupResponse {
offset,
log_id,
entry,
} = event;
self.bottom_pane
.on_history_entry_response(log_id, offset, entry);
self.bottom_pane.on_history_lookup_response(event);
}
pub(crate) fn pre_draw_tick(&mut self) {