MultiAgentV2 spawn_agent defaults to full-history fork, rejecting agent_type/model overrides
What variant of Codex are you using?
Codex Desktop with MultiAgentV2 enabled.
What happened?
With MultiAgentV2 enabled, spawn_agent defaults to a full-history fork when fork_turns is omitted. Full-history forks reject agent_type, model, and reasoning_effort overrides.
That makes the natural/default call shape for a specialized subagent fail:
{
"agent_type": "domain_expert",
"task_name": "domain_expert_default_fork_probe",
"message": "Probe task: reply with exactly one sentence saying whether you started successfully."
}
Observed error:
Full-history forked agents inherit the parent agent type, model, and reasoning effort; omit agent_type, model, and reasoning_effort, or spawn without a full-history fork.
The same failure occurs for built-in roles such as explorer and worker when fork_turns is omitted. This is not specific to domain_expert; it is the MultiAgentV2 default fork behavior interacting with role/model/reasoning overrides.
Expected behavior
One of these should be true:
spawn_agent(agent_type=...)should default to a fork mode compatible with role/model/reasoning overrides.- The tool schema/docs should explicitly state that
agent_type,model, orreasoning_effortrequirefork_turns: "none"or another non-full-history mode. - MultiAgentV2 should support full-history context plus a different child role/model/reasoning configuration, since "same context, specialized child" is a common multi-agent workflow.
Actual behavior
fork_turns is optional, but omission means "all", which maps to SpawnAgentForkMode::FullHistory. In that mode, MultiAgentV2 rejects overrides.
Current implementation appears to do this in codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs:
fork_turns.unwrap_or("all")"all"maps toSpawnAgentForkMode::FullHistory- full-history mode calls
reject_full_fork_spawn_overrides(role_name, model, reasoning_effort)
So a model following the visible spawn_agent schema can easily produce a rejected tool call by combining the default fork mode with an explicit agent_type.
Reproduction steps
- Start a Codex Desktop/CLI session with MultiAgentV2 enabled.
- Ask Codex to spawn a specialized subagent, or directly call:
{
"agent_type": "explorer",
"task_name": "explorer_default_fork_probe",
"message": "Reply with exactly: STARTED"
}
- Observe the full-history fork rejection.
- Retry with:
{
"agent_type": "explorer",
"task_name": "explorer_no_fork_probe",
"message": "Reply with exactly: STARTED",
"fork_turns": "none"
}
- Observe that the specialized role can spawn.
Why this seems like a bug / DX issue
The official subagents docs describe specialized/custom agents with different model configurations and instructions. The tool schema also exposes agent_type, model, and reasoning_effort as ordinary spawn_agent arguments.
But with MultiAgentV2 enabled, the default fork_turns value makes those ordinary-looking arguments fail unless the caller knows to add fork_turns: "none".
This creates a sharp edge for users and orchestrating agents:
- specialized subagent requests fail by default
- the workaround is not discoverable until after a rejected tool call
- users expecting "spawn a domain expert / explorer / worker" get a spawn failure instead of a specialized child
Suggested fix
Best option:
- If
agent_type,model, orreasoning_effortis present andfork_turnsis omitted, default to a compatible fork mode instead of full-history.
Alternative:
- Keep the current behavior, but update the tool schema/docs to explicitly state that role/model/reasoning overrides require
fork_turns: "none"or another non-full-history mode.
Longer-term option:
- Support full-history context with a different child role/model/reasoning configuration, since "same context, specialized child" is a common MultiAgentV2 workflow.
Related issue
Possibly related, but broader and Windows/named-agent focused:
9 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can create a fix for this if it is acceptable. I have never contributed before but I'm happy to if the team is busy elsewhere.
+1 reproducing on Codex CLI v0.125.0 (Linux) with
multi_agent_v2 = true.We have both
reviewerandexplorerroles configured in~/.codex/agents/with role-specificmodel = "gpt-5.5"/model_reasoning_effortoverrides — the exact "specialized child with same context" workflow described in this issue. Every multi-agent spawn the lead thread attempts in our coding-agent automation gets rejected with the verbatim error string at thecodex_core::tools::routerERROR level, and the lead thread then falls back to serial single-thread execution.Two examples from our logs in the past hour:
The lead thread's own narration of the failure:
So in practice, multi-agent-v2 with role overrides currently degrades to single-thread + role-discipline-via-prompt for us. Functional, but parallelism is lost.
Strong agreement with the suggested fix:
That seems like the least-surprise option — caller intent ("specialized child") wins over the silent default ("inherit everything"). The longer-term option ("same context + different role/model/reasoning") would be ideal because that's the actual workflow we want, but I assume that requires deeper API/runtime changes.
Happy to test a fix on a release candidate if useful.
I can reproduce a related failure on
codex-cli 0.128.0.A/B result:
--disable multi_agent_v2: subagent completes, writes a dynamic nonce file, andwaitreturns the child final response.--enable multi_agent_v2with default spawn behavior:waittimes out, nonce file is missing, child final response is missing.--enable multi_agent_v2with explicitfork_turns: "none": subagent completes and returns the expected dynamic nonce.This suggests the V2 default full-history fork can make a child inherit parent orchestration context strongly enough that even a simple isolated worker task may not execute. Explicit
fork_turns: "none"is a working workaround for task-worker style subagents.Observed local smoke summaries:
<img width="763" height="521" alt="Image" src="https://github.com/user-attachments/assets/0ef353c1-d7be-431b-881f-ce10c2ffbf54" />
We hit this on our side too. The combination is especially painful when an agent prompt also instructs "always pass
agent_typeto bind subagents to a role config" — every first dispatch is guaranteed to fail. Captured in a rollout: the parent burns a turn on the rejection, reasons about it, then re-dispatches withfork_turns: "none".A small fix that resolves it cleanly: when
fork_turnsis omitted and the caller supplied any ofagent_type/model/reasoning_effort, default the fork mode to"none"instead of"all". An explicitfork_turns="all"paired with overrides should still be rejected — that's a genuine contradiction, and the rejection now means what it says. The rejection error is also worth rewriting to tell the caller the actual fix (setfork_turns="none", or omit it entirely) rather than "omit your role."Diff is small — roughly:
SpawnAgentArgs::fork_mode()inmulti_agents_v2/spawn.rstakes ahas_child_overridesflag and picks the default accordingly.fork_turnsdocuments the override-aware default.fork_turns⇒ no-fork spawn with role applied), the other locks in the still-strict behavior for explicitfork_turns="all"+ overrides.Happy to send a PR if it would help — let me know if there's a preferred shape (behind a feature flag vs. unconditional, exact error wording, etc.).
I made a hook to require passing fork_turns to fix this for myself.
Additional macOS Codex Desktop reproduction (July 2026):
Before restoring our custom agent setup, we defined 11 named TOML roles with explicit
modelandmodel_reasoning_effortvalues, including lightweight scan roles and high-effort implementation/review roles.Across a fresh-parent test set (5 parent threads and 4 spawned children), every observed spawned runtime reported the same effective context:
multi_agent_version = v2multi_agent_mode = explicitRequestOnlyagent_role = nullmodel = gpt-5.6-solmodel_reasoning_effort = highThat was true even where the requested custom role had a different configured model/effort. The child often completed the task, so this can be a silent routing failure rather than an obvious spawn error.
This is consistent with the full-history inheritance/override conflict described here, and makes it impossible to trust custom model routing or cost controls without inspecting child runtime metadata. We also reproduced the behavior after restarting the Desktop app.
Reproduced on Codex Desktop / CLI 0.144.5 on macOS after explicitly registering the custom agents in
~/.codex/config.tomland restarting Codex.Parent thread:
019f6981-9265-7742-bf90-a3eef6f0ea07Child thread:
019f6982-472d-7020-84b0-3f144dab1736The parent called
spawn_agentwith:task_name: levelup_builderfork_turns: allThe exposed MultiAgentV2 tool surface did not provide an
agent_typefield for selecting the registered custom agent. The child metadata recorded:agent_path: /root/levelup_builderagent_role: nullmodel: gpt-5.6-soleffort: lowThe registered
levelup_builderTOML specifies:model: gpt-5.3-codex-sparkmodel_reasoning_effort: xhighThe role-specific
developer_instructionswere also absent from the child. Explicit[agents.levelup_builder]registration and a full Codex restart did not change the result.This suggests MultiAgentV2 treats
task_nameas a thread label and creates a full-history child without resolving the registered custom-agent configuration. This overlaps the named custom-agent/tool-surface gap reported in #15250. A durable fix appears to require exposing/resolvingagent_typefor registered agents, or automatically selecting a non-full-history spawn mode when a custom role is requested.