fix(variants): drop redundant thinking variant when effort enum present#42
Closed
justin-carper wants to merge 1 commit into
Closed
fix(variants): drop redundant thinking variant when effort enum present#42justin-carper wants to merge 1 commit into
justin-carper wants to merge 1 commit into
Conversation
Claude models via Cursor expose both a boolean thinking param and an effort enum. buildModelVariants emitted a variant for each, surfacing a stray thinking entry alongside low/medium/high/xhigh/max. Standard opencode providers (models.dev reasoning_options.effort) show only the five effort levels, so the boolean variant broke parity. Add a hasEffortEnum pre-pass; when true, skip the boolean reasoning variant. Effort alone enables reasoning (no thinking:true baked in). Boolean-only reasoning models still surface their single param-named variant. Order-independent. fast toggle and defaultModelParams untouched. Tests: updated dual-param expectation, added order-independence, production-shape+fast composition, zero-value-enum guard, and pinned current mixed-shape param behavior.
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.
Problem
For Anthropic/Claude models accessed via the Cursor provider, the Cursor SDK catalog exposes two reasoning params on the same model:
thinking=["false","true"]["low","medium","high","xhigh","max"]buildModelVariantsemitted a variant for each, so opencode's variant cycler showed:Standard opencode providers (driven by models.dev
reasoning_optionsof typeeffort) show only the five effort levels — nothinkingentry. The extrathinkingvariant was inconsistent and redundant (selecting any effort level already enables reasoning).Fix
buildModelVariants(src/model-variants.ts):hasEffortEnumpre-pass — scans params for any non-boolean reasoning enum, order-independent.hasEffortEnumis true, skip emitting the param-named boolean variant.thinking:"true"baked in (effort alone enables reasoning, per design decision).Behavior matrix
thinking+ effort enum (Claude via Cursor)thinking+low/…/maxlow/…/max✅ paritythinkingonly (no enum)thinkingthinking(unchanged)fasttogglefastopt-in + baked-off defaultsOut of scope:
composer-2.5thinking=["off","on"](treated as enum),fast,defaultModelParams.Tests
Updated the former dual-param test and added 4 new cases in
test/model-variants.test.ts:thinking+effort+fast: assertsthinkingsuppressed,fast:"false"baked into effort variants,fastopt-in present.thinkingsurvives.true—thinking=["false"]+ effort → only effort variants.["false","true","high"]current behavior pinned so a future catalog change is caught.Verification
npx vitest run→ 190 passed (18 files)npx tsc --noEmit→ exit 0Review
Reviewed by
code-revieweragent: no critical issues, fix correct for all real catalog shapes. Tests added in response to its findings (production-shape+fast composition, zero-value-enum guard).