diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rs index f8cb0bfaee..13a0cfd703 100644 --- a/codex-rs/tui/src/chatwidget/tests.rs +++ b/codex-rs/tui/src/chatwidget/tests.rs @@ -1125,11 +1125,11 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await; // Use a long absolute path so we can verify display vs model text differ. - let image_path = PathBuf::from("/var/tmp/some/dir/image.png"); + let image_path = "/var/tmp/some/dir/image.png"; chat.bottom_pane.insert_str("see "); chat.bottom_pane - .attach_image(image_path.clone(), 24, 42, "png"); + .attach_image(PathBuf::from(image_path), 24, 42, "png"); let display_text = chat.bottom_pane.composer_text(); assert!( @@ -1151,14 +1151,14 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { "expected transcript to contain basename placeholder, got {rendered:?}" ); assert!( - !rendered.contains("/var/tmp/some/dir/image.png"), + !rendered.contains(image_path), "expected transcript not to contain full path, got {rendered:?}" ); // The model-facing text should expand the placeholder to the full path. let mut model_text: Option = None; while let Ok(op) = op_rx.try_recv() { - if let Op::UserInput { items } = op { + if let Op::UserInput { items, .. } = op { for item in items { if let codex_protocol::user_input::UserInput::Text { text } = item { model_text = Some(text); @@ -1172,7 +1172,7 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { } let model_text = model_text.expect("expected Op::UserInput with a Text item"); assert!( - model_text.contains("/var/tmp/some/dir/image.png"), + model_text.contains(image_path), "expected model text to contain full path, got {model_text:?}" ); assert!( diff --git a/codex-rs/tui2/src/chatwidget.rs b/codex-rs/tui2/src/chatwidget.rs index 1cab44db54..5178ec1650 100644 --- a/codex-rs/tui2/src/chatwidget.rs +++ b/codex-rs/tui2/src/chatwidget.rs @@ -1759,9 +1759,7 @@ impl ChatWidget { } if !model_text.is_empty() { - items.push(UserInput::Text { - text: model_text.clone(), - }); + items.push(UserInput::Text { text: model_text }); } for path in image_paths { diff --git a/codex-rs/tui2/src/chatwidget/tests.rs b/codex-rs/tui2/src/chatwidget/tests.rs index e34d8533c1..da4c1a0d89 100644 --- a/codex-rs/tui2/src/chatwidget/tests.rs +++ b/codex-rs/tui2/src/chatwidget/tests.rs @@ -1085,11 +1085,11 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await; // Use a long absolute path so we can verify display vs model text differ. - let image_path = PathBuf::from("/var/tmp/some/dir/image.png"); + let image_path = "/var/tmp/some/dir/image.png"; chat.bottom_pane.insert_str("see "); chat.bottom_pane - .attach_image(image_path.clone(), 24, 42, "png"); + .attach_image(PathBuf::from(image_path), 24, 42, "png"); let display_text = chat.bottom_pane.composer_text(); assert!( @@ -1111,14 +1111,14 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { "expected transcript to contain basename placeholder, got {rendered:?}" ); assert!( - !rendered.contains("/var/tmp/some/dir/image.png"), + !rendered.contains(image_path), "expected transcript not to contain full path, got {rendered:?}" ); // The model-facing text should expand the placeholder to the full path. let mut model_text: Option = None; while let Ok(op) = op_rx.try_recv() { - if let Op::UserInput { items } = op { + if let Op::UserInput { items, .. } = op { for item in items { if let codex_protocol::user_input::UserInput::Text { text } = item { model_text = Some(text); @@ -1132,7 +1132,7 @@ async fn submitting_image_shows_short_path_but_sends_full_path_to_model() { } let model_text = model_text.expect("expected Op::UserInput with a Text item"); assert!( - model_text.contains("/var/tmp/some/dir/image.png"), + model_text.contains(image_path), "expected model text to contain full path, got {model_text:?}" ); assert!(