Skip to content

fix(core): allow trusted roles to select configured model providers - #2

Open
Bozentan wants to merge 1 commit into
upstream/latest-alpha-clifrom
codex/cross-provider-subagents
Open

Bozentan wants to merge 1 commit into
upstream/latest-alpha-clifrom
codex/cross-provider-subagents

Conversation

@Bozentan

@Bozentan Bozentan commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Note

This is a review mirror for a patch based on
openai/codex:latest-alpha-cli at 042534ec1ab2f79c2997e779347d5383832ecb2e
(0.154.0-alpha.1). The candidate commit is
af3072ebbcde8d47bb8592a6a3226ef1b83b560a.

Summary

Allow a trusted user-defined agent role to select an already configured model
provider, while keeping provider credentials, model catalogs, V2 message
transport, history, and resume state isolated at the child boundary.

The patch also makes MultiAgent V2 portable across provider boundaries:

  • native OpenAI-to-OpenAI delegation retains the encrypted agent_message
    path;
  • a non-OpenAI V2 destination receives exactly one ordinary user task
    message;
  • a non-OpenAI V2 agent can spawn a fresh child under another authorized role;
  • reverse delegation from a custom provider to OpenAI uses the native OpenAI
    V2 message path.

Motivation

Agent roles currently apply model and model_reasoning_effort, but an
explicit model_provider is lost during child creation. A custom model name is
therefore sent through the parent-owned provider and authentication path, even
when the same provider works in a direct session.

Preserving the provider alone is not sufficient for V2. Native inter-agent
messages may contain OpenAI-owned encrypted content that an external Responses
provider cannot consume. Cross-provider delegation needs a provider-aware
message boundary without weakening the native OpenAI path or duplicating the
parent context.

Design

User-owned trust boundary

  • Cross-provider delegation is disabled by default.
  • Only user config or the selected user profile can grant provider access via
    subagent_model_provider_allowlist.
  • Project, session, and role layers cannot extend that allowlist.
  • A role may select only a provider already present in the parent's effective
    provider map; it cannot define or replace provider credentials.

Provider isolation

  • Child creation resolves the role-owned provider before model validation.
  • Each cross-provider child receives provider-specific authentication and a
    provider-specific model manager/catalog.
  • OpenAI account headers, attestation state, access-program metadata, and
    encrypted function arguments are not forwarded to non-OpenAI providers.
  • Cold resume revalidates the exact provider configuration and current
    allowlist before issuing a request.

V2 message boundary

  • OpenAI children keep the existing encrypted agent_message transport.
  • Plaintext V2 agent messages are lowered only in the outgoing request copy for
    a non-OpenAI provider; durable history remains canonical.
  • OpenAI-only configuration_update items and internal metadata are removed at
    the same non-OpenAI request boundary.
  • Encrypted inter-agent content fails closed instead of being silently dropped
    or forwarded.
  • An isolated external-agent surface prevents an OpenAI model from accidentally
    selecting the encrypted route for a cross-provider target.

Context and nesting

  • Cross-provider children start fresh; explicit full or partial history forks
    are rejected.
  • An omitted default history fork is converted to a fresh spawn only when the
    selected role changes provider.
  • Nested agents can select another authorized role/provider without an
    intermediate OpenAI child and without duplicating context.

Deliberate non-goals

  • No generic provider.order, allow_fallbacks, or arbitrary extra_body
    support is added. Endpoint routing remains the provider's responsibility.
  • No provider credentials, endpoints, or private role definitions are embedded
    in the patch.
  • No new remote /models capability is inferred from the presence of a bearer
    token; custom catalogs remain declarative.

Verification

Area Result
Cross-provider V1/V2 E2E, including both provider directions and nested role switching 6/6 passed
App-server MultiAgent V2 module, including real remote-compaction output 17/17 passed
Affected package suites (agent-roles, config, core, model-provider, app-server) 417/417 passed
Focused role/routing/resume/reasoning/retained-context checks 66/66 passed
Request/cache boundary checks 4/4 passed
Config parse/edit/write-read round trips 5/5 passed
App-server model-list and thread-settings checks 11/11 passed
Compiled CLI stream checks 9/9 passed
cargo build --release -p codex-cli --bin codex passed (0.154.0-alpha.1)
cargo fmt --all -- --check passed
Targeted just fix for affected packages passed

The 6/6 cross-provider/nested E2E suite and the 17/17 app-server MultiAgent V2
suite were rerun against final head af3072e after the last audit and format
pass.

The investigated Windows code-mode elicitation failure reproduces unchanged on
the untouched 0.154.0-alpha.1 base. The repository-wide just fmt Python
phase was unavailable on this host because uv is not installed; no Python
files are changed by this patch.

Issues

Fixes openai#40858

Fixes openai#34833

Fixes openai#38656

Addresses openai#17598

Addresses openai#27712

Related regression report: openai#36387

Not claimed as fixed without a dedicated Ollama reproduction: openai#24069

Resolve role-owned providers from trusted user configuration, isolate child provider state, and route nested cross-provider delegation through a dedicated external agent surface.

Keep native OpenAI V2 agent messages encrypted while lowering only non-OpenAI V2 task delivery to plaintext user input. Add coverage for provider provenance, routing, resume, lifecycle, and nested delegation.
@Bozentan

Bozentan commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner Author

CI triage for run 33786633213:

  • cargo-deny, cargo fmt, the benchmark smoke test, and cargo shear all completed successfully. Those jobs are red only because the final clean-worktree check found codex-rs/Cargo.lock rewritten by the alpha workspace-version mismatch.
  • GNU/musl Bazel tests, Bazel clippy, release verification, the MODULE.bazel.lock check, and argument-comment lint stop before compiling this change. Their first shared error is the inherited alpha-base inconsistency: the workspace is 0.154.0-alpha.1, while the committed lock still records path packages such as codex-bwrap as 0.0.0, so the Bazel Cargo graph cannot resolve the path and considers MODULE.bazel.lock stale.
  • repo-check reports a stale exception for unchanged codex-rs/code-mode/Cargo.toml; codespell reports an unchanged typo in codex-rs/exec-server/src/no_follow/unix.rs.
  • Fork-only SDK/Windows jobs cannot access the private codex-runners runner group, and the macOS jobs were blocked by the fork account's billing limit.

This PR changes no Cargo.toml, Cargo.lock, MODULE.bazel.lock, Bazel configuration, or files named by the repo-check/codespell failures. I found no patch-specific CI failure; the local source and integration verification remains listed in the PR description.

After the final audit/format pass, I also reran the two highest-risk suites directly against head af3072e: cross-provider/nested V1+V2 E2E 6/6 passed, and app-server MultiAgent V2 role/resume/real-compaction coverage 17/17 passed. The test-induced Cargo.lock rewrite was discarded after confirming it was the same alpha workspace-version drift described above.

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.

1 participant