Skip to content

Commit e0ac575

Browse files
committed
fix(thinking): always clamp unsupported levels to nearest valid level
Remove the same-provider-family restriction on level clamping. When a model registry entry declares supported levels (e.g. Copilot claude-opus-4.6 with [low, medium, high]), requesting "max" should auto-downgrade to "high" instead of returning ErrLevelNotSupported. This fixes the case where opencode sends max thinking to a proxied Copilot endpoint that only supports up to high.
1 parent 0c48ef5 commit e0ac575

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

internal/thinking/validate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ func ValidateConfig(config ThinkingConfig, modelInfo *registry.ModelInfo, fromFo
5454
}
5555

5656
// allowClampUnsupported determines whether to clamp unsupported levels instead of returning an error.
57-
// This applies when crossing provider families (e.g., openai→gemini, claude→gemini) and the target
58-
// model supports discrete levels. Same-family conversions require strict validation.
57+
// This applies when the target model has a discrete levels list. The model registry already declares
58+
// exactly which levels are supported, so clamping to the nearest valid level is always safe
59+
// regardless of provider family (e.g., proxied Copilot claude-opus-4.6 only supports up to "high").
5960
toCapability := detectModelCapability(modelInfo)
6061
toHasLevelSupport := toCapability == CapabilityLevelOnly || toCapability == CapabilityHybrid
61-
allowClampUnsupported := toHasLevelSupport && !isSameProviderFamily(fromFormat, toFormat)
62+
allowClampUnsupported := toHasLevelSupport
6263

6364
// strictBudget determines whether to enforce strict budget range validation.
6465
// This applies when: (1) config comes from request body (not suffix), (2) source format is known,

0 commit comments

Comments
 (0)