Keep proactive MCP image sanitization and restore InvalidImageRequest fallback

This commit is contained in:
Tom Wiltzius
2026-02-08 12:07:45 -08:00
parent 69944518ed
commit 0d1d449d96
2 changed files with 2 additions and 7 deletions

View File

@@ -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 {

View File

@@ -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(())
}