Skip to content

Commit d014ece

Browse files
0xRaduanclaude
andcommitted
🐛 fix(tests): update user_shell_cmd test for marker overhead
- Updated head lines from 1-128 to 1-126 (126 lines) - Updated tail lines from 273-400 to 274-400 (127 lines) - Updated omitted count from 144 to 147 (400 - 253 = 147) - Accounts for 3-line marker overhead in line truncation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b46742b commit d014ece

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

codex-rs/core/src/context_manager/history_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ fn format_exec_output_reports_omitted_lines_and_keeps_head_and_tail() {
385385
// With marker overhead (3 lines), available content lines = 256 - 3 = 253
386386
// Head: 126, Tail: 127, Omitted: 356 - 253 = 103
387387
const OMISSION_MARKER_LINES: usize = 3;
388-
let available_content_lines = truncate::MODEL_FORMAT_MAX_LINES.saturating_sub(OMISSION_MARKER_LINES);
388+
let available_content_lines =
389+
truncate::MODEL_FORMAT_MAX_LINES.saturating_sub(OMISSION_MARKER_LINES);
389390
let omitted = total_lines - available_content_lines;
390391
let expected_marker = format!("[... omitted {omitted} of {total_lines} lines ...]");
391392

@@ -418,7 +419,8 @@ fn format_exec_output_prefers_line_marker_when_both_limits_exceeded() {
418419
// With marker overhead (3 lines), available content lines = 256 - 3 = 253
419420
// Omitted: 298 - 253 = 45
420421
const OMISSION_MARKER_LINES: usize = 3;
421-
let available_content_lines = truncate::MODEL_FORMAT_MAX_LINES.saturating_sub(OMISSION_MARKER_LINES);
422+
let available_content_lines =
423+
truncate::MODEL_FORMAT_MAX_LINES.saturating_sub(OMISSION_MARKER_LINES);
422424
let omitted = total_lines - available_content_lines;
423425
let expected_marker = format!("[... omitted {omitted} of {total_lines} lines ...]");
424426

codex-rs/core/tests/suite/user_shell_cmd.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,12 @@ async fn user_shell_command_output_is_truncated_in_history() -> anyhow::Result<(
236236
.expect("command message recorded in request");
237237
let command_message = command_message.replace("\r\n", "\n");
238238

239-
let head = (1..=128).map(|i| format!("{i}\n")).collect::<String>();
240-
let tail = (273..=400).map(|i| format!("{i}\n")).collect::<String>();
239+
// With marker overhead (3 lines), available content lines = 256 - 3 = 253
240+
// Head: 126, Tail: 127, Omitted: 400 - 253 = 147
241+
let head = (1..=126).map(|i| format!("{i}\n")).collect::<String>();
242+
let tail = (274..=400).map(|i| format!("{i}\n")).collect::<String>();
241243
let truncated_body =
242-
format!("Total output lines: 400\n\n{head}\n[... omitted 144 of 400 lines ...]\n\n{tail}");
244+
format!("Total output lines: 400\n\n{head}\n[... omitted 147 of 400 lines ...]\n\n{tail}");
243245
let escaped_command = escape(&command);
244246
let escaped_truncated_body = escape(&truncated_body);
245247
let expected_pattern = format!(

0 commit comments

Comments
 (0)