feat(antigravity): add 403 forbidden status detection, classification and display
Backend: - Detect and classify 403 responses into three types: validation (account needs Google verification), violation (terms of service / banned), forbidden (generic 403) - Extract verification/appeal URLs from 403 response body (structured JSON parsing with regex fallback) - Add needs_verify, is_banned, needs_reauth, error_code fields to UsageInfo (omitempty for zero impact on other platforms) - Handle 403 in request path: classify and permanently set account error - Save validation_url in error_message for degraded path recovery - Enrich usage with account error on both success and degraded paths - Add singleflight dedup for usage requests with independent context - Differentiate cache TTL: success/403 → 3min, errors → 1min - Return degraded UsageInfo instead of HTTP 500 on quota fetch errors Frontend: - Display forbidden status badges with color coding (red for banned, amber for needs verification, gray for generic) - Show clickable verification/appeal URL links - Display needs_reauth and degraded error states in usage cell - Add Antigravity tier label badge next to platform type Tests: - Comprehensive unit tests for classifyForbiddenType (7 cases) - Unit tests for extractValidationURL (8 cases including unicode escapes) - Integration test for FetchQuota forbidden path
This commit is contained in:
@@ -769,6 +769,21 @@ export interface AccountUsageInfo {
|
||||
gemini_pro_minute?: UsageProgress | null
|
||||
gemini_flash_minute?: UsageProgress | null
|
||||
antigravity_quota?: Record<string, AntigravityModelQuota> | null
|
||||
// Antigravity 403 forbidden 状态
|
||||
is_forbidden?: boolean
|
||||
forbidden_reason?: string
|
||||
forbidden_type?: string // "validation" | "violation" | "forbidden"
|
||||
validation_url?: string // 验证/申诉链接
|
||||
|
||||
// 状态标记(后端自动推导)
|
||||
needs_verify?: boolean // 需要人工验证(forbidden_type=validation)
|
||||
is_banned?: boolean // 账号被封(forbidden_type=violation)
|
||||
needs_reauth?: boolean // token 失效需重新授权(401)
|
||||
|
||||
// 机器可读错误码:forbidden / unauthenticated / rate_limited / network_error
|
||||
error_code?: string
|
||||
|
||||
error?: string // usage 获取失败时的错误信息
|
||||
}
|
||||
|
||||
// OpenAI Codex usage snapshot (from response headers)
|
||||
|
||||
Reference in New Issue
Block a user