1. 13 Mar, 2026 3 commits
    • erio's avatar
      fix: restore OAuth 401 temp-unschedulable for Gemini, update Antigravity tests · 45456fa2
      erio authored
      The 403 detection PR changed the 401 handler condition from
      `account.Type == AccountTypeOAuth` to
      `account.Type == AccountTypeOAuth && account.Platform == PlatformOpenAI`,
      which accidentally excluded Gemini OAuth from the temp-unschedulable path.
      
      Fix: use `!= PlatformAntigravity` instead, preserving Gemini behavior
      while correctly excluding Antigravity (whose 401 is handled by
      applyErrorPolicy's temp_unschedulable_rules).
      
      Update tests to reflect Antigravity's new 401 semantics:
      - HandleUpstreamError: Antigravity OAuth 401 now uses SetError
      - CheckErrorPolicy: Antigravity 401 second hit stays TempUnscheduled
      - DB fallback: split into Gemini (escalates) and Antigravity (stays temp)
      45456fa2
    • erio's avatar
      feat(antigravity): add 403 forbidden status detection, classification and display · 6344fa2a
      erio authored
      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
      6344fa2a
    • haruka's avatar
      fix: 管理员重置配额补全 monthly 字段并修复 ristretto 缓存异步问题 · e73531ce
      haruka authored
      
      
      - 后端 handler:ResetSubscriptionQuotaRequest 新增 Monthly 字段,
        验证逻辑扩展为 daily/weekly/monthly 至少一项为 true
      - 后端 service:AdminResetQuota 新增 resetMonthly 参数,
        调用 ResetMonthlyUsage;重置后追加 subCacheL1.Wait(),
        保证 ristretto Del() 的异步删除立即生效,消除重置后
        /v1/usage 返回旧用量数据的竞态窗口
      - 后端测试:更新存量测试用例匹配新签名,补充
        TestAdminResetQuota_ResetMonthlyOnly /
        TestAdminResetQuota_ResetMonthlyUsageError 两个新用例
      - 前端 API:resetQuota options 类型新增 monthly: boolean
      - 前端视图:confirmResetQuota 改为同时重置 daily/weekly/monthly
      - i18n:中英文确认提示文案更新,提及每月配额
      Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
      e73531ce
  2. 12 Mar, 2026 6 commits
  3. 11 Mar, 2026 15 commits
  4. 10 Mar, 2026 7 commits
  5. 09 Mar, 2026 9 commits
    • kyx236's avatar
      fix: OpenAI临时性400错误支持池模式同账号重试 & HelpTooltip层级修复 · 5fa22fdf
      kyx236 authored
      1. 识别OpenAI "An error occurred while processing your request" 临时性400错误
         并触发failover,同时在池模式下标记RetryableOnSameAccount,允许同账号重试
      2. ForwardAsAnthropic路径同步支持临时性400错误的识别和同账号重试
      3. HelpTooltip组件使用Teleport渲染到body,修复在dialog内被裁切的问题
      5fa22fdf
    • erio's avatar
      fix: use shared max_line_size config for OpenAI Responses SSE scanner · bcaae2eb
      erio authored
      Two SSE scanners in openai_gateway_messages.go were hardcoded to 1MB
      while all other scanners use defaultMaxLineSize (500MB) with config
      override. This caused Responses API streams to fail on large payloads.
      bcaae2eb
    • ischanx's avatar
      feat: 允许管理员为持有有效订阅的用户绑定订阅类型分组 · 767a41e2
      ischanx authored
      
      
      之前管理员无法通过 API 密钥管理将用户绑定到订阅类型分组(直接返回错误)。
      现在改为检查用户是否持有该分组的有效订阅,有则允许绑定,无则拒绝。
      
      - admin_service: 新增 userSubRepo 依赖,替换硬拒绝为订阅校验
      - admin_service: 区分 ErrSubscriptionNotFound 和内部错误,避免 DB 故障被误报
      - wire_gen/api_contract_test: 同步新增参数
      - UserApiKeysModal: 管理员分组下拉不再过滤订阅类型分组
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      767a41e2
    • QTom's avatar
      feat: 支持批量重置状态和批量刷新令牌 · 252d6c53
      QTom authored
      - 提取 refreshSingleAccount 私有方法复用单账号刷新逻辑
      - 新增 BatchClearError handler (POST /admin/accounts/batch-clear-error)
      - 新增 BatchRefresh handler (POST /admin/accounts/batch-refresh)
      - 前端 AccountBulkActionsBar 添加批量重置状态/刷新令牌按钮
      - AccountsView 添加 handler 支持 partial success 反馈
      - i18n 中英文补充批量操作相关翻译
      252d6c53
    • QTom's avatar
      feat: 导入账号时 best-effort 从 id_token 提取用户信息 · 7a4e65ad
      QTom authored
      提取 DecodeIDToken(跳过过期校验)供导入场景使用,
      ParseIDToken 复用它并保留原有过期检查行为。
      导入 OpenAI/Sora OAuth 账号时自动补充缺失的 email、
      plan_type、chatgpt_account_id 等字段,不覆盖已有值。
      7a4e65ad
    • QTom's avatar
      feat: 从 OpenAI JWT 提取 chatgpt_plan_type 并在前端展示 · a582aa89
      QTom authored
      OAuth 授权和 token 刷新时从 id_token 的 OpenAI auth claim 中
      提取 chatgpt_plan_type(plus/team/pro/free),存入 credentials,
      账号管理页面 PlatformTypeBadge 显示订阅类型。
      a582aa89
    • erio's avatar
      feat: cleanup stale concurrency slots on startup · a88698f3
      erio authored
      
      
      When the service restarts, concurrency slots from the old process
      remain in Redis, causing phantom occupancy. On startup, scan all
      concurrency sorted sets and remove members with non-current process
      prefix, then clear orphaned wait queue counters.
      
      Uses Go-side SCAN to discover keys (compatible with Redis client
      prefix hooks in tests), then passes them to a Lua script for
      atomic member-level cleanup.
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      a88698f3
    • shaw's avatar
      fix: 修复gpt->claude同步请求返回sse的bug · 25178cdb
      shaw authored
      25178cdb
    • shaw's avatar
      a461538d