[codex] Move persistence policy application into ThreadStore (#27318)

Move the application of the persistence policy into the thread store, so
thread stores can get raw append items rather than canonical append
items. This will enable store-specific projections over the raw input
items.
This commit is contained in:
Tom
2026-06-11 16:24:12 -07:00
committed by GitHub
Unverified
parent eddc5c75ed
commit b2cc01fc7c
8 changed files with 91 additions and 54 deletions
+10 -3
View File
@@ -116,7 +116,11 @@ impl LiveThread {
{
Ok(history) => params.history = Some(history.items),
Err(err) => {
let _ = thread_store.discard_thread(thread_id).await;
if let Err(discard_err) = thread_store.discard_thread(thread_id).await {
warn!(
"failed to discard thread persistence after resume history load failed: {discard_err}"
);
}
return Err(err);
}
}
@@ -131,15 +135,18 @@ impl LiveThread {
pub async fn append_items(&self, items: &[RolloutItem]) -> ThreadStoreResult<()> {
let canonical_items = persisted_rollout_items(items);
if canonical_items.is_empty() {
if items.is_empty() {
return Ok(());
}
self.thread_store
.append_items(AppendThreadItemsParams {
thread_id: self.thread_id,
items: canonical_items.clone(),
items: items.to_vec(),
})
.await?;
if canonical_items.is_empty() {
return Ok(());
}
let update = self
.metadata_sync
.lock()