mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[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:
@@ -5,6 +5,7 @@ use codex_protocol::protocol::ThreadMemoryMode;
|
||||
use codex_rollout::RolloutConfig;
|
||||
use codex_rollout::RolloutRecorder;
|
||||
use codex_rollout::RolloutRecorderParams;
|
||||
use codex_rollout::persisted_rollout_items;
|
||||
use tracing::warn;
|
||||
|
||||
use super::LocalThreadStore;
|
||||
@@ -77,9 +78,13 @@ pub(super) async fn append_items(
|
||||
store: &LocalThreadStore,
|
||||
params: AppendThreadItemsParams,
|
||||
) -> ThreadStoreResult<()> {
|
||||
let canonical_items = persisted_rollout_items(params.items.as_slice());
|
||||
if canonical_items.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let recorder = store.live_recorder(params.thread_id).await?;
|
||||
recorder
|
||||
.record_canonical_items(params.items.as_slice())
|
||||
.record_canonical_items(canonical_items.as_slice())
|
||||
.await
|
||||
.map_err(thread_store_io_error)?;
|
||||
// LiveThread applies metadata immediately after append_items returns. Wait for the local
|
||||
|
||||
Reference in New Issue
Block a user