GeezerVison is showing github.com — fix(core): respell inherited variants when config changes a provider's package by rekram1-node · Pull Request #55979 · anomalyco/opencode
Conversation
Fixes #55226
Summary
When config overrides a provider's package, catalog models that inherit the provider's package now get reasoning variants for the new package. #55962 handled a package set on a single model; this covers the provider-level case.
Reported case: the zai provider pointed at @opencode/ai/providers/anthropic. glm-5.3 kept its Chat-style catalog variants (thinking: { type: "enabled", clear_thinking: false } plus reasoningEffort), so zai/glm-5.3#low failed locally with Missing key at ["thinking"]["budgetTokens"] before any request was sent.
Change
- The config plugin records each provider's package from before the override.
- Before any document's model config is applied, every model whose package comes from an overridden provider gets its variants rebuilt for the new package (only models that have variants).
- Variants configured in any config file then overlay that new set, the same way they overlay catalog variants. So a variant set in the global config survives a package override from the project config.
- The per-model check from fix(core): respell variants when config changes a catalog model's package #55962 now compares effective packages (
model.package ?? provider.package). That also covers a model listed in the same file as a provider-level override.
- Models with their own
package, and models without variants, are unchanged.
Testing
- New config plugin tests:
- Reporter's setup through the dev CLI, using the real catalog
zai/glm-5.3, the provider package set to @opencode/ai/providers/anthropic, and a local server that records requests:
dev: fails locally with Missing key; no request is sent.
- This branch: sends
thinking: { type: "adaptive" } plus output_config.effort: "low".
- The z.ai account's plan has expired, so I couldn't confirm against the real z.ai endpoint.
bun run check passes. Full core suite: the same 8 shell/environment failures as on clean dev, no new ones.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the reported case: on the base, zai/glm-5.3#low with the provider package set to Anthropic fails locally with Missing key at ["thinking"]["budgetTokens"]. With this PR it sends an Anthropic request to the mock endpoint. I ran the #55226 repro script from source in both checkouts, plus the config provider tests (new test fails on base, passes here) and typecheck in packages/core.
Public API is unchanged: no new config keys, only how existing config is applied.
One concern, inline: variants a user sets in a different config file from the package override get overwritten.
Related: #53756
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
if (item.package === undefined || providerPackage === definition.previousPackage) continue
|
|
|
for (const model of models.list(providerID)) {
|
|
|
if (model.package !== undefined || model.variants.length === 0) continue
|
|
|
if (item.models?.[model.id]?.variants !== undefined) continue
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only skips models whose variants are set in the same document as the package override. If one document sets models.glm-5.3.variants (e.g. the global config, using the budgetTokens workaround from #55226) and a later one (e.g. the project config) sets the provider's package, the first document's variants get merged in its own iteration. This loop then replaces them with the generated ladder. I confirmed it with a two-document test: the configured budgetTokens variant came back as { thinking: { type: "adaptive" }, effort: "low" }. Could the respell run once per provider before any configured model variants are merged? Or skip models that have variants configured in any document.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 29, 2026
|
Automated PR Cleanup
Thank you for contributing to opencode.
Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.
This PR was closed because it matched the following cleanup criteria:
- The PR was created more than 1 month ago
- The PR had fewer than 2 positive reactions
- Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR
PRs created within the last month are not affected by this cleanup.
If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.
Thanks again for taking the time to contribute.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|