You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: spawn_agent v2 exposes parameter task_name but validation error refers to nonexistent parameter agent_name #64539
In MultiAgentV2, spawn_agent exposes its required naming parameter to the model as task_name, but when a model passes an invalid value (such as a hyphenated name like "ledger-audit"), the validation error returned to the model cites agent_name ("agent_name must use only lowercase letters, digits, and underscores") — a parameter name that does not exist in the spawn_agent v2 tool schema.
Source Location (main @ 065e18b)
Tool schema names the parameter task_name — codex-rs/core/src/tools/handlers/multi_agents_spec.rs:139-144 & 163:
properties.insert("task_name".to_string(),JsonSchema::string(Some("Task name for the new agent. Use lowercase letters, digits, and underscores.".to_string(),)),);
...Some(vec!["task_name".to_string(),"message".to_string()]),
Validation error hardcodes agent_name — codex-rs/protocol/src/agent_path.rs:143 and 229:
Err("agent_name must use only lowercase letters, digits, and underscores".to_string())
Reproduction
Run a MultiAgentV2 session where the model invokes spawn_agent with {"task_name": "ledger-audit", "message": "..."}.
Observe the tool error returned to the model:
agent_name must use only lowercase letters, digits, and underscores
The model is told to fix agent_name, even though its tool call schema only has task_name.
(Reproduced during TraceTrial-Bench Core-95 evaluation on L4-pending-child-at-exit-001 with [email protected].)
Expected Behavior
Report the actual schema parameter name (task_name) in spawn_agent v2 validation errors (e.g., "task_name must use only lowercase letters, digits, and underscores").
Optionally add "pattern": "^[a-z0-9_]+$" to the task_name JSON Schema property so models see the machine-readable constraint up front.
Verified against main. Root cause: spawn_agent v2 declares its naming parameter as task_name (codex-rs/core/src/tools/handlers/multi_agents_spec.rs:140,163), but the value is validated by the shared validate_agent_name in codex-rs/protocol/src/agent_path.rs, whose errors hardcode agent_name (:143 and :229). Failing path: the model calls spawn_agent with {"task_name": "ledger-audit", ...} → validation returns "agent_name must use only lowercase letters, digits, and underscores" → that string is returned to the model as the tool error, but the schema has no agent_name parameter, so the model has nothing valid to fix. Proposed fix: report the actual schema parameter name (task_name) in spawn_agent v2 validation errors — thread the field name through the validator (it is shared with AgentPath segment validation, so a blanket rename would mislabel path errors) — and optionally add "pattern": "^[a-z0-9_]+$" to the task_name schema property so the constraint is visible up front.
Activity
akhil9tiet commentedon Nov 29, 2026
I'm interested in working on this — please assign it to me.
akhil9tiet commentedon Nov 29, 2026
Verified against main. Root cause:
spawn_agentv2 declares its naming parameter astask_name(codex-rs/core/src/tools/handlers/multi_agents_spec.rs:140,163), but the value is validated by the sharedvalidate_agent_nameincodex-rs/protocol/src/agent_path.rs, whose errors hardcodeagent_name(:143and:229). Failing path: the model callsspawn_agentwith{"task_name": "ledger-audit", ...}→ validation returns"agent_name must use only lowercase letters, digits, and underscores"→ that string is returned to the model as the tool error, but the schema has noagent_nameparameter, so the model has nothing valid to fix. Proposed fix: report the actual schema parameter name (task_name) inspawn_agentv2 validation errors — thread the field name through the validator (it is shared withAgentPathsegment validation, so a blanket rename would mislabel path errors) — and optionally add"pattern": "^[a-z0-9_]+$"to thetask_nameschema property so the constraint is visible up front.