fix(opencode): show each OpenCode v2 model's real effort options, with one Default (#2439)

* fix(web): drop provider-default entry from dynamic reasoning effort options

* fix(cli): support OpenCode v2 /api/model variant lookup and Basic auth
This commit is contained in:
Junmo Kim
2026-11-15 08:00:10 +08:00
committed by GitHub
parent 9e85428913
commit 2d0c8a7695
4 changed files with 341 additions and 42 deletions
@@ -72,6 +72,31 @@ describe('getCodexComposerReasoningEffortOptions', () => {
])
})
it('drops provider-default entries from dynamic options so Default is not duplicated', () => {
expect(getCodexComposerReasoningEffortOptions('default', 'opencode', [
{ value: 'low', name: 'Low' },
{ value: 'high', name: 'High' },
{ value: 'max', name: 'Max' },
{ value: 'default', name: 'Default' }
])).toEqual([
{ value: null, label: 'Default' },
{ value: 'low', label: 'Low' },
{ value: 'high', label: 'High' },
{ value: 'max', label: 'Max' }
])
expect(getCodexComposerReasoningEffortOptions('', 'dsh', [
{ value: '', name: 'Provider default' },
{ value: 'Default', name: 'Default' },
{ value: 'low', name: 'Low' },
{ value: 'high', name: 'High' }
])).toEqual([
{ value: null, label: 'Default' },
{ value: 'low', label: 'Low' },
{ value: 'high', label: 'High' }
])
})
it('preserves unsupported current OpenCode values in the dropdown', () => {
expect(getCodexComposerReasoningEffortOptions('high', 'opencode', [
{ value: 'low', name: 'Low' },
@@ -47,7 +47,10 @@ function buildDynamicReasoningEffortOptions(
currentEffort: string | null,
dynamicOptions: ComposerReasoningEffortSourceOption[]
): CodexComposerReasoningEffortOption[] {
const optionValues = new Set(dynamicOptions.map((option) => option.value))
const filteredOptions = dynamicOptions.filter(
(option) => normalizeCodexComposerReasoningEffort(option.value) !== null
)
const optionValues = new Set(filteredOptions.map((option) => option.value))
const options: CodexComposerReasoningEffortOption[] = [
{ value: null, label: 'Default' }
]
@@ -59,7 +62,7 @@ function buildDynamicReasoningEffortOptions(
})
}
options.push(...dynamicOptions.map((option) => ({
options.push(...filteredOptions.map((option) => ({
value: option.value,
label: option.name ?? formatCodexReasoningEffortLabel(option.value)
})))