fix(schedules): fall back to the config default model when an override is gone (#356)

* fix(schedules): fall back to the config default model when an override is gone

* fix(schedules): never fall back to the configured small model

* fix(schedules): distinguish unknown availability and match configured models by key and id
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-19 12:30:56 -04:00
1 parent f175aa73a6
commit 50da84541a
10 files changed
+492 -144

No files matched your search

+1 -6
View File
@@ -2,7 +2,6 @@ import type { OpenCodeClient } from './opencode/client'
interface OpenCodeConfigResponse {
model?: string
small_model?: string
}
interface OpenCodeProviderResponse {
@@ -76,7 +75,6 @@ export async function resolveOpenCodeModel(
directory: string | undefined,
options?: {
preferredModel?: string | null
preferSmallModel?: boolean
},
): Promise<ResolvedOpenCodeModel> {
const [config, providersResponse] = await Promise.all([
@@ -86,10 +84,7 @@ export async function resolveOpenCodeModel(
const availableModels = buildAvailableModels(providersResponse)
const defaultModels = providersResponse.default ?? {}
const configCandidates = options?.preferSmallModel
? [config.small_model, config.model]
: [config.model, config.small_model]
const candidates = uniqueCandidates([options?.preferredModel, ...configCandidates])
const candidates = uniqueCandidates([options?.preferredModel, config.model])
for (const candidate of candidates) {
if (availableModels.has(candidate)) {