codex - 💡(How to fix) Fix Native subagent orchestration does not work correctly with non-OpenAI custom providers [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17598Fetched 2026-04-14 05:42:38
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Author
Timeline (top)
labeled ×5commented ×2unlabeled ×2

Code Example

[model_providers.company_local]
   name = "Company Local LLM"
   env_key = "LOCAL_LLM_API_KEY"
   wire_api = "responses"

   [profiles.local_main]
   model_provider = "company_local"
   model = "code-fast"

   [profiles.local_fast]
   model_provider = "company_local"
   model = "code-fast"

2. Verify that direct execution works:

---

3. Add a custom subagent config like:

---

4. Reproduce failure case 1, OpenAI parent to custom-provider child:

---

5. Reproduce failure case 2, custom-provider parent session:
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

0.120.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

gpt-5.4

What platform is your computer?

Linux 5.19.0-43-generic x86_64 x86_64, Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Windows Terminal using WSL and PowerShell

What issue are you seeing?

In codex-cli 0.120.0, native subagents do not work correctly with a non-OpenAI custom provider.

I observed two related failures:

  1. When the parent session uses OpenAI and the child subagent is configured with a non-OpenAI custom provider, the child rollout is created, but the child keeps the parent OpenAI config instead of applying the custom provider config.

  2. When the parent session itself uses the non-OpenAI custom provider, native subagent orchestration does not happen at all. No spawn_agent call appears in the rollout, no child rollout is created, and the parent answers directly.

OpenAI-only native subagents work correctly in the same environment, so this appears to be specific to native subagents with non-OpenAI custom providers.

What steps can reproduce the bug?

  1. Configure a working non-OpenAI custom provider in ~/.codex/config.toml, for example:

    [model_providers.company_local]
    name = "Company Local LLM"
    env_key = "LOCAL_LLM_API_KEY"
    wire_api = "responses"
    
    [profiles.local_main]
    model_provider = "company_local"
    model = "code-fast"
    
    [profiles.local_fast]
    model_provider = "company_local"
    model = "code-fast"
  2. Verify that direct execution works:

codex exec -p local_main --skip-git-repo-check --json "Reply with exactly: LOCAL_OK"
  1. Add a custom subagent config like:
name = "local_llm_worker"
model_provider = "company_local"
model = "code-fast"
model_reasoning_effort = "medium"
sandbox_mode = "read-only"
developer_instructions = """
Use the local LLM provider for read-only code exploration.
"""
  1. Reproduce failure case 1, OpenAI parent to custom-provider child:
codex --enable multi_agent_v2 exec -p openai_heavy --skip-git-repo-check --json "Use the local_llm_worker subagent for read-only exploration only. If the subagent runs, end with exactly LOCAL_WORKER_OK. If unavailable, end with exactly LOCAL_WORKER_UNAVAILABLE."
  1. Reproduce failure case 2, custom-provider parent session:
codex --enable multi_agent_v2 exec -p local_main --skip-git-repo-check --json "You must use the local_llm_worker subagent via native subagent spawning, not by answering yourself. Read-only exploration only. End with exactly LOCAL_PARENT_LOCAL_CHILD_OK or LOCAL_PARENT_LOCAL_CHILD_UNAVAILABLE."
  1. Optionally repeat the same test with another custom-provider parent profile such as local_fast.

What is the expected behavior?

Native subagents should work consistently with non-OpenAI custom providers.

Expected behavior:

  • If a child subagent specifies:

    • model_provider = "company_local"
    • model = "code-fast"
    • model_reasoning_effort = "medium"

    then the spawned child session should reflect those values in its effective config.

  • If the parent session uses a non-OpenAI custom provider, native subagent orchestration should still occur normally:

    • spawn_agent should appear in the rollout
    • a child rollout should be created
    • the parent should not answer directly instead of spawning the child

This should behave analogously to OpenAI-only native subagents, which work correctly in the same environment.

Additional information

What works:

  • Direct execution with the custom provider works correctly

  • OpenAI-only native subagents work correctly

  • A custom subagent with:

    • model_provider = "openai"
    • model = "gpt-5.4-mini"

    correctly produces a child rollout with the expected provider/model/effort values

Observed failure details:

  • In the OpenAI parent -> custom-provider child case:

    • child rollout is created
    • agent identity and developer instructions are applied
    • but child config remains on parent OpenAI values:
      • model_provider = openai
      • turn_context.model = gpt-5.4
      • collaboration_mode.settings.model = gpt-5.4
      • effort = high
  • In the custom-provider parent case:

    • parent starts correctly on company_local / code-fast
    • no spawn_agent call appears in the rollout
    • no child rollout file is created
    • parent answers directly

This makes it look like native subagent support is incomplete or broken for non-OpenAI custom providers, both in child config merging and in orchestration from a custom-provider parent.

Related issues:

  • #11701
  • #13204
  • #14039
  • #15170
  • #13849

extent analysis

TL;DR

The issue can be addressed by modifying the native subagent configuration to correctly handle non-OpenAI custom providers, potentially requiring updates to the codex-cli version or custom provider configuration.

Guidance

  • Verify that the custom provider configuration in ~/.codex/config.toml is correct and consistent with the expected behavior.
  • Check the codex-cli version and consider updating to a newer version if available, as the issue may be resolved in a later release.
  • Review the native subagent configuration and ensure that it is correctly set up to handle non-OpenAI custom providers, including the model_provider, model, and model_reasoning_effort settings.
  • Test the native subagent with a custom provider parent profile, such as local_main or local_fast, to reproduce the failure cases and verify the expected behavior.

Example

No code snippet is provided as the issue is related to configuration and versioning rather than code.

Notes

The issue appears to be specific to native subagents with non-OpenAI custom providers, and the expected behavior is not observed in the current codex-cli version. The provided steps to reproduce the bug and the expected behavior can help in debugging and resolving the issue.

Recommendation

Apply a workaround by modifying the native subagent configuration to correctly handle non-OpenAI custom providers, as the root cause of the issue is likely related to the codex-cli version or custom provider configuration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING