fix(core,cli): avoid provider fallback on auth refresh#1532
Closed
liqiongyu wants to merge 2 commits intoQwenLM:mainfrom
Closed
fix(core,cli): avoid provider fallback on auth refresh#1532liqiongyu wants to merge 2 commits intoQwenLM:mainfrom
liqiongyu wants to merge 2 commits intoQwenLM:mainfrom
Conversation
- Preserve raw model ids on same-authType refresh\n- Tighten env auth inference to require model vars\n\nFixes QwenLM#1506
Collaborator
|
#1510 is trying to resolve the issue and other relevant issues. |
Contributor
Author
|
Closing to avoid duplication: #1510 is already addressing the auth refresh / generationConfig preservation work around #1506 (with a more complete refactor). Also, this PR accidentally includes the MCP @server: resource expansion commit, which is tracked separately in #1531 (fixes #1511). I'll continue follow-ups in #1510/#1531. Sorry for the noise. |
This was referenced Jan 19, 2026
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.
TLDR
modelProvidersmodel when the configuredmodel.nameis not registry-backed.Dive Deeper
ModelsConfig.syncAfterAuthRefresh()previously fell back toModelRegistry.getDefaultModelForAuthType()whenever the currentmodelIdwasn’t in the registry, even ifauthTypehadn’t changed. Withsettings.modelProvidersconfigured, this meant “first provider model wins”, overriding explicit rawsettings.model.namevalues and, in/authflows, could effectively dropsettings.model.generationConfigfor the session.This PR limits that fallback to auth-type switches (and keeps qwen-oauth strict), and preserves raw model IDs for same-authType refresh.
For env inference,
getAuthTypeFromEnv()previously inferred from*_API_KEYalone (e.g.GEMINI_API_KEY), which then produced confusing “missing model env var” errors. This PR requires the corresponding*_MODEL(and for anthropic, base URL) before inferring.Reviewer Test Plan
npx vitest packages/core/src/models/modelsConfig.test.ts packages/cli/src/utils/modelConfigUtils.test.ts.settings.modelProviders.openai.security.auth.selectedType = "openai"and setmodel.nameto a raw model id that is not inmodelProviders.qwenand verify it does not switch to the first provider model during auth refresh.Testing Matrix
Linked issues / bugs
Fixes #1506