mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Tighten panic on double truncation (#6701)
This commit is contained in:
@@ -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}"
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user