From b7b50d6e98dd5b9d4d627d851b371792a4bc55c8 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Sun, 15 Feb 2026 16:38:55 -0800 Subject: [PATCH] Add TODO for legacy compacted history context reinjection --- codex-rs/core/src/codex.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 08c5a4da28..8608493851 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -2387,6 +2387,10 @@ impl Session { if let Some(replacement) = &compacted.replacement_history { history.replace(replacement.clone()); } else { + // TODO(ccunningham): When we have TurnContextItem-based legacy reconstruction, + // build historical turn context from those items and inject it at the correct + // point in compacted history instead of prepending the current initial context. + // This matters for legacy rollouts with replacement_history=None. let user_messages = collect_user_messages(history.raw_items()); let mut rebuilt = self.build_initial_context(turn_context).await; rebuilt.extend(compact::build_compacted_history(