Filter live rollout items in place (#38034)

## What changed

Retain persistable items directly in the owned append buffer instead of cloning
them into a second vector. Preserve the existing history-mode filtering and
empty-append behavior.

GitOrigin-RevId: 5300312545492bef28f63521427048a27d46a9d1
This commit is contained in:
Tamir Duberstein authored and copyberry committed 2026-08-11 16:27:58 +00:00
1 parent 4496ba3fd5
commit ed390a5dc4
1 file changed
+3 -3
@@ -7,7 +7,7 @@ use codex_rollout::RolloutConfig;
use codex_rollout::RolloutItem;
use codex_rollout::RolloutRecorder;
use codex_rollout::RolloutRecorderParams;
use codex_rollout::persisted_rollout_items;
use codex_rollout::is_persisted_rollout_item;
use tracing::warn;
use super::LocalThreadStore;
@@ -289,8 +289,8 @@ async fn write_and_project(
let (recorder, history_mode) = live_writer_parts(store, thread_id).await?;
let sync_rollout_path = matches!(&write_op, RolloutWriteOp::Persist | RolloutWriteOp::Flush);
let write_op = match write_op {
RolloutWriteOp::AppendItems(items) => {
let items = persisted_rollout_items(items.as_slice(), history_mode);
RolloutWriteOp::AppendItems(mut items) => {
items.retain(|item| is_persisted_rollout_item(item, history_mode));
if items.is_empty() {
return Ok(());
}