codex - 💡(How to fix) Fix Make MultiAgentV2 spawned-agent context prompt configurable [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17323Fetched 2026-04-11 06:17:45
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3unlabeled ×1

Root Cause

This matters for users building custom multi-agent workflows because the injected prompt becomes part of the child agent's behavior contract even when it is semantically wrong for the spawn mode.

Code Example

<spawned_agent_context>
... Treat the next user message as your assigned task, and use the forked history only as background context.
</spawned_agent_context>
RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI

What feature would you like to see?

Make the MultiAgentV2 spawned-agent context prompt configurable, or at least only inject it when history/context is actually forked.

Today codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs unconditionally appends SPAWN_AGENT_DEVELOPER_INSTRUCTIONS to every spawned child agent:

<spawned_agent_context>
... Treat the next user message as your assigned task, and use the forked history only as background context.
</spawned_agent_context>

The problem is that this prompt is added even when the child is spawned with no forked history (for example fork_turns = none, or when no forked context is otherwise provided).

That creates two issues:

  • the prompt describes forked history even when there is none
  • there is currently no config knob to disable or override this block for custom multi-agent workflows

It looks like later work improved surrounding spawn behavior (parent model/config inheritance, role-level fork defaults, prompt cache keys, etc.), but I could not find a way to:

  • disable SPAWN_AGENT_DEVELOPER_INSTRUCTIONS
  • replace it with a custom block
  • gate it on whether forked context is actually present

A few reasonable options:

  • only inject this prompt when fork_turns actually results in forked history/context
  • add a config option to disable it
  • add a config option to override the text
  • split it into two variants: one for forked children, one for no-history children

Additional information

Current code path:

  • codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs

Specifically, the block is appended unconditionally after spawn config is built, independent of fork_turns / fork mode.

This matters for users building custom multi-agent workflows because the injected prompt becomes part of the child agent's behavior contract even when it is semantically wrong for the spawn mode.

extent analysis

TL;DR

Modify the spawn.rs file to conditionally append the SPAWN_AGENT_DEVELOPER_INSTRUCTIONS based on the presence of forked history or add a config option to disable or override it.

Guidance

  • Review the spawn.rs file and identify the code block that unconditionally appends the SPAWN_AGENT_DEVELOPER_INSTRUCTIONS to determine the best approach for modification.
  • Consider adding a conditional statement to check if fork_turns results in forked history before appending the prompt.
  • Evaluate the feasibility of introducing a config option to disable or override the SPAWN_AGENT_DEVELOPER_INSTRUCTIONS for custom multi-agent workflows.
  • Investigate the surrounding code for parent model/config inheritance, role-level fork defaults, and prompt cache keys to ensure any modifications align with existing functionality.

Example

// Pseudocode example, actual implementation may vary
if fork_turns_results_in_forked_history() {
    append_spawn_agent_developer_instructions();
}

Notes

The solution may require careful consideration of the implications of modifying the SPAWN_AGENT_DEVELOPER_INSTRUCTIONS behavior, particularly for existing workflows that rely on the current implementation.

Recommendation

Apply a workaround by modifying the spawn.rs file to conditionally append the SPAWN_AGENT_DEVELOPER_INSTRUCTIONS based on the presence of forked history, as this approach allows for a targeted fix without introducing new config options.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING