From 3f1c4b9add8908936699ce47b17c94f8c9fd8018 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 14 Nov 2025 23:28:59 -0800 Subject: [PATCH] Tighten panic on double truncation (#6701) --- codex-rs/core/src/truncate.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/codex-rs/core/src/truncate.rs b/codex-rs/core/src/truncate.rs index c82e08856..42d6a967d 100644 --- a/codex-rs/core/src/truncate.rs +++ b/codex-rs/core/src/truncate.rs @@ -2,7 +2,6 @@ //! and suffix on UTF-8 boundaries, and helpers for line/token‑based truncation //! used across the core crate. -use crate::util::error_or_panic; use codex_protocol::models::FunctionCallOutputContentItem; use codex_utils_string::take_bytes_at_char_boundary; use codex_utils_string::take_last_bytes_at_char_boundary; @@ -85,7 +84,7 @@ fn truncate_formatted_exec_output( limit_bytes: usize, limit_lines: usize, ) -> String { - debug_panic_on_double_truncation(content); + error_on_double_truncation(content); let head_lines: usize = limit_lines / 2; let tail_lines: usize = limit_lines - head_lines; // 128 let head_bytes: usize = limit_bytes / 2; @@ -148,11 +147,11 @@ fn truncate_formatted_exec_output( result } -fn debug_panic_on_double_truncation(content: &str) { +fn error_on_double_truncation(content: &str) { if content.contains("Total output lines:") && content.contains("omitted") { - error_or_panic(format!( + tracing::error!( "FunctionCallOutput content was already truncated before ContextManager::record_items; this would cause double truncation {content}" - )); + ); } }