fix: preserve session provider context in fallback chain (#2295)

This commit is contained in:
YeonGyu-Kim
2026-03-12 01:49:16 +09:00
parent 3822423069
commit 7870e43578
3 changed files with 59 additions and 9 deletions
+17 -1
View File
@@ -1,4 +1,5 @@
import { describe, test, expect } from "bun:test"
declare const require: (name: string) => any
const { describe, test, expect } = require("bun:test")
import { buildFallbackChainFromModels, parseFallbackModelEntry } from "./fallback-chain-from-models"
describe("fallback-chain-from-models", () => {
@@ -32,6 +33,21 @@ describe("fallback-chain-from-models", () => {
})
})
test("uses opencode as absolute fallback provider when context provider is missing", () => {
//#given
const fallbackModel = "gemini-3-flash"
//#when
const parsed = parseFallbackModelEntry(fallbackModel, undefined)
//#then
expect(parsed).toEqual({
providers: ["opencode"],
model: "gemini-3-flash",
variant: undefined,
})
})
test("builds fallback chain from normalized fallback_models input", () => {
//#given
const fallbackModels = ["quotio/kimi-k2.5", "gpt-5.2 medium"]