From 4ebc61c0f8df9852e709ff4b477b750fc816a69b Mon Sep 17 00:00:00 2001 From: jif Date: Mon, 13 Jul 2026 15:34:09 +0000 Subject: [PATCH] Make explicit multi-agent mode override proactive delegation (#32822) ## Why After switching from proactive delegation to explicit-request-only mode, an earlier proactive instruction can remain in the conversation context. The new mode must clearly supersede that instruction. ## What changed Update the explicit-request-only developer message to cancel earlier proactive delegation instructions before requiring delegation to be explicitly requested by the user, `AGENTS.md`, or a skill. ## Testing Update the multi-agent mode integration test expectation for the explicit-mode instruction emitted after a cold resume. GitOrigin-RevId: 0a6d18f38ef82d29cf4f3bfcfd4ac84738a39598 --- codex-rs/core/src/context/multi_agent_mode_instructions.rs | 2 +- codex-rs/core/tests/suite/multi_agent_mode.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codex-rs/core/src/context/multi_agent_mode_instructions.rs b/codex-rs/core/src/context/multi_agent_mode_instructions.rs index 9c8f5ad5ed..9773875d89 100644 --- a/codex-rs/core/src/context/multi_agent_mode_instructions.rs +++ b/codex-rs/core/src/context/multi_agent_mode_instructions.rs @@ -3,7 +3,7 @@ use codex_protocol::config_types::MultiAgentMode; use codex_protocol::protocol::MULTI_AGENT_MODE_CLOSE_TAG; use codex_protocol::protocol::MULTI_AGENT_MODE_OPEN_TAG; -const EXPLICIT_REQUEST_ONLY_MULTI_AGENT_MODE_TEXT: &str = "Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."; +const EXPLICIT_REQUEST_ONLY_MULTI_AGENT_MODE_TEXT: &str = "Any earlier instruction enabling proactive multi-agent delegation no longer applies. Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."; const PROACTIVE_MULTI_AGENT_MODE_TEXT: &str = "Proactive multi-agent delegation is active. Any earlier instruction requiring an explicit user request before spawning sub-agents no longer applies. Use sub-agents when parallel work would materially improve speed or quality. This mode remains active until a later multi-agent mode developer message changes it."; #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/codex-rs/core/tests/suite/multi_agent_mode.rs b/codex-rs/core/tests/suite/multi_agent_mode.rs index fd6cdb9ddd..85ce409144 100644 --- a/codex-rs/core/tests/suite/multi_agent_mode.rs +++ b/codex-rs/core/tests/suite/multi_agent_mode.rs @@ -22,7 +22,7 @@ use pretty_assertions::assert_eq; use serde_json::Value; use serde_json::json; -const NO_SPAWN_TEXT: &str = "Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."; +const NO_SPAWN_TEXT: &str = "Any earlier instruction enabling proactive multi-agent delegation no longer applies. Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."; const PROACTIVE_TEXT: &str = "Proactive multi-agent delegation is active."; const CUSTOM_MODE_HINT_TEXT: &str = "Use the configured delegation policy.";