f3f72fc96f
- 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.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* Runtime Fallback Hook - Constants
|
|
*
|
|
* Default values and configuration constants for the runtime fallback feature.
|
|
*/
|
|
|
|
import type { RuntimeFallbackConfig } from "../../config"
|
|
|
|
/**
|
|
* Default configuration values for runtime fallback
|
|
*/
|
|
export const DEFAULT_CONFIG: Required<RuntimeFallbackConfig> = {
|
|
enabled: false,
|
|
retry_on_errors: [429, 500, 502, 503, 504],
|
|
max_fallback_attempts: 3,
|
|
cooldown_seconds: 60,
|
|
timeout_seconds: 30,
|
|
notify_on_fallback: true,
|
|
}
|
|
|
|
/**
|
|
* Error patterns that indicate rate limiting or temporary failures
|
|
* These are checked in addition to HTTP status codes
|
|
*/
|
|
export const RETRYABLE_ERROR_PATTERNS = [
|
|
/rate.?limit/i,
|
|
/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,
|
|
/model.{0,20}?not.{0,10}?supported/i,
|
|
/model_not_supported/i,
|
|
/service.?unavailable/i,
|
|
/overloaded/i,
|
|
/temporarily.?unavailable/i,
|
|
/try.?again/i,
|
|
/(?:^|\s)429(?:\s|$)/,
|
|
/(?:^|\s)503(?:\s|$)/,
|
|
/(?:^|\s)529(?:\s|$)/,
|
|
]
|
|
|
|
/**
|
|
* Hook name for identification and logging
|
|
*/
|
|
export const HOOK_NAME = "runtime-fallback"
|