Skip to content

Commit 79a8ffd

Browse files
[codex] allow AGENTS.md and skills to authorize delegation (#30274)
Prompt update of MAv2 to include agents.md and skills more explicitly should mimic: #27919
1 parent a938d5f commit 79a8ffd

6 files changed

Lines changed: 11 additions & 8 deletions

File tree

codex-rs/app-server/tests/suite/v2/turn_start.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,9 @@ async fn turn_start_ignores_deprecated_multi_agent_mode() -> Result<()> {
18171817
.single_request()
18181818
.message_input_texts("developer");
18191819
assert!(developer_texts.iter().any(|text| {
1820-
text.contains("Do not spawn sub-agents unless the user explicitly asks for sub-agents")
1820+
text.contains(
1821+
"Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents",
1822+
)
18211823
}));
18221824
assert!(
18231825
!developer_texts
@@ -1898,8 +1900,9 @@ async fn thread_start_ignores_deprecated_multi_agent_mode() -> Result<()> {
18981900
.message_input_texts("developer");
18991901
assert!(developer_texts.iter().any(|text| {
19001902
text.contains(MULTI_AGENT_MODE_OPEN_TAG)
1901-
&& text
1902-
.contains("Do not spawn sub-agents unless the user explicitly asks for sub-agents")
1903+
&& text.contains(
1904+
"Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents",
1905+
)
19031906
}));
19041907
assert!(
19051908
!developer_texts

codex-rs/core/src/context/multi_agent_mode_instructions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use codex_protocol::config_types::MultiAgentMode;
33
use codex_protocol::protocol::MULTI_AGENT_MODE_CLOSE_TAG;
44
use codex_protocol::protocol::MULTI_AGENT_MODE_OPEN_TAG;
55

6-
const EXPLICIT_REQUEST_ONLY_MULTI_AGENT_MODE_TEXT: &str = "Do not spawn sub-agents unless the user explicitly asks for sub-agents, delegation, or parallel agent work.";
6+
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.";
77
const NO_MULTI_AGENT_MODE_TEXT: &str = "Multi-agent delegation mode instructions are inactive. Any earlier multi-agent mode developer message no longer applies.";
88
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.";
99

codex-rs/core/src/tools/handlers/multi_agents_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ fn spawn_agent_tool_description(
673673
{tool_description}
674674
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.
675675
676-
Do not spawn sub-agents unless the user explicitly asks for sub-agents, delegation, or parallel agent work.
676+
Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work.
677677
{agent_role_usage_hint}
678678
679679
### Designing delegated subtasks

codex-rs/core/tests/suite/multi_agent_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core_test_support::wait_for_event;
2121
use pretty_assertions::assert_eq;
2222
use serde_json::Value;
2323

24-
const NO_SPAWN_TEXT: &str = "Do not spawn sub-agents unless the user explicitly asks for sub-agents, delegation, or parallel agent work.";
24+
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.";
2525
const PROACTIVE_TEXT: &str = "Proactive multi-agent delegation is active.";
2626

2727
fn add_ultra_reasoning(model_info: &mut ModelInfo) {

codex-rs/core/tests/suite/search_tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ async fn tool_search_returns_deferred_v1_multi_agent_tools() -> Result<()> {
858858
.and_then(Value::as_str)
859859
.expect("spawn_agent description should be present");
860860
assert!(description.contains(
861-
"Do not spawn sub-agents unless the user explicitly asks for sub-agents, delegation, or parallel agent work."
861+
"Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."
862862
));
863863
assert!(description.contains("### Designing delegated subtasks"));
864864
assert!(!description.contains("### When to delegate vs. do the subtask yourself"));

codex-rs/core/tests/suite/spawn_agent_description.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async fn spawn_agent_description_lists_visible_models_and_reasoning_efforts() ->
213213
);
214214
assert!(
215215
description.contains(
216-
"Do not spawn sub-agents unless the user explicitly asks for sub-agents, delegation, or parallel agent work."
216+
"Do not spawn sub-agents unless the user or applicable AGENTS.md/skill instructions explicitly ask for sub-agents, delegation, or parallel agent work."
217217
),
218218
"expected explicit authorization rule in spawn_agent description: {description:?}"
219219
);

0 commit comments

Comments
 (0)