merge(dev): resolve latest sync-task conflict for delegated fallback PR
Sync the PR branch with the latest dev branch and resolve the remaining conflict in sync-task.test.ts while preserving both the new upstream poll-recovery coverage and this branch's delegated bootstrap cleanup and isolation coverage. Re-verified the affected delegated fallback suites and typecheck after the merge resolution. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
|
||||
import { extractAutoRetrySignal } from "./auto-retry-signal"
|
||||
|
||||
describe("extractAutoRetrySignal", () => {
|
||||
test("detects Volcano Engine 'exceeded the usage quota' signal", () => {
|
||||
//#given
|
||||
const info = {
|
||||
status: "You have exceeded the 5-hour usage quota. It will reset at 2026-05-11 01:20:12 +0800 CST.",
|
||||
}
|
||||
|
||||
//#when
|
||||
const signal = extractAutoRetrySignal(info)
|
||||
|
||||
//#then
|
||||
expect(signal).toBeDefined()
|
||||
expect(signal?.signal).toContain("exceeded")
|
||||
expect(signal?.signal).toContain("usage quota")
|
||||
})
|
||||
|
||||
test("detects standard 'quota exceeded' signal", () => {
|
||||
//#given
|
||||
const info = { message: "Quota exceeded for model gpt-4" }
|
||||
|
||||
//#when
|
||||
const signal = extractAutoRetrySignal(info)
|
||||
|
||||
//#then
|
||||
expect(signal).toBeDefined()
|
||||
})
|
||||
|
||||
test("returns undefined for non-retryable info", () => {
|
||||
//#given
|
||||
const info = { message: "Something went wrong" }
|
||||
|
||||
//#when
|
||||
const signal = extractAutoRetrySignal(info)
|
||||
|
||||
//#then
|
||||
expect(signal).toBeUndefined()
|
||||
})
|
||||
})
|
||||
@@ -5,7 +5,7 @@ export interface AutoRetrySignal {
|
||||
const AUTO_RETRY_PATTERNS: Array<(combined: string) => boolean> = [
|
||||
(combined) => /retrying\s+in/i.test(combined),
|
||||
(combined) =>
|
||||
/(?:too\s+many\s+requests|quota\s+will\s+reset\s+after|quota\s*exceeded|usage\s+limit|rate\s+limit|limit\s+reached|all\s+credentials\s+for\s+model|cool(?:ing)?\s*down|exhausted\s+your\s+capacity)/i.test(combined),
|
||||
/(?:too\s+many\s+requests|quota\s+will\s+reset\s+after|quota\s*exceeded|exceeded.*quota|usage\s+limit|usage\s*quota|rate\s+limit|limit\s+reached|all\s+credentials\s+for\s+model|cool(?:ing)?\s*down|exhausted\s+your\s+capacity)/i.test(combined),
|
||||
]
|
||||
|
||||
export function extractAutoRetrySignal(info: Record<string, unknown> | undefined): AutoRetrySignal | undefined {
|
||||
|
||||
@@ -27,6 +27,8 @@ export const RETRYABLE_ERROR_PATTERNS = [
|
||||
/too.?many.?requests/i,
|
||||
/quota\s+will\s+reset\s+after/i,
|
||||
/quota.?exceeded/i,
|
||||
/exceeded.*quota/i,
|
||||
/usage\s*quota/i,
|
||||
/exhausted\s+your\s+capacity/i,
|
||||
/all\s+credentials\s+for\s+model/i,
|
||||
/cool(?:ing)?\s+down/i,
|
||||
|
||||
@@ -126,6 +126,8 @@ export function classifyErrorType(error: unknown): string | undefined {
|
||||
errorName?.includes("insufficientquota") ||
|
||||
errorName?.includes("billingerror") ||
|
||||
/quota.?exceeded/i.test(message) ||
|
||||
/exceeded.*quota/i.test(message) ||
|
||||
/usage\s*quota/i.test(message) ||
|
||||
/subscription.*quota/i.test(message) ||
|
||||
/insufficient.?(?:quota|balance|funds?)/i.test(message) ||
|
||||
/billing.?(?:hard.?)?limit/i.test(message) ||
|
||||
|
||||
@@ -56,4 +56,21 @@ describe("runtime-fallback quota error regressions", () => {
|
||||
// quota errors trigger fallback to next configured model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies Volcano Engine 'exceeded the usage quota' as quota_exceeded and retryable", () => {
|
||||
//#given
|
||||
const error = {
|
||||
name: "SessionRetry",
|
||||
message: "You have exceeded the 5-hour usage quota. It will reset at 2026-05-11 01:20:12 +0800 CST. We recommend using a different model.",
|
||||
}
|
||||
|
||||
//#when
|
||||
const errorType = classifyErrorType(error)
|
||||
const retryable = isRetryableError(error, [429, 500, 502, 503, 504])
|
||||
|
||||
//#then
|
||||
expect(errorType).toBe("quota_exceeded")
|
||||
// Volcano Engine quota errors trigger fallback to the next model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user