mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
Release superseded assistant text from live paginated history (#58751)
## Why Live paginated history retains completed assistant text even when summaries only need the latest message. Release older text for threads with persisted history while preserving full resume responses. ## What changed - Evict superseded assistant text from live turn state while preserving corrected items and the latest assistant message. - Restore evicted text for full resume responses from prepared history pages, fetching remaining items by ID in bounded batches. Return an error if saved text is missing. - Only load the active turn when it belongs in the requested initial page, and use the item ID index for targeted history reads. ## Testing Add reducer coverage for text eviction and corrected messages. Extend running-thread resume coverage to compare full and summary items with live notifications, exercise restoration when the prepared page lacks the active turn, and check missing-text errors. GitOrigin-RevId: 3229c0cea820f117dc6331312f1e6056a8d1d52c
This commit is contained in:
@@ -294,10 +294,10 @@ pub(super) async fn page_item_rows(
|
||||
SELECT turn_id, item_id, rollout_ordinal, updated_at_ordinal, created_at_ms, started_at_ms, completed_at_ms, item_json
|
||||
FROM thread_items"#,
|
||||
);
|
||||
if params.turn_id.is_some()
|
||||
&& params.item_ids.is_none()
|
||||
&& params.after_updated_at_ordinal.is_none()
|
||||
{
|
||||
if params.item_ids.is_some() {
|
||||
// Seek each requested ID instead of scanning the turn in rollout order.
|
||||
query.push(" INDEXED BY sqlite_autoindex_thread_items_1");
|
||||
} else if params.turn_id.is_some() && params.after_updated_at_ordinal.is_none() {
|
||||
// A thread-wide index can scan earlier turns when a turn's final page is underfilled.
|
||||
query.push(" INDEXED BY idx_thread_items_by_turn_page");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user