Conversation
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 #
Type of change
What does this PR do?
Adds an
autoreasoning variant. When a model exposes more than one reasoning effort, the assembled model now also exposesauto. Selecting it classifies the current user turn and applies the matching effort for that request instead of a fixed preset.The classifier scores the last user message on length, code blocks, attachments, and a set of complexity terms, then returns low, medium, high, or xhigh. A
[think:xhigh]or[reasoning:low]prefix in the message overrides the result. The chosen effort maps to the closest effort variant the model already has, so models that only expose low and high still resolve.Most of this is in
packages/opencode/src/session/auto-reasoning.ts.LLMRequestPrep.preparecalls it when the selected variant isauto, andcreateUserMessageacceptsvariant: "auto".ProviderTransform.withAutoVariantadds the variant where the provider assemblesmodel.variants, soProviderTransform.variantsstays a plain provider effort map.Config still wins. Registration happens after config variants merge, so
autocan be disabled per model like any other variant, and it drops out when fewer than two concrete efforts remain.A model only receives
autowhen it exposes at least two rankable efforts. Models that expose a single toggle or no effort levels keep their current variant list, sodeepseek-chat,deepseek-reasoner,deepseek-v3,qwen,glm-4.6, andkimi-k2are unchanged. Models with real effort levels gain it:deepseek-v4,gpt-5, andclaude-sonnet-4-6all listlow, medium, high, auto. Toggle models such asminimax-m3(none,thinking) are rankable, withthinkingtreated as a high effort.How did you verify your code works?
bun typecheckonpackages/opencode.test/session/auto-reasoning.test.tscovers classification, overrides, effort-to-variant selection, prompt extraction,ProviderTransform.withAutoVariantgating, andLLMRequestPrepselecting low and high for simple and complex prompts.test/provider/transform.test.ts,test/provider/provider.test.ts,test/session/,test/acp/, andtest/cli/run/pass, as does the appmodel-variant.test.ts.I have not run this against a live provider, so the end-to-end behavior with a real model is untested.
Screenshots / recordings
The
autooption appears in the existing model variant picker. No separate interface change.Checklist