feat(toast): show warning only for fallback models (inherited/system-default)

category-default is the intended behavior for builtin categories,
not a fallback. Only show toast warning when:
- inherited: model from parent session (custom category without model)
- system-default: OpenCode's global default model

User-defined and category-default are both expected behaviors,
so no warning is needed.
This commit is contained in:
justsisyphus
2026-01-16 18:47:36 +09:00
parent cb6f1c9f75
commit 7cd59e9c0a
2 changed files with 20 additions and 21 deletions
+9 -9
View File
@@ -107,16 +107,16 @@ export class TaskToastManager {
const lines: string[] = []
// Show model fallback warning for the new task if applicable
if (newTask.modelInfo && newTask.modelInfo.type !== "user-defined") {
const icon = "⚠️"
const suffixMap: Partial<Record<ModelFallbackInfo["type"], string>> = {
inherited: " (inherited)",
"category-default": " (category default)",
"system-default": " (system default)",
const isFallback = newTask.modelInfo && (
newTask.modelInfo.type === "inherited" || newTask.modelInfo.type === "system-default"
)
if (isFallback) {
const suffixMap: Record<"inherited" | "system-default", string> = {
inherited: " (inherited from parent)",
"system-default": " (system default fallback)",
}
const suffix = suffixMap[newTask.modelInfo.type] ?? ""
lines.push(`${icon} Model: ${newTask.modelInfo.model}${suffix}`)
const suffix = suffixMap[newTask.modelInfo!.type as "inherited" | "system-default"]
lines.push(`⚠️ Model fallback: ${newTask.modelInfo!.model}${suffix}`)
lines.push("")
}