fix(runtime-fallback): also classify Volcano Engine errors as quota_exceeded
- Add /exceeded.*quota/i and /usage\s*quota/i to classifyErrorType quota block - Align /usage.?quota/i -> /usage\s*quota/i in RETRYABLE_ERROR_PATTERNS for consistency - Strengthen auto-retry-signal test assertion - Add classifyErrorType assertion to Volcano Engine regression test Ensures Volcano Engine errors are both retryable AND logged as errorType: quota_exceeded.
This commit is contained in:
@@ -15,6 +15,7 @@ describe("extractAutoRetrySignal", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(signal).toBeDefined()
|
expect(signal).toBeDefined()
|
||||||
expect(signal?.signal).toContain("exceeded")
|
expect(signal?.signal).toContain("exceeded")
|
||||||
|
expect(signal?.signal).toContain("usage quota")
|
||||||
})
|
})
|
||||||
|
|
||||||
test("detects standard 'quota exceeded' signal", () => {
|
test("detects standard 'quota exceeded' signal", () => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const RETRYABLE_ERROR_PATTERNS = [
|
|||||||
/quota\s+will\s+reset\s+after/i,
|
/quota\s+will\s+reset\s+after/i,
|
||||||
/quota.?exceeded/i,
|
/quota.?exceeded/i,
|
||||||
/exceeded.*quota/i,
|
/exceeded.*quota/i,
|
||||||
/usage.?quota/i,
|
/usage\s*quota/i,
|
||||||
/exhausted\s+your\s+capacity/i,
|
/exhausted\s+your\s+capacity/i,
|
||||||
/all\s+credentials\s+for\s+model/i,
|
/all\s+credentials\s+for\s+model/i,
|
||||||
/cool(?:ing)?\s+down/i,
|
/cool(?:ing)?\s+down/i,
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ export function classifyErrorType(error: unknown): string | undefined {
|
|||||||
errorName?.includes("insufficientquota") ||
|
errorName?.includes("insufficientquota") ||
|
||||||
errorName?.includes("billingerror") ||
|
errorName?.includes("billingerror") ||
|
||||||
/quota.?exceeded/i.test(message) ||
|
/quota.?exceeded/i.test(message) ||
|
||||||
|
/exceeded.*quota/i.test(message) ||
|
||||||
|
/usage\s*quota/i.test(message) ||
|
||||||
/subscription.*quota/i.test(message) ||
|
/subscription.*quota/i.test(message) ||
|
||||||
/insufficient.?(?:quota|balance|funds?)/i.test(message) ||
|
/insufficient.?(?:quota|balance|funds?)/i.test(message) ||
|
||||||
/billing.?(?:hard.?)?limit/i.test(message) ||
|
/billing.?(?:hard.?)?limit/i.test(message) ||
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ describe("runtime-fallback quota error regressions", () => {
|
|||||||
expect(retryable).toBe(true)
|
expect(retryable).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("classifies Volcano Engine 'exceeded the usage quota' as retryable", () => {
|
test("classifies Volcano Engine 'exceeded the usage quota' as quota_exceeded and retryable", () => {
|
||||||
//#given
|
//#given
|
||||||
const error = {
|
const error = {
|
||||||
name: "SessionRetry",
|
name: "SessionRetry",
|
||||||
@@ -65,9 +65,11 @@ describe("runtime-fallback quota error regressions", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//#when
|
//#when
|
||||||
|
const errorType = classifyErrorType(error)
|
||||||
const retryable = isRetryableError(error, [429, 500, 502, 503, 504])
|
const retryable = isRetryableError(error, [429, 500, 502, 503, 504])
|
||||||
|
|
||||||
//#then
|
//#then
|
||||||
|
expect(errorType).toBe("quota_exceeded")
|
||||||
// Volcano Engine quota errors trigger fallback to the next model
|
// Volcano Engine quota errors trigger fallback to the next model
|
||||||
expect(retryable).toBe(true)
|
expect(retryable).toBe(true)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user