[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
@@ -124,6 +124,14 @@ impl ThreadHistoryBuilder {
.or_else(|| self.turns.last().cloned())
}
pub fn turn_snapshot(&self, turn_id: &str) -> Option<Turn> {
self.current_turn
.as_ref()
.filter(|turn| turn.id == turn_id)
.map(Turn::from)
.or_else(|| self.turns.iter().find(|turn| turn.id == turn_id).cloned())
}
/// Returns the index of the active turn snapshot within the finished turn list.
///
/// When a turn is still open, this is the index it will occupy after