Make Ultra reasoning fallback model-aware (#41206)

## What changed

- Add an optional `multi_agent_reasoning_effort` field to model metadata.
- When `Ultra` is selected, use a supported catalog override when present. Otherwise, prefer `max`, then the highest supported non-`ultra` effort, and finally `medium` when the model has no reasoning levels.
- Preserve existing request behavior for other reasoning efforts, including mapping `persistent` to `disabled`.

## Testing

- Cover configured, missing, unsupported, and empty-catalog fallbacks for both parent and spawned-agent requests.

GitOrigin-RevId: b7ef576f32e0ea95ef38bf95c25789ed16aae94e
This commit is contained in:
Shijie Rao authored and copyberry committed 2026-08-27 21:03:09 +00:00
1 parent e931d07b88
commit 7f135e1314
16 files changed
+267 -18

No files matched your search

+26
View File
@@ -479,6 +479,9 @@ pub struct ModelInfo {
deserialize_with = "deserialize_optional_model_selector"
)]
pub multi_agent_version: Option<MultiAgentVersion>,
/// Reasoning effort used for multi-agent work when the user selects Ultra.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub multi_agent_reasoning_effort: Option<ReasoningEffort>,
}
impl ModelInfo {
@@ -973,6 +976,7 @@ mod tests {
model_specialty: None,
tool_mode: None,
multi_agent_version: None,
multi_agent_reasoning_effort: None,
}
}
@@ -1654,6 +1658,28 @@ mod tests {
assert_eq!(model.comp_hash, None);
assert_eq!(model.auto_review_model_override, None);
assert_eq!(model.tool_mode, None);
assert_eq!(model.multi_agent_reasoning_effort, None);
}
#[test]
fn model_info_deserializes_multi_agent_reasoning_effort() {
let mut value =
serde_json::to_value(test_model(/*spec*/ None)).expect("serialize test model");
value
.as_object_mut()
.expect("model info should be an object")
.insert(
"multi_agent_reasoning_effort".to_string(),
serde_json::Value::String("high".to_string()),
);
let model = serde_json::from_value::<ModelInfo>(value)
.expect("deserialize multi-agent reasoning effort");
assert_eq!(
model.multi_agent_reasoning_effort,
Some(ReasoningEffort::High)
);
}
#[test]