Skip to content

Respect explicit api_mode on fallback providers - #33140

Closed
sunnysabor wants to merge 1 commit into
NousResearch:mainfrom
sunnysabor:fix-fallback-api-mode
Closed

Respect explicit api_mode on fallback providers#33140
sunnysabor wants to merge 1 commit into
NousResearch:mainfrom
sunnysabor:fix-fallback-api-mode

Conversation

@sunnysabor

Copy link
Copy Markdown

Summary

Preserve explicit api_mode on fallback provider entries.

A fallback entry like:

fallback_providers:
- provider: custom
  model: gpt-5.4
  api_mode: chat_completions

should continue using chat_completions after fallback activation. It should not be auto-upgraded to codex_responses based only on the GPT-5-style model name.

## Motivation

Current main respects explicit api_mode for the primary model, but fallback activation can still recompute the transport from provider/model heuristics and ignore the fallback entry-level override.

This is related to #29749 and the custom GPT-5 api_mode issues discussed around #10473 / #10548.

## Changes

- Respect explicit fallback entry api_mode before applying provider/model heuristics.
- Add a regression test for a custom GPT-5-style fallback with explicit api_mode: chat_completions.

## Test plan

scripts/run_tests.sh tests/run_agent/test_provider_fallback.py

Result:

23 passed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #24631 and #16346 — same fix: respect explicit api_mode on fallback_providers entries over provider/model heuristics. #16346 is the canonical (earliest open).

@sunnysabor

Copy link
Copy Markdown
Author

Thanks for the clarification. Closing this as a duplicate of #16346.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants