Skip to content

[codex] Select multi-agent version from model info#25427

Open
aibrahim-oai wants to merge 15 commits into
codex/lock-multi-agent-version-per-threadfrom
codex/select-multi-agent-version-from-model-info
Open

[codex] Select multi-agent version from model info#25427
aibrahim-oai wants to merge 15 commits into
codex/lock-multi-agent-version-per-threadfrom
codex/select-multi-agent-version-from-model-info

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented May 31, 2026

Why

#25351 locks the selected multi-agent runtime per thread. Feature flags remain the fallback for fresh threads, but backend model metadata also needs to select the runtime for models that opt into a specific system.

What changed

  • Add optional multi_agent_version metadata to ModelInfo. Omitted or unrecognized metadata behaves as absent, preserving feature-flag fallback and allowing older clients to tolerate future selector values.
  • Resolve selected model metadata after persisted and inherited thread locks, but before feature flags.
  • Keep ordinary child inheritance authoritative, so a V2 parent remains V2 when spawning a child whose selected model advertises V1.
  • Keep explicit Disabled inheritance authoritative for review and guardian delegates, so a model advertising V2 cannot re-enable multi-agent tools for them.
  • Leave bundled model catalog entries unset.

Test plan

CI only, per repository workflow.

Added end-to-end remote-model integration coverage using the real /models mock and real agent flows:

  • A root model advertises V2 while only the V1 feature is enabled; its child model advertises V1, but the spawned child inherits the parent V2 lock.
  • A guardian delegate remains locked to Disabled when its selected model advertises V2.

Added deserialization coverage that treats an unknown multi_agent_version catalog value as omitted.

Stack

Depends on #25351.

@aibrahim-oai aibrahim-oai requested a review from a team as a code owner May 31, 2026 16:03
@aibrahim-oai aibrahim-oai changed the title codex: select multi-agent version from model info [codex] Select multi-agent version from model info May 31, 2026
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: b52a0177ac

ℹ️ 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/protocol/src/openai_models.rs Outdated
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from 95459e6 to c3c94a7 Compare May 31, 2026 18:37
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: c3c94a7d86

ℹ️ 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/session/mod.rs Outdated
Comment thread codex-rs/core/src/session/mod.rs Outdated
if session_source.is_non_root_agent() {
None
} else {
model_info.multi_agent_version
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Record model-selected agent version in config locks

When config-lock export/replay is enabled and the remote catalog selects V2 here without the local Feature::MultiAgentV2 flag, the selected version is kept only in the session OnceLock; checked session/config_lock.rs, and the lockfile still serializes features.multi_agent_v2.enabled from config.features only. That means a run that actually exposed V2 tools can export a lock saying V2 is disabled, so replay can still validate after the catalog selector changes and silently run with V1/no multi-agent tools instead of reproducing the original behavior.

Useful? React with 👍 / 👎.

Comment thread codex-rs/core/src/session/mod.rs Outdated
if session_source.is_non_root_agent() {
None
} else {
model_info.multi_agent_version
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid rejecting legacy agent limits on catalog V2 rollout

If /models starts returning multi_agent_version: v2 for a model while a user still has the legacy agents.max_threads setting, this line now feeds V2 into effective_agent_max_threads, which returns InvalidRequest whenever agent_max_threads is set. That makes session startup fail purely because server metadata changed, even though the same config remains valid for V1/Collab and the user did not opt into the local V2 feature; the catalog selector should either tolerate/translate the legacy limit or avoid hard-failing existing configs during rollout.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch 2 times, most recently from 3448497 to 83733e7 Compare June 1, 2026 00:33
Comment thread codex-rs/core/src/session/mod.rs
@aibrahim-oai
Copy link
Copy Markdown
Collaborator Author

aibrahim-oai commented Jun 1, 2026

This change is part of the following stack:

Change managed by git-spice.

@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from fc242f4 to c64b39a Compare June 1, 2026 17:45
@aibrahim-oai aibrahim-oai force-pushed the codex/lock-multi-agent-version-per-thread branch from 1e3ffb7 to 78392f2 Compare June 1, 2026 17:52
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from c64b39a to 55c8a1f Compare June 1, 2026 17:52
@aibrahim-oai aibrahim-oai force-pushed the codex/lock-multi-agent-version-per-thread branch from 78392f2 to 37cfac7 Compare June 1, 2026 18:16
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from 55c8a1f to 374a4cd Compare June 1, 2026 18:16
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch 3 times, most recently from 4711035 to 96b9001 Compare June 1, 2026 18:51
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: 28d732dd4d

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

conversation_history
.get_multi_agent_version()
.or(inherited_multi_agent_version)
.or(model_info.multi_agent_version)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Keep legacy rollouts on their original runtime

When resuming a thread whose rollout predates persisted SessionMeta.multi_agent_version, conversation_history.get_multi_agent_version() is None, so this newly added catalog fallback can lock the thread to whatever /models returns today. If the backend starts advertising multi_agent_version: v2 for a model, an older thread that was created with the V1 multi_agent_v1 tool surface will resume as V2 and expose the plain V2 tools, even though its existing context can contain V1 tool calls/outputs; for these legacy rollouts the safer fallback is the feature-derived runtime that was in effect before model metadata existed, or another compatibility inference from the stored history.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the codex/lock-multi-agent-version-per-thread branch from b988045 to 384d095 Compare June 1, 2026 20:15
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from 28d732d to 17286f8 Compare June 1, 2026 20:16
@aibrahim-oai aibrahim-oai force-pushed the codex/select-multi-agent-version-from-model-info branch from 17286f8 to d6b9156 Compare June 1, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants