From 023ccef57de01ebea83f47d4bce31937c7e03d97 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Tue, 24 Mar 2026 14:06:05 -0700 Subject: [PATCH] core: preserve rollback baseline trim semantics Co-authored-by: Codex --- codex-rs/core/src/context_manager/history.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codex-rs/core/src/context_manager/history.rs b/codex-rs/core/src/context_manager/history.rs index b3bf441254..15e3f9842d 100644 --- a/codex-rs/core/src/context_manager/history.rs +++ b/codex-rs/core/src/context_manager/history.rs @@ -509,8 +509,8 @@ impl ContextManager { /// that boundary. /// /// If any trimmed developer message was a mixed `build_initial_context` bundle containing both - /// rollback-trimmable contextual fragments and persistent developer text, this also clears the - /// stored `reference_context_item` baseline so the next real turn falls back to full + /// rollback-trimmable contextual fragments and persistent developer text, this shadows the + /// stored turn context as a model-visible baseline so the next real turn falls back to full /// reinjection. fn trim_pre_turn_context_updates( &mut self, @@ -527,7 +527,7 @@ impl ContextManager { // Mixed `build_initial_context` bundles are not reconstructible from // steady-state diffs once trimmed, so the next real turn must fully // reinject context instead of diffing against a stale baseline. - self.reference_context_item = None; + self.set_reference_context_item(None); } cut_idx -= 1; }