fix: enable runtime fallback for delegated child sessions (#2357)

This commit is contained in:
YeonGyu-Kim
2026-03-12 01:43:17 +09:00
parent 4ded45d14c
commit ba86ef0eea
14 changed files with 630 additions and 211 deletions
@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test"
declare const require: (name: string) => any
const { describe, expect, test } = require("bun:test")
import { extractAutoRetrySignal, isRetryableError } from "./error-classifier"
import { classifyErrorType, extractAutoRetrySignal, isRetryableError } from "./error-classifier"
describe("runtime-fallback error classifier", () => {
test("detects cooling-down auto-retry status signals", () => {
@@ -45,6 +46,45 @@ describe("runtime-fallback error classifier", () => {
expect(retryable).toBe(true)
})
test("classifies ProviderModelNotFoundError as model_not_found", () => {
//#given
const error = {
name: "ProviderModelNotFoundError",
data: {
providerID: "anthropic",
modelID: "claude-opus-4-6",
message: "Model not found: anthropic/claude-opus-4-6.",
},
}
//#when
const errorType = classifyErrorType(error)
const retryable = isRetryableError(error, [429, 503, 529])
//#then
expect(errorType).toBe("model_not_found")
expect(retryable).toBe(true)
})
test("classifies nested AI_LoadAPIKeyError as missing_api_key", () => {
//#given
const error = {
data: {
name: "AI_LoadAPIKeyError",
message:
"Google Generative AI API key is missing. Pass it using the 'apiKey' parameter or the GOOGLE_GENERATIVE_AI_API_KEY environment variable.",
},
}
//#when
const errorType = classifyErrorType(error)
const retryable = isRetryableError(error, [429, 503, 529])
//#then
expect(errorType).toBe("missing_api_key")
expect(retryable).toBe(true)
})
test("ignores non-retry assistant status text", () => {
//#given
const info = {