From 214abf86bb8a7989d8779d51370277f936a73e71 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Thu, 5 Feb 2026 18:55:42 -0800 Subject: [PATCH] Clarify pending-call trim guard in remote compaction --- codex-rs/core/src/compact_remote.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codex-rs/core/src/compact_remote.rs b/codex-rs/core/src/compact_remote.rs index ab46351715..49fe4a02ff 100644 --- a/codex-rs/core/src/compact_remote.rs +++ b/codex-rs/core/src/compact_remote.rs @@ -126,6 +126,8 @@ fn trim_function_call_history_to_fit_context_window( let Some(last_item) = history.raw_items().last() else { break; }; + // Keep a trailing tool call until its output is present; trimming the + // call first can orphan a later-arriving output during mid-stream auto-compaction. if is_pending_tool_call_without_output(last_item, history.raw_items()) { break; }