mirror of
https://github.com/openai/codex.git
synced 2026-11-05 08:28:29 +00:00
Preserve content kinds during image preparation (#40281)
## Why Image preparation can rewrite message content, including replacing images that cannot be processed with model-visible error text. The positional content-kind metadata must stay aligned with those rewrites. ## What changed - Process message images together with their content-kind annotations. - Preserve existing kinds for unchanged and resized content. - Classify failed-image placeholders as `images.preparation_error`. ## Testing - Cover metadata preservation across successful, resized, and failed images. - Verify Responses Lite sends `user.image` and `images.preparation_error` kinds. GitOrigin-RevId: 1be7bcbe47014251019bfff0d826c9dfe3239dec
This commit is contained in:
1 parent
6677fd827d
commit
479c8c8924
6 files changed
+122
-73
No files matched your search
@@ -1511,9 +1511,23 @@ async fn spawn_agent_can_fork_parent_thread_history_with_sanitized_items() {
|
||||
);
|
||||
let history = child_thread.session.clone_history().await;
|
||||
let history_items = history.raw_items().cloned().collect::<Vec<_>>();
|
||||
let mut expected_final_answer =
|
||||
assistant_message("parent final answer", Some(MessagePhase::FinalAnswer));
|
||||
expected_final_answer.set_turn_id_if_missing(&turn_context.sub_id);
|
||||
let expected_final_answer = parent_thread
|
||||
.session
|
||||
.clone_history()
|
||||
.await
|
||||
.raw_items()
|
||||
.find(|item| {
|
||||
matches!(
|
||||
item,
|
||||
ResponseItem::Message {
|
||||
role,
|
||||
phase: Some(MessagePhase::FinalAnswer),
|
||||
..
|
||||
} if role == "assistant"
|
||||
)
|
||||
})
|
||||
.cloned()
|
||||
.expect("parent final answer should be recorded");
|
||||
let mut expected_developer_message = ResponseItem::Message {
|
||||
id: None,
|
||||
role: "developer".to_string(),
|
||||
|
||||
Reference in new issue
Block a user