From 41b2533e767931d9be233a663c7c009b8da2e8f9 Mon Sep 17 00:00:00 2001 From: Tom Wiltzius Date: Thu, 4 Jun 2026 21:53:43 -0700 Subject: [PATCH] document projection persistence follow-ups --- .../src/protocol/thread_item_projection.rs | 4 ++++ codex-rs/core/src/session/session.rs | 2 ++ codex-rs/thread-store/src/live_thread.rs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/codex-rs/app-server-protocol/src/protocol/thread_item_projection.rs b/codex-rs/app-server-protocol/src/protocol/thread_item_projection.rs index 813c927a05..845689a948 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_item_projection.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_item_projection.rs @@ -24,6 +24,10 @@ mod tests; /// /// Persisting it lets the next append reuse stable item ordinals and update non-terminal /// ThreadItems without replaying the full rollout history first. +/// +/// TODO(wiltzius): Before stores persist or restore this checkpoint, include enough reducer state +/// to resume reasoning coalescing, complete open items from any turn, and tombstone rolled-back +/// closed items after restart. #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct ThreadItemProjectionCheckpoint { pub next_thread_item_ordinal: i64, diff --git a/codex-rs/core/src/session/session.rs b/codex-rs/core/src/session/session.rs index 6d5c90a291..a44f626c8c 100644 --- a/codex-rs/core/src/session/session.rs +++ b/codex-rs/core/src/session/session.rs @@ -601,6 +601,8 @@ impl Session { Box::new(codex_app_server_protocol::TurnSummaryProjectionObserver::new()), Box::new(codex_app_server_protocol::LifecycleProjectionObserver::new()), ]; + // TODO(wiltzius): Once stores persist projections, restore each observer from the + // stored projection checkpoint on resume instead of always starting fresh. Ok(Some(live_thread.with_thread_history_projection_observers( thread_history_projection_observers, ))) diff --git a/codex-rs/thread-store/src/live_thread.rs b/codex-rs/thread-store/src/live_thread.rs index 5d24abe426..c3e4d4f8fb 100644 --- a/codex-rs/thread-store/src/live_thread.rs +++ b/codex-rs/thread-store/src/live_thread.rs @@ -145,6 +145,8 @@ impl LiveThread { pub async fn append_items(&self, items: &[RolloutItem]) -> ThreadStoreResult<()> { let canonical_items = persisted_rollout_items(items); + // TODO(wiltzius): Once stores persist thread-history mutations, advance observer state + // only when the canonical append and derived mutations commit successfully together. let thread_history_mutations = self .thread_history_projection_observers .lock()