Skip to content

Preserve runtime model provider when applying subagent roles #27712

Open

Description

@keishimizu26629

Summary

When applying a subagent role with agent_type, the role's model / model_reasoning_effort settings are reflected in the child thread snapshot.

However, the runtime-configured model_provider instance was not preserved during role application. As a result, the child request could be routed using the post-reload provider configuration instead of the active provider.

Cause

The config reload preserves model_provider_id, but loses the runtime model_provider instance when the role does not explicitly specify model_provider.

Expected Behavior

If a role does not override model_provider, the current runtime provider should be preserved.

Change Made

I updated the role-application path to preserve the current provider instance and added tests covering:

  • provider preservation across reload
  • wire-level propagation of role model / reasoning.effort into the child request body

Verification

  • just fmt
  • just test -p codex-core apply_role_preserves_current_model_provider_without_override subagent_role_model_and_reasoning_reach_child_request_body responses_api_parent_and_subagent_requests_include_identity_headers spawn_agent_role_overrides_requested_model_and_reasoning_settings

Diff

Fork compare:
keishimizu26629/codex@main...fix-subagent-role-provider

Upstream PR could not be created because openai/codex restricts PR creation to collaborators.

Activity

  1. added
    bug
    CLI
    subagent
    config
    on Jun 12, 2026
  2. github-actions commented on Jun 12, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. keishimizu26629 commented on Jun 12, 2026

    @keishimizu26629
    Author

    Thanks for flagging. This appears related to #27624, but I do not think it is an exact duplicate.

    #27624 reports that model_reasoning_effort is ignored in Codex App and subagents are spawned with medium.

    This issue is narrower: during role application, the config reload preserves model_provider_id but does not preserve the runtime model_provider instance. The linked fork diff includes a fix for preserving the provider instance and wire-level test coverage that verifies the subagent child /v1/responses request body contains the role's model and reasoning.effort.

    So this may be related or complementary to #27624, but the proposed change targets a specific provider-preservation issue in the role application path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconfigsubagent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions