Expose spawn agent types only when roles are configured (#33572)

## Why

The `agent_type` argument is only useful when agent roles are configured. Avoid
advertising an inapplicable override in the model-visible `spawn_agent` schema.

## What changed

- Include `agent_type` in the V1 and V2 spawn tools only when configured roles
  are available.
- Clarify that `agent_type` is an explicit override and document its interaction
  with context forking.
- Remove the unused `agents.support_agent_type` configuration field.

## Testing

- Add coverage for hiding `agent_type` without roles and exposing it when a role
  is configured.

GitOrigin-RevId: 32e0f123b15f317e9cdb71774029375bc073d9ad
This commit is contained in:
jif authored and copyberry committed 2026-07-16 10:28:36 +00:00
1 parent 03bb3b1236
commit 9ff47868eb
14 files changed
+96 -49

No files matched your search

-8
View File
@@ -863,9 +863,6 @@ pub struct Config {
/// User-configured maximum number of spawned agent threads per session.
pub agent_max_threads: Option<usize>,
/// Reserved setting for whether the spawn tool supports agent types.
pub agent_support_agent_type: Option<bool>,
/// Reserved default model for spawned subagents.
pub agent_default_subagent_model: Option<String>,
@@ -3606,10 +3603,6 @@ impl Config {
.as_ref()
.and_then(|agents| agents.max_depth)
.unwrap_or(DEFAULT_AGENT_MAX_DEPTH);
let agent_support_agent_type = cfg
.agents
.as_ref()
.and_then(|agents| agents.support_agent_type);
let agent_default_subagent_model = cfg
.agents
.as_ref()
@@ -3970,7 +3963,6 @@ impl Config {
tool_output_token_limit: cfg.tool_output_token_limit,
agents_enabled,
agent_max_threads,
agent_support_agent_type,
agent_default_subagent_model,
agent_default_subagent_reasoning_effort,
agent_max_depth,