mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Support catalog parameter schemas for Multi-Agent V2 tools (#46505)
## What changed Add optional JSON-encoded `parameters` to catalog tool messages and apply them to all six Multi-Agent V2 tools, including plain, namespaced, and code-mode exposure. Schema selection follows the active model, including mid-turn model changes. Require an object schema supported by the existing `JsonSchema` subset and preserve bundled encryption annotations. Fall back to bundled parameters when overrides are missing, invalid, unsupported, or omit encrypted properties. Tool execution and argument handling remain unchanged. ## Testing Extend integration coverage for schema overrides, fallback behavior, encryption annotations, exposure modes, and mid-turn model changes. Add a snapshot scenario exercising `list_agents` with a catalog parameter schema. GitOrigin-RevId: 978be6d5f7e6a6865969922be5483bc697b20aca
This commit is contained in:
@@ -587,9 +587,17 @@ pub struct ToolMessage {
|
||||
/// text without disabling the tool. Tool-owned runtime guidance is retained.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
/// Complete JSON Schema encoded as a string. Consumed by Multi-Agent V2 tools only.
|
||||
/// Uses the harness's supported schema subset; unrecognized keywords are ignored.
|
||||
/// Missing, null, invalid or unsupported structures, or a root without `type: "object"`
|
||||
/// retains the harness parameters. Schema semantics must remain API-compatible.
|
||||
/// Overrides must declare harness-encrypted properties so their annotations can be retained.
|
||||
/// Argument handling is unchanged.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub parameters: Option<String>,
|
||||
}
|
||||
|
||||
/// Model-owned descriptions for Multi-Agent V2 tools, independent of their runtime namespace.
|
||||
/// Model-owned descriptions and parameters for Multi-Agent V2 tools, independent of their namespace.
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
|
||||
pub struct MultiAgentToolMessages {
|
||||
/// Replaces the static description. Missing or null uses the bundled text; an empty string
|
||||
@@ -1023,12 +1031,14 @@ mod tests {
|
||||
serde_json::json!({"tools": {"send_user_message_async": {"description": ""}}}),
|
||||
Some(Some(ToolMessage {
|
||||
description: Some(String::new()),
|
||||
..Default::default()
|
||||
})),
|
||||
),
|
||||
(
|
||||
serde_json::json!({"tools": {"send_user_message_async": {"description": "Catalog description"}}}),
|
||||
Some(Some(ToolMessage {
|
||||
description: Some("Catalog description".to_string()),
|
||||
..Default::default()
|
||||
})),
|
||||
),
|
||||
] {
|
||||
@@ -1392,10 +1402,12 @@ mod tests {
|
||||
tools: Some(ToolMessages {
|
||||
send_user_message_async: Some(ToolMessage {
|
||||
description: Some("Catalog description".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
multi_agent: Some(MultiAgentToolMessages {
|
||||
spawn_agent: Some(ToolMessage {
|
||||
description: Some("Catalog spawn description".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
@@ -1470,6 +1482,7 @@ mod tests {
|
||||
tools: Some(ToolMessages {
|
||||
send_user_message_async: Some(ToolMessage {
|
||||
description: Some(String::new()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user