openai / openai/codex

Native subagent ignores explicit model_provider override while model override works

Open
#40,858 19 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI config custom-model subagent
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

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 subagent

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ~/.codex/config.toml and ~/.codex/agents/chain-test.toml, then reproduce the native subagent launch using the documented ChatGPT parent and minimax provider configuration. Compare the child’s effective model and provider with the working session-level -c overrides. Done means an explicitly configured subagent uses minimax while the parent remains on ChatGPT/OpenAI and the child executes the requested commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.