[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
+6 -1
View File
@@ -14,6 +14,7 @@ use codex_protocol::protocol::RolloutItem;
use codex_protocol::protocol::SessionMeta;
use codex_protocol::protocol::SessionMetaLine;
use codex_protocol::protocol::ThreadMemoryMode;
use codex_rollout::persisted_rollout_items;
use crate::AppendThreadItemsParams;
use crate::ArchiveThreadParams;
@@ -215,13 +216,17 @@ impl ThreadStore for InMemoryThreadStore {
}
async fn append_items(&self, params: AppendThreadItemsParams) -> ThreadStoreResult<()> {
let canonical_items = persisted_rollout_items(params.items.as_slice());
if canonical_items.is_empty() {
return Ok(());
}
let mut state = self.state.lock().await;
state.calls.append_items += 1;
state
.histories
.entry(params.thread_id)
.or_default()
.extend(params.items);
.extend(canonical_items);
Ok(())
}