From bddaabf8854eb9c01f4eaf80ea74a2d6061651bb Mon Sep 17 00:00:00 2001 From: starr-openai Date: Tue, 12 May 2026 17:48:10 -0700 Subject: [PATCH] codex: fix CI failure on PR #22199 Co-authored-by: Codex --- codex-rs/tui/src/chatwidget/tests/helpers.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/codex-rs/tui/src/chatwidget/tests/helpers.rs b/codex-rs/tui/src/chatwidget/tests/helpers.rs index a1c41a8ebf..bd8dbc8cac 100644 --- a/codex-rs/tui/src/chatwidget/tests/helpers.rs +++ b/codex-rs/tui/src/chatwidget/tests/helpers.rs @@ -66,11 +66,16 @@ pub(super) fn normalize_snapshot_paths(text: impl Into) -> String { .into_iter() .rev() { - let unix_prefix: String = "/tmp/project" - .chars() - .take(isolated_prefix.chars().count()) - .collect(); - text = text.replace(&format!("{isolated_prefix}…"), &format!("{unix_prefix}…")); + let normalized = if isolated_prefix.chars().count() >= "/tmp/project".chars().count() { + "/tmp/project".to_string() + } else { + let unix_prefix: String = "/tmp/project" + .chars() + .take(isolated_prefix.chars().count()) + .collect(); + format!("{unix_prefix}…") + }; + text = text.replace(&format!("{isolated_prefix}…"), &normalized); } }