Support leaf models in multi-agent v2 (#36892)

## What changed

- Allow multi-agent v2 parents to spawn any visible model that has not explicitly disabled multi-agent support.
- Expose collaboration tools to child agents only when their selected model supports multi-agent v2, keeping legacy models as leaf workers.
- Preserve a worker's selected model when reloading it into residency.
- Propagate multi-agent capability metadata to Amazon Bedrock model entries so delegation is gated consistently.

## Testing

- Cover model selection, leaf-worker tool visibility, Bedrock capability handling, and model preservation after reload.

GitOrigin-RevId: 1457adb1a09806d1f0621311d5a42a6815b9dd4e
This commit is contained in:
jif authored and copyberry committed 2026-08-04 12:36:14 +00:00
1 parent 1669c2403f
commit 6d4d9442c7
11 files changed
+131 -61

No files matched your search

+10 -2
View File
@@ -649,13 +649,16 @@ async fn ensure_v2_agent_loaded_reloads_registered_unloaded_agent() {
let (home, mut config) = test_config().await;
let _ = config.features.enable(Feature::MultiAgentV2);
let _ = config.features.enable(Feature::Sqlite);
config.model = Some("gpt-5.6-sol".to_string());
let harness = AgentControlHarness::new_with_config(home, config).await;
let (parent_thread_id, _parent_thread) = harness.start_paginated_thread().await;
let agent_path = AgentPath::try_from("/root/worker").expect("agent path");
let mut child_config = harness.config.clone();
child_config.model = Some("gpt-5.6-luna".to_string());
let spawned_agent = harness
.control
.spawn_agent_with_metadata(
harness.config.clone(),
child_config,
text_input("hello child"),
Some(SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id,
@@ -715,11 +718,16 @@ async fn ensure_v2_agent_loaded_reloads_registered_unloaded_agent() {
.ensure_v2_agent_loaded(harness.config.clone(), spawned_agent.thread_id)
.await
.expect("known v2 agent should reload");
let _ = harness
let reloaded_child = harness
.manager
.get_thread(spawned_agent.thread_id)
.await
.expect("reloaded child thread should exist");
assert_eq!(
reloaded_child.config_snapshot().await.model,
"gpt-5.6-luna",
"residency reload must preserve the worker model instead of inheriting its parent model",
);
let communication = InterAgentCommunication::new(
AgentPath::root(),