mirror of
https://github.com/openai/codex.git
synced 2026-11-01 00:15:56 +00:00
Materialize paginated thread history in SQLite (#32923)
## What changed - Project durable paginated rollout records into rebuildable SQLite tables for turns, items, and projection progress while keeping JSONL as the source of truth. - Add cursor-based local reads for turn summaries and thread or per-turn items, including archived-thread and history-mode validation. - Serialize writes, shutdown, and deletion per thread so projection updates cannot race cleanup, and remove projected rows when a thread is deleted. - Preserve stable item ordering while updating repeated snapshots and expose structured turn error details. ## Testing - Cover projection, snapshot updates, summary recovery, pagination, failure handling, shutdown flushing, legacy-mode rejection, and deletion races. GitOrigin-RevId: 34533185ece7f1f5690004c7f12b0f1f34dc2640
This commit is contained in:
@@ -2515,19 +2515,18 @@ impl ThreadRequestProcessor {
|
||||
}
|
||||
err => internal_error(format!("failed to list thread items: {err}")),
|
||||
})?;
|
||||
let data =
|
||||
page.items
|
||||
.into_iter()
|
||||
.map(|item| {
|
||||
serde_json::from_slice::<ThreadItem>(&item.materialized_thread_item_json)
|
||||
.map_err(|err| {
|
||||
internal_error(format!(
|
||||
"failed to deserialize stored thread item {}: {err}",
|
||||
item.item_key
|
||||
))
|
||||
})
|
||||
let data = page
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| {
|
||||
serde_json::from_slice::<ThreadItem>(&item.item_json).map_err(|err| {
|
||||
internal_error(format!(
|
||||
"failed to deserialize stored thread item {}: {err}",
|
||||
item.item_id
|
||||
))
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(ThreadItemsListResponse {
|
||||
data,
|
||||
|
||||
Reference in New Issue
Block a user