Use the originating model when recording conversation history (#44243)

## Why

History recording used the model captured at turn start, so switching models within a turn could apply stale image preparation and tool-output truncation rules.

## What changed

Pass explicit model metadata through conversation recording. Record model responses and tool results using their originating step's settings, and capture the current model for pending input recorded during startup interruption or task completion.

## Testing

Add regression coverage for tool results across a model switch, explicit model selection for plain and annotated history, and image input retained during interruption and completion. Extend model-switching tests to verify that prepared media and item identity survive switching back to a multimodal model in live, resumed, and forked threads.

GitOrigin-RevId: 5bc750c30c334acb9b802cb80fdea01daffa84a1
This commit is contained in:
Abhinav
2026-09-09 17:46:00 +00:00
committed by copyberry
parent 205f3671e1
commit b64de2f3ad
28 changed files with 721 additions and 123 deletions
@@ -446,7 +446,11 @@ mod tests {
internal_chat_message_metadata_passthrough: None,
};
session
.record_conversation_items(&turn, std::slice::from_ref(&history_item))
.record_conversation_items(
&turn,
turn.model_info(),
std::slice::from_ref(&history_item),
)
.await;
let expected_history_item = strip_response_item_id(
session
+5 -1
View File
@@ -543,7 +543,11 @@ async fn extension_tool_executors_are_model_visible_and_dispatchable() -> anyhow
internal_chat_message_metadata_passthrough: None,
};
session
.record_conversation_items(&turn, std::slice::from_ref(&history_item))
.record_conversation_items(
&turn,
turn.model_info(),
std::slice::from_ref(&history_item),
)
.await;
let expected_history_item = session
.clone_history()