You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subtle bug: model.variants can be unintentionally overwritten when ProviderTransform.variants() returns {} #12169
There's a subtle bug in provider.ts where model.variants is unconditionally overwritten with the result of ProviderTransform.variants(model) before merging with user config variants.
The Issue
In the provider state initialization (around line 925), the code does:
model.variants=mapValues(ProviderTransform.variants(model),(v)=>v)// Then tries to merge with configconstconfigVariants=configProvider?.models?.[modelID]?.variantsif(configVariants&&model.variants){constmerged=mergeDeep(model.variants,configVariants)model.variants=mapValues(pickBy(merged,(v)=>!v.disabled),(v)=>omit(v,["disabled"]),)}
The problem is that ProviderTransform.variants() returns {} for models like kimi, deepseek, minimax, etc. (lines 331-341 in transform.ts). This means:
model.variants is first set to {}
Then the code attempts to merge with configVariants
Why This Is Subtle
Currently, this doesn't cause visible issues because:
The merge with configVariants happens immediately after
For most models, ProviderTransform.variants() returns non-empty variants
However, the subtle bug emerges in this scenario:
If a user defines custom variants in config AND those variants happen to have the same name as a built-in variant that ProviderTransform.variants() would return (if it weren't empty), the merge order and the fact that we first overwrite then merge could lead to unexpected precedence issues.
More importantly, if configVariants lookup fails or is undefined (which can happen in certain config loading edge cases), the user-defined variants from an earlier processing step would be lost entirely.
Current Workaround
The code happens to work now because:
For built-in providers, models go through initial processing where variants are set
The second loop then overwrites and re-merges
For kimi models, ProviderTransform returns {} so the merge just uses configVariants
Suggested Fix
Instead of overwriting then conditionally merging, we should merge directly:
These issues share the same root cause pattern where partial or missing configurations don't properly merge with defaults/existing data, which aligns with the variant overwriting bug described here.
Activity
github-actions commentedon Feb 4, 2026
This issue appears to be related to similar config merging and variant handling problems found in other issues. Please check:
These issues share the same root cause pattern where partial or missing configurations don't properly merge with defaults/existing data, which aligns with the variant overwriting bug described here.
github-actions commentedon Apr 6, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.