From 5f49aba876922d6f2f55caa153bbb0ed1b46feba Mon Sep 17 00:00:00 2001 From: jif Date: Thu, 27 Aug 2026 15:12:58 +0000 Subject: [PATCH] Require explicit requests for spawn model overrides (#41165) ## What changed - Tell the `spawn_agent` tool to set `model` only when the user explicitly requests a different model. - Update the tool-description test to enforce the stricter guidance. GitOrigin-RevId: ed46bcb544876e408896e0d8c54292192369951c --- codex-rs/core/src/tools/handlers/multi_agents_spec.rs | 2 +- codex-rs/core/tests/suite/spawn_agent_description.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs index ac1b79e501..eea209eb02 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs @@ -709,7 +709,7 @@ fn spawn_agent_tool_description( format!( r#" {tool_description} -This spawn_agent tool provides you access to sub-agents that inherit your current model by default. Do not set the `model` field unless the user explicitly asks for a different model or there is a clear task-specific reason. You should follow the rules and guidelines below to use this tool. +This spawn_agent tool provides you access to sub-agents that inherit your current model by default. Do not set the `model` field unless the user explicitly asks for a different model. You should follow the rules and guidelines below to use this tool. Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work. Requests for depth, thoroughness, research, investigation, or detailed codebase analysis do not count as permission to spawn. diff --git a/codex-rs/core/tests/suite/spawn_agent_description.rs b/codex-rs/core/tests/suite/spawn_agent_description.rs index 509880616b..208ef577c3 100644 --- a/codex-rs/core/tests/suite/spawn_agent_description.rs +++ b/codex-rs/core/tests/suite/spawn_agent_description.rs @@ -235,7 +235,7 @@ async fn spawn_agent_description_lists_visible_models_and_reasoning_efforts() -> ); assert!( description.contains( - "Do not set the `model` field unless the user explicitly asks for a different model or there is a clear task-specific reason." + "Do not set the `model` field unless the user explicitly asks for a different model." ), "expected model override usage guidance in spawn_agent description: {description:?}" );