|
| 1 | +diff --git a/codex-rs/rollout/src/lib.rs b/codex-rs/rollout/src/lib.rs |
| 2 | +--- a/codex-rs/rollout/src/lib.rs |
| 3 | ++++ b/codex-rs/rollout/src/lib.rs |
| 4 | +@@ -144,6 +144,7 @@ |
| 5 | + pub use persistence_metrics::RolloutPersistenceTelemetry; |
| 6 | + pub use persistence_metrics::measure_and_filter_rollout_items; |
| 7 | + pub use policy::into_persisted_rollout_items; |
| 8 | ++pub use policy::persisted_event_msg; |
| 9 | + pub use policy::persisted_rollout_item; |
| 10 | + pub use policy::persisted_rollout_items; |
| 11 | + pub use policy::should_persist_response_item; |
| 12 | +diff --git a/codex-rs/rollout/src/policy.rs b/codex-rs/rollout/src/policy.rs |
| 13 | +--- a/codex-rs/rollout/src/policy.rs |
| 14 | ++++ b/codex-rs/rollout/src/policy.rs |
| 15 | +@@ -124,7 +124,8 @@ |
| 16 | + } |
| 17 | + } |
| 18 | + |
| 19 | +-fn persisted_event_msg( |
| 20 | ++/// Returns the authoritative durable representation of an event. |
| 21 | ++pub fn persisted_event_msg( |
| 22 | + ev: &EventMsg, |
| 23 | + history_mode: ThreadHistoryMode, |
| 24 | + ) -> Option<Cow<'_, EventMsg>> { |
| 25 | +@@ -232,7 +233,13 @@ |
| 26 | + history_mode: ThreadHistoryMode, |
| 27 | + ) -> Option<Cow<'a, EventMsg>> { |
| 28 | + match history_mode { |
| 29 | +- ThreadHistoryMode::Legacy => { |
| 30 | ++ // The SDK also reads execution completions from legacy in-memory histories. |
| 31 | ++ ThreadHistoryMode::Legacy |
| 32 | ++ if !matches!( |
| 33 | ++ event.item, |
| 34 | ++ TurnItem::CommandExecution(_) | TurnItem::McpToolCall(_) | TurnItem::FileChange(_) |
| 35 | ++ ) => |
| 36 | ++ { |
| 37 | + // Legacy rollouts keep only items with no lossless raw ResponseItem or legacy |
| 38 | + // equivalent. |
| 39 | + (matches!( |
| 40 | +@@ -247,7 +254,7 @@ |
| 41 | + )) |
| 42 | + .then_some(Cow::Borrowed(ev)) |
| 43 | + } |
| 44 | +- ThreadHistoryMode::Paginated => match &event.item { |
| 45 | ++ ThreadHistoryMode::Legacy | ThreadHistoryMode::Paginated => match &event.item { |
| 46 | + TurnItem::CommandExecution(CommandExecutionItem { |
| 47 | + aggregated_output: Some(aggregated_output), |
| 48 | + .. |
0 commit comments