mirror of
https://github.com/openai/codex.git
synced 2026-09-15 12:08:01 +00:00
Keep proactive MCP image sanitization and restore InvalidImageRequest fallback
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user