fix: inherit provider loaders for provider aliases#18487
Open
raf1hh wants to merge 1 commit intoanomalyco:devfrom
Open
fix: inherit provider loaders for provider aliases#18487raf1hh wants to merge 1 commit intoanomalyco:devfrom
raf1hh wants to merge 1 commit intoanomalyco:devfrom
Conversation
(cherry picked from commit 02f99e4)
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.
Issue for this PR
Closes #18486
Type of change
What does this PR do?
Fix custom providers configured with
auth_providerso they inherit the referenced provider's SDK options and model loader behavior.Before this change, built-in auth/plugin loaders were only applied to the source provider id and there is no way to reuse built-in sdk auth/model-loading behavior.
This change applies plugin auth loaders to aliased providers and reuses model/vars loaders from the referenced provider, so config like this now works:
{ "$schema": "https://opencode.ai/config.json", "provider": { "my-github-copilot": { "name": "My GitHub Copilot", "auth_provider": "github-copilot", "npm": "@ai-sdk/github-copilot" } } }With this change, my-github-copilot behaves like a GitHub Copilot-backed provider for auth/model loading, while still keeping its own provider id and config entry instead of overriding github-copilot directly.
Without this fix, using a custom id here is limiting because the aliased provider does not inherit the built-in loader behavior.
How did you verify your code works?
I cherry-picked this onto current upstream
dev, verified the PR diff is limited to this fix, and ranbun typecheckfrompackages/opencode.Screenshots / recordings
Not a UI change.
Checklist