Skip to content

Make multi-agent v2 ignore agents.max_depth#20180

Merged
jif-oai merged 1 commit intomainfrom
jif/ma-v2-depth
Apr 29, 2026
Merged

Make multi-agent v2 ignore agents.max_depth#20180
jif-oai merged 1 commit intomainfrom
jif/ma-v2-depth

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

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

Why

agents.max_depth is a legacy multi-agent v1 guard. Multi-agent v2 uses task-path routing and its own session/thread limits, so v2 should not reject nested spawn_agent calls just because the thread-spawn depth has reached the v1 maximum.

Keeping the v1 depth guard active in v2 prevents deeper task trees even though the v2 path still needs the depth value only for lineage and task-path metadata.

What Changed

  • Removed the depth-limit rejection from the multi-agent v2 spawn_agent handler while still computing child depth for lineage/path metadata.
  • Made the depth-based disabling of legacy SpawnCsv/Collab tools apply only when Feature::MultiAgentV2 is disabled.
  • Added multi_agent_v2_spawn_agent_ignores_configured_max_depth to cover a v2 child spawning another agent when agent_max_depth = 1, while the existing v1 depth-limit tests continue to enforce the legacy behavior.

Verification

  • cargo test -p codex-core multi_agent_v2_spawn_agent_ignores_configured_max_depth -- --nocapture
  • cargo test -p codex-core depth_limit -- --nocapture
  • cargo test -p codex-core tools::handlers::multi_agents::tests -- --nocapture

@jif-oai jif-oai requested a review from a team as a code owner April 29, 2026 08:58
@jif-oai jif-oai changed the title feat: multi-agents v2 ignore max depth Make multi-agent v2 ignore agents.max_depth Apr 29, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented Apr 29, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request Apr 29, 2026
- anomalyco/opencode#24923 apiKeyCommand provider option (merge-after-nits)
- anomalyco/opencode#24921 per-target dependency install loop (merge-after-nits)
- openai/codex#20180 carve agents.max_depth out of multi-agent v2 (merge-after-nits)
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented Apr 29, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ 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".

@jif-oai jif-oai merged commit 70ac0f1 into main Apr 29, 2026
25 checks passed
@jif-oai jif-oai deleted the jif/ma-v2-depth branch April 29, 2026 10:23
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 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