fix: check user-defined providers before builtin alias guard#16342
Closed
dkwallace wants to merge 1 commit into
Closed
fix: check user-defined providers before builtin alias guard#16342dkwallace wants to merge 1 commit into
dkwallace wants to merge 1 commit into
Conversation
_get_named_custom_provider had the builtin provider guard at the top of the function, before the user-defined `providers:` dict was checked. This meant a user-defined provider whose name happened to match a built-in alias (e.g. "llama-cpp") was rejected as "not a custom provider" before the user's config entry was even examined. Moves the builtin guard to the end of the function, so user-defined providers in both `providers:` (dict) and `custom_providers:` (list) formats are checked first. Only if no user-defined match is found does the function check whether the name is a known built-in.
Collaborator
|
Related to #13134 — same root cause: builtin alias guard checked before user-defined providers dict. |
Contributor
|
Closing as superseded by #18185. Triage notes (high confidence): Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen. (Bulk-closed during a CLI PR triage sweep.) |
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.
Summary
_get_named_custom_providerwas checking the builtin provider alias guard *before* checking user-defined providers from theproviders:dict. This caused user-defined providers whose names happen to match a built-in alias (e.g.llama-cpp) to be silently rejected as "not a custom provider" — the user's config entry was never examined.Root Cause
The guard at the top of the function called
auth_mod.resolve_provider(requested_norm)and returnedNoneif the name matched a known built-in alias. This happened before any user-defined provider lookup.Fix
Moved the builtin guard to the end of
_get_named_custom_provider, after both theproviders:dict andcustom_providers:list are checked. User-defined providers now take priority over built-in aliases, which is the correct behavior — user configuration should always win.Test Plan
_get_named_custom_provider("llama-cpp")now returns the user'sproviders:entry instead ofNoneCloses # (no issue filed)