GeezerVison is showing github.com — fix(provider): respect configured small_model and add opencode handling to smallOptions by lexlian · Pull Request #31092 · anomalyco/opencode
Conversation
lexlian
commented
Jun 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #31042
Type of change
What does this PR do?
Two bugs cause the symptoms in #31042:
Bug 1 — silent fallback in getSmallModel. When small_model is configured but the model isn't in the provider catalog, the function returns undefined and the title agent silently uses the main model. The fallback behavior is correct (per the documented design and the changelog: "Invalid small_model config no longer poisons fallback paths"), but the user has no way to know their config was ignored. The fix adds a WARN log inside the catchTag handler so users see why.
Bug 2 — smallOptions missing opencode handling. When the title agent calls the LLM with small: true for an opencode provider model, smallOptions returned {} because it only handled openai, openrouter/llmgateway, and venice. The opencode API call was missing the include and reasoningSummary options that options() already sets for opencode, so the request would fail/behave unexpectedly, and the LLM runtime would retry — that's the ~90s delay users reported. The fix adds the same opencode options to smallOptions, scoped to the small-model call path.
Related: #8609 (misleading docs), #14807 (silent failure), #30662 (smallOptions missing opencode).
How did you verify your code works?
cd packages/opencode
bun typecheck # passes
bun test ./test/provider/provider.test.ts # 88/88 pass
bun test ./test/provider/transform.test.ts # 250/250 pass (was 248, +2 new for opencode)
bun test ./test/session/prompt.test.ts -t "loop calls LLM" # passes
To verify the warning manually: set small_model: "opencode/some-invalid-model" in your config, start a session, and you should see a WARN line configured small_model not found, falling back to main model in the logs.
Screenshots / recordings
N/A — no UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
beenotung reacted with thumbs up emoji
beenotung reacted with heart emoji
All reactions
-
👍
1 reaction
-
❤️
1 reaction
…ng to smallOptions
Closes anomalyco#31042
Two compounding bugs caused the symptoms in anomalyco#31042:
1. When cfg.small_model is configured but the model is not in the
provider catalog, getSmallModel silently returned undefined and
the caller fell back to the main model with no indication to the
user. Added a warning log so users know their config was ignored.
The fallback behavior itself matches the documented design
(per anomalyco#14807 and the changelog: "Invalid small_model config no
longer poisons fallback paths").
2. smallOptions() in transform.ts was missing opencode provider
handling — only openai, openrouter/llmgateway, and venice were
handled. For opencode models it returned an empty options object,
causing the opencode API call to fail/behave unexpectedly and
trigger LLM retries (the 90s delay users reported). Added the
same include and reasoningSummary that options() already sets for
opencode models, scoped to the small-model call path.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR will also fix issue #30662 (Auto session title generation fails for opencode provider models). The root cause is the same - smallOptions() missing opencode provider handling.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi maintainers! Could someone please review and approve the workflow for this PR? It's been waiting for about three weeks now, and we're looking forward to having this feature available. Thanks for your time and all your work on the project!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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.
|
Requesting this PR be reopened. It was auto-closed by the cleanup bot (created >1 month ago, <2 positive reactions), but it fixes a real, still-active bug — it should not have been swept up.
The bug is still present in the latest release (v1.18.19): auto session title generation silently fails for opencode (Zen) provider models, because smallOptions() in src/provider/transform.ts still has no opencode branch (it only handles openai, openrouter/llmgateway, and venice). Issue #30662 is open and multiple users are affected.
This PR is the proper fix: it adds the missing opencode handling to smallOptions() (the same promptCacheKey/include/reasoningSummary that options() already sets), plus a useful warning when a configured small_model isn't found. Author verified: bun typecheck passes, provider tests 88/88, transform tests 250/250 (+2 new for opencode).
A config workaround exists ("small_model": "<working-model>"), but it shouldn't be required — users on the opencode provider hit silent title failure by default. Could a maintainer review and reopen this so it can be merged?
|
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.
|