Persist additional tool definitions in rollout history (#50435)

## Why

`additional_tools` response items were excluded from rollout persistence, dropping their tool definitions from saved history.

## What changed

- Persist `additional_tools` items in both legacy and paginated history modes.
- Expose the variant in generated JSON schemas, TypeScript types, and Python models, with an optional `id`, a `role`, and arbitrary JSON tool definitions.

## Testing

Add a recorder round-trip test that verifies tool definitions survive recording and loading in both history modes without parse errors.

GitOrigin-RevId: 0e7c7b1c10401ec6513fb744de642a1cf9e461d7
This commit is contained in:
pakrym-oai
2026-10-02 21:42:45 +00:00
committed by copyberry
parent c536ffcb18
commit 602d2add6e
12 changed files with 227 additions and 9 deletions
+2 -2
View File
@@ -1010,12 +1010,12 @@ impl InternalChatMessageMetadataPassthrough {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema, TS)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ResponseItem {
#[schemars(skip)]
#[ts(skip)]
AdditionalTools {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
id: Option<ResponseItemId>,
role: String,
#[ts(type = "unknown[]")]
tools: Vec<serde_json::Value>,
},
Message {