Lightweight coding agent that runs in your terminal
Rust
Tighten panic on double truncation (#6701)
Ahmed Ibrahim3f1c4b9add89
diff --git a/codex-rs/core/src/truncate.rs b/codex-rs/core/src/truncate.rsindex c82e088560..42d6a967de 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; // 128let 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}"- ));+ );}}