Skip to content

Add MultiAgentV2 root and subagent context hints#19805

Merged
jif-oai merged 2 commits intomainfrom
jif/hint-ma-v2
Apr 28, 2026
Merged

Add MultiAgentV2 root and subagent context hints#19805
jif-oai merged 2 commits intomainfrom
jif/hint-ma-v2

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented Apr 27, 2026

Why

MultiAgentV2 sessions need startup guidance that matches the role of the thread that is actually being created. Root agents and subagents have different responsibilities, and forked subagents can inherit parent rollout history. If the parent hint is carried into the child context, the child can see stale or conflicting developer guidance before its own session-specific context is added.

What changed

  • Added features.multi_agent_v2.root_agent_usage_hint_text and features.multi_agent_v2.subagent_usage_hint_text config fields, including schema/config parsing support.
  • Injected the matching root or subagent hint into the initial context as its own developer message when multi_agent_v2 is enabled.
  • Filtered configured MultiAgentV2 usage-hint developer messages out of forked parent history so a child thread receives fresh guidance for its own session source/config.
  • Added targeted coverage for config parsing, initial-context rendering, feature-config deserialization, and forked-history filtering.

Context examples

With this config:

[features.multi_agent_v2]
enabled = true
root_agent_usage_hint_text = "Root guidance."
subagent_usage_hint_text = "Subagent guidance."

A root thread initial context renders the root hint as a standalone developer message:

[developer]
<existing developer context, when present>

[developer]
Root guidance.

A subagent thread initial context renders the subagent hint instead:

[developer]
<existing developer context, when present>

[developer]
Subagent guidance.

When a subagent forks parent history, any parent developer message whose text exactly matches the configured MultiAgentV2 root or subagent hint is omitted from the forked history before the child receives its fresh subagent hint.

@jif-oai jif-oai requested a review from a team as a code owner April 27, 2026 11:40
@jif-oai jif-oai changed the title feat: usage hint on multi-agents v2 Add MultiAgentV2 root and subagent context hints Apr 27, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented Apr 28, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 187f8a1bd2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/agent/control.rs
Comment thread codex-rs/core/src/session/mod.rs
Comment thread codex-rs/core/src/session/multi_agents.rs
@jif-oai jif-oai merged commit fd36838 into main Apr 28, 2026
25 checks passed
@jif-oai jif-oai deleted the jif/hint-ma-v2 branch April 28, 2026 10:31
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
jif-oai added a commit that referenced this pull request Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants