fix(auth): preserve 'custom' provider instead of silently remapping to 'openrouter'#2571
Closed
teyrebaz33 wants to merge 1 commit into
Closed
Conversation
…o 'openrouter'
resolve_provider('custom') was returning 'openrouter' due to a combined
set check. This caused /model and /status to show 'via openrouter' even
when the user had explicitly configured provider: custom in config.yaml,
with no notice given to the user.
Fix: split the set check so 'custom' returns 'custom' and 'openrouter'
returns 'openrouter' independently. Also preserve the provider name in
the runtime dict returned by resolve_runtime_provider() so display
layers receive 'custom' instead of 'openrouter'.
The OpenRouter code path continues to handle custom base_url requests
correctly — only the provider name in the returned dict changes.
Fixes NousResearch#2562
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
resolve_provider('custom')silently returned'openrouter'due to a combined set check:This caused:
/modelshowing "via openrouter" when user setprovider: custom/statusshowing the wrong providerFix
Split the set check so each provider returns its own name:
Also preserve
provider: customin the runtime dict returned byresolve_runtime_provider()so all display layers receive the correct name.What is not changed
custombase_url requests correctly —_resolve_openrouter_runtime()is still called forcustom, only theproviderkey in the returned dict changescustom+base_urlin config.yaml is unaffectedresolve_provider('openrouter')behavior is unchangedTests
5 new tests in
tests/test_runtime_provider_resolution.py:test_resolve_provider_custom_returns_custom— verifies the core fix against the actualresolve_provider()functiontest_resolve_provider_openrouter_unchanged— regression guardtest_resolve_runtime_provider_custom_preserves_provider_name— runtime dict hasprovider: customtest_resolve_runtime_provider_custom_base_url_preserved— base_url passes through correctlytest_resolve_runtime_provider_openrouter_not_affected— openrouter regression guardFixes #2562