fix(coding-agent): allowed mixed fallback chains
- Allowed implicit default fallback resolution when other role fallback chains are configured. - Covered the mixed-role first-run fallback case. Fixes #4533
This commit is contained in:
@@ -13122,10 +13122,7 @@ export class AgentSession {
|
||||
if (
|
||||
Array.isArray(defaultChain) &&
|
||||
defaultChain.length > 0 &&
|
||||
this.#getRetryFallbackPrimarySelector("default") === undefined &&
|
||||
Object.entries(chains).every(
|
||||
([role, chain]) => role === "default" || !Array.isArray(chain) || chain.length === 0,
|
||||
)
|
||||
this.#getRetryFallbackPrimarySelector("default") === undefined
|
||||
) {
|
||||
return "default";
|
||||
}
|
||||
@@ -13155,11 +13152,7 @@ export class AgentSession {
|
||||
if (
|
||||
Array.isArray(defaultChain) &&
|
||||
defaultChain.length > 0 &&
|
||||
this.#getRetryFallbackPrimarySelector("default") === undefined &&
|
||||
Object.entries(chains).every(
|
||||
([chainRole, roleChain]) =>
|
||||
chainRole === "default" || !Array.isArray(roleChain) || roleChain.length === 0,
|
||||
)
|
||||
this.#getRetryFallbackPrimarySelector("default") === undefined
|
||||
) {
|
||||
const seen = new Set<string>([parsedCurrent.raw]);
|
||||
chain = [parsedCurrent];
|
||||
|
||||
@@ -219,10 +219,11 @@ describe("AgentSession retry fallback", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses the active initial model as the default fallback primary when the default role is unset", async () => {
|
||||
it("uses the active initial model as the default fallback primary when other role fallback chains are configured", async () => {
|
||||
const primaryModel = getBundledModel("anthropic", "claude-sonnet-4-5");
|
||||
const fallbackModel = getBundledModel("openai", "gpt-4o-mini");
|
||||
if (!primaryModel || !fallbackModel) {
|
||||
const otherRoleFallbackModel = getBundledModel("openai", "gpt-4o");
|
||||
if (!primaryModel || !fallbackModel || !otherRoleFallbackModel) {
|
||||
throw new Error("Expected bundled test models to exist");
|
||||
}
|
||||
|
||||
@@ -235,6 +236,7 @@ describe("AgentSession retry fallback", () => {
|
||||
"retry.maxRetries": 1,
|
||||
"retry.fallbackChains": {
|
||||
default: [`${fallbackModel.provider}/${fallbackModel.id}`],
|
||||
smol: [`${otherRoleFallbackModel.provider}/${otherRoleFallbackModel.id}`],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user