Repository navigation
Open
Labels
CLIIssues related to the Codex CLIbugSomething isn't workingconfigIssues involving config.toml, config keys, config merging, or config updatescustom-modelIssues related to custom model providers (including local models)subagentIssues involving subagents or multi-agent features
Description
What version of Codex CLI is running?
codex-cli 0.149.1
What subscription do you have?
plus
Which model were you using?
Parent: gpt-5.6-luna (xhigh) Subagent: MiniMax-M3
What platform is your computer?
Linux 6.17.0-29-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
GNOME Terminal 3.52.0 using VTE 0.76.0 +BIDI +GNUTLS +ICU +SYSTEMD
Codex doctor report
What issue are you seeing?
Native subagent roles appear to ignore an explicit model_provider override while correctly applying the model and model_reasoning_effort overrides.
My parent session uses ChatGPT/OpenAI:
- Parent model:
gpt-5.6-luna - Parent provider: OpenAI / ChatGPT account
The subagent role explicitly specifies:
model = "MiniMax-M3"
model_provider = "minimax"
model_reasoning_effort = "high"
### What steps can reproduce the bug?
1. Register a custom Responses API provider in ~/.codex/config.toml:
[features]
multi_agent = true
[agents]
enabled = true
default_subagent_model = "gpt-5.6-luna"
default_subagent_reasoning_effort = "xhigh"
[model_providers.minimax]
name = "MiniMax"
base_url = "https://api.minimaxi.com/v1"
experimental_bearer_token = "<redacted>"
wire_api = "responses"
Do NOT globally set:
model_provider = "minimax"
The parent session should remain authenticated through ChatGPT/OpenAI.
2. Create a native subagent role at:
~/.codex/agents/chain-test.toml
with the following configuration:
name = "chain_test"
description = """
Diagnostic subagent for testing cross-provider delegation.
"""
model = "MiniMax-M3"
model_provider = "minimax"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
developer_instructions = """
Inspect the current repository.
Actually execute:
- pwd
- git status
- ls
Do not modify any files.
"""
3. Start the normal ChatGPT-authenticated Codex CLI:
codex
4. Ask the parent agent:
You must use the chain_test subagent for this task.
Do not perform the task yourself.
Inspect the current repository and actually run:
- pwd
- git status
- ls
Wait for chain_test to finish and return its result.
5. Codex successfully resolves the role and spawns the child:
Spawned <thread-id> (MiniMax-M3 high)
However, the child fails before running the requested commands with:
The 'MiniMax-M3' model is not supported when using Codex with a ChatGPT account.
6. As a control test, use the SAME ~/.codex configuration and SAME ChatGPT-authenticated environment, but override the provider at the session level:
codex exec \
-C "$PWD" \
--sandbox danger-full-access \
-c 'model_provider="minimax"' \
-c 'model="MiniMax-M3"' \
-c 'model_reasoning_effort="high"' \
"Actually execute pwd and return the result."
This works correctly.
Codex reports:
model: MiniMax-M3
provider: minimax
The MiniMax model then successfully performs the shell tool call.
Therefore, the custom provider itself works correctly from the same ChatGPT-authenticated CODEX_HOME.
The failure appears specific to applying the explicit model_provider override from a native subagent role: the model override is applied, but the provider appears to remain inherited from the OpenAI/ChatGPT parent.
### What is the expected behavior?
When a native subagent role explicitly specifies both:
model = "MiniMax-M3"
model_provider = "minimax"
the spawned child should use both overrides.
Expected configuration:
Parent:
model: gpt-5.6-luna
provider: openai / ChatGPT
Child:
model: MiniMax-M3
provider: minimax
The parent provider should only be inherited when the subagent role does not explicitly specify its own model_provider.
This should allow native subagents to use a different custom provider from the parent session.
### Additional information
I can also reproduce the same behavior in the ChatGPT/Codex desktop app.
The desktop app is using its bundled Codex runtime:
/usr/lib/chatgpt/resources/codex --version
codex-cli 0.150.0-alpha.8
The desktop native subagent also applies the MiniMax-M3 model override, but then fails with the same ChatGPT-account error instead of using the explicitly configured minimax provider.
The custom provider itself is confirmed to work.
Using the same normal ChatGPT-authenticated ~/.codex environment, a session-level override works successfully:
codex exec \
-C "$PWD" \
--sandbox danger-full-access \
-c 'model_provider="minimax"' \
-c 'model="MiniMax-M3"' \
-c 'model_reasoning_effort="high"' \
"Actually execute pwd and return the result."
Codex reports:
model: MiniMax-M3
provider: minimax
and MiniMax-M3 successfully performs the shell tool call.
So this does not appear to be a general custom-provider, authentication, or MiniMax compatibility issue.
The behavior appears specific to native subagent configuration:
- Subagent model override works.
- Subagent reasoning-effort override works.
- Explicit subagent model_provider override does not appear to take effect.
A practical use case is keeping an OpenAI/ChatGPT model as the parent/orchestrator while delegating implementation, testing, review, or exploration to specialized or lower-cost models on other providers.
For example:
OpenAI / ChatGPT parent
|
+-- MiniMax backend subagent
+-- MiniMax frontend subagent
+-- MiniMax QA subagent
+-- MiniMax reviewer subagentReacted by Charlie, test-dev-qq, shungiku, Tian99Yu, YOSHIFUJI Naoki, Maz, f1vestars, Peng Guanwen, bakabiko, yosuke ikeda and 8 more
Metadata
Metadata
Assignees
Labels
CLIIssues related to the Codex CLIbugSomething isn't workingconfigIssues involving config.toml, config keys, config merging, or config updatescustom-modelIssues related to custom model providers (including local models)subagentIssues involving subagents or multi-agent features
Activity
github-actions commentedon Aug 26, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Razyrickk commentedon Aug 27, 2026
My issue too. I need to use custom provider for subagents while GPT is the controller.
JiuGHim commentedon Aug 27, 2026
Exactly. My goal is also to keep gpt5.6 sol as the controller while using a custom provider such as MiniMax for native subagents.
I also confirmed that the custom provider works correctly in the same ChatGPT-authenticated CODEX_HOME when overridden at the session level. The failure only happens when model_provider is specified in the native subagent role: model is applied, but the provider still appears to be inherited from the parent.
Tian99Yu commentedon Aug 29, 2026
exactly the same issue for me !!
sol as the coordinator, but third party agent as the worker. It used to work 2 months ago!! This is a regression
#39299 because of this PR
yiaany commentedon Aug 29, 2026
I'd like to work on this. I can reproduce the regression and will start by adding a failing test for the explicit
model_provideroverride in native subagent roles, then trace the config inheritance introduced around #39299 and implement a focused fix.Is this approach aligned with the maintainers' expectations?
jfedor commentedon Aug 31, 2026
I can reproduce this on newer versions with Z.ai:
glm-5.3-flashZAIResponses providerDirect control test succeeds:
Native subagent test fails:
The child session metadata shows:
{ "agent_role": "zai_worker", "model_provider": "openai", "model": "glm-5.3-flash" }So the model override is applied, but
model_provider = "ZAI"is discarded.This appears consistent with PR #39299 preserving parent-owned providers. If that restriction is intentional, the custom-agent documentation should state that
model_providercannot be overridden and Codex should reject or warn about the ineffective field. If cross-provider native delegation is intended, the child needs to carry the resolved provider and trusted user-level provider configuration.Bozentan commentedon Aug 31, 2026
Update: I can also reproduce the same provider-inheritance behavior on Codex CLI
0.152.0-alpha.7, the current published alpha as of September 1, 2026.Tested with:
z-ai/glm-5.3-flashThe native subagent is created, but fails during
session_startup_prewarmwith:This is the same failure pattern: the role's model override is applied while the child still uses the parent's OpenAI/ChatGPT provider. Cross-provider native delegation therefore does not appear to be fixed in
0.152.0-alpha.7.jfedor commentedon Aug 31, 2026
@Bozentan interesting. On Codex CLI 0.151.0 it works fine
Bozentan commentedon Sep 1, 2026
Update: the candidate has now been rebased onto
openai/codex:latest-alpha-cliat0.154.0-alpha.1and finalized asaf3072ebbc.The review mirror is Bozentan/codex#2.
The final implementation fixes both halves of the problem:
a user-owned
subagent_model_provider_allowlist;agent_messagetransport intact,but lowers a plaintext task to one ordinary
usermessage when thedestination provider is non-OpenAI.
The provider boundary is intentionally narrow:
catalog;
starts a fresh child;
silently discarded.
Nested delegation is covered in both directions, including a non-OpenAI V2
agent selecting a second authorized provider role. There is no intermediate
OpenAI child and no duplicated parent context.
Verification on Windows includes 6/6 cross-provider V1/V2 E2E tests, 17/17
app-server V2 tests (including real remote-compaction output), 417/417 affected
package tests, focused routing/resume/config/CLI suites, Rust formatting and
targeted fix checks, plus a successful optimized release build of
codex-cli 0.154.0-alpha.1.The 6/6 cross-provider/nested suite and 17/17 app-server V2 suite were rerun
against final head
af3072eafter the last architecture-audit and formattingpass.
This candidate also addresses #34833, #38656, #17598, and #27712. It does not
add generic provider-routing fields or embed any provider endpoint, credential,
or private role definition.
magic3007 commentedon Sep 2, 2026
I implemented and locally validated a candidate fix for this issue in the fork commit below:
magic3007@30e9f16e2c
The implementation:
model_providerfrom the parent-owned provider registry, preserving the parent's provider for unknown or role-local provider IDs;spawn_agent,send_message, andfollowup_taskpayloads with a hard 10 KB bound;Targeted
codex-coretests and scoped Clippy checks pass. The complete fork branch (including a separate third-party Responses stream compatibility fix) is:https://github.com/magic3007/codex/tree/fix/subagent-model-provider
f1vestars commentedon Sep 3, 2026
I can confirm this issue with OpenRouter-backed native subagents in Codex Desktop on macOS.
My parent thread uses ChatGPT/OpenAI authentication. I configured custom native subagent roles with explicit OpenRouter models, for example:
AeonPrime commentedon Sep 4, 2026
I can confirm this issue persists with opencode go models that follow the /v1/responses endpoint schema.
I've gotten around it with a script that starts workers, but that feels very unelegant.
VS Code Codex extension 26.901.22334 and the linux CLI client affected the same way.
Tian99Yu commentedon Sep 4, 2026
As another unelegant approach, I wrote a plugin with part of the functionality to start an opencode agent via the opencode CLI, as an approximation of a native subagent
And yes, this is not the way I want to use it :(
grc-jatin-garg commentedon Sep 8, 2026
Hi is there some fix being implemented for this? Wanted to use external provider subagents natively inside codex with existing openAI models.
Razyrickk commentedon Sep 8, 2026
not yet as per latest stable release. For mine, i created a script that runs parent level codex worker that uses external provider, since parent level supports it (while subagents doesn't, which is weird). But it's inefficient way to do it since controller has to poll-like monitor it, instead of notifying the controller once finished.
grc-jatin-garg commentedon Sep 8, 2026
Yup I did the same thing, wrote a minimal script, but a "native" subagent support works much better, claude_code has this support,
grc-jatin-garg commentedon Sep 9, 2026
Hi @Razyrickk I think there is one easy way-around, have a local proxy of sort, all of the codex traffic goes via that proxy, for OpenAI models, proxy routes traffic as it is to OpenAI endpoints, for other model providers, proxy routes traffic accordingly with relevant headers.
NathanNT commentedon Sep 15, 2026
I ran into the same issue and put together a small compatibility kit that preserves the subagent role's custom model_provider while keeping the parent on GPT. Sharing it in case it's useful as a temporary workaround : https://github.com/NathanNT/codex-mux
Mazyod commentedon Sep 15, 2026
Why would you upload opaque executables and ask people to run them...
NathanNT commentedon Oct 2, 2026
The executable was just Codex built from OpenAI pinned upstream source with the patch from this repo applied. build.ps1 clones the pinned Codex version, applies the patch and builds codex with Cargo.
The release was only there as a convenience for people who didn't want to compile Codex. I've removed it if you prefer that way, but anyone can still review the patch and run build.ps1 to build the patched binary from source.
codex: update to 0.164.0