Preserve runtime model provider when applying subagent roles

Open 💬 2 comments Opened Jun 12, 2026 by 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:
https://github.com/keishimizu26629/codex/compare/main...fix-subagent-role-provider

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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗