diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 539e16ac5b..d98e839f8d 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -3937,10 +3937,7 @@ pub(crate) async fn run_turn( error_or_panic( "Invalid image detected; sanitizing tool output to prevent poisoning", ); - if state - .history - .replace_last_turn_images(NON_MULTIMODAL_IMAGE_PLACEHOLDER) - { + if state.history.replace_last_turn_images("Invalid image") { continue; } let event = EventMsg::Error(ErrorEvent { diff --git a/codex-rs/core/tests/suite/view_image.rs b/codex-rs/core/tests/suite/view_image.rs index 0c3121c1cc..b72f66fce8 100644 --- a/codex-rs/core/tests/suite/view_image.rs +++ b/codex-rs/core/tests/suite/view_image.rs @@ -597,9 +597,7 @@ async fn replaces_invalid_local_image_after_bad_request() -> anyhow::Result<()> "second request should replace the invalid image" ); let user_texts = second_request.message_input_texts("user"); - assert!(user_texts.iter().any(|text| { - text == "[there was an image here but it was removed for non-multimodal models]" - })); + assert!(user_texts.iter().any(|text| text == "Invalid image")); Ok(()) }