1. 13 Mar, 2026 2 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
  2. 08 Mar, 2026 1 commit
  3. 07 Mar, 2026 2 commits
    • kyx236's avatar
      feat(admin): 支持定时测试自动恢复并统一账号恢复入口 · 0c29468f
      kyx236 authored
      - 为定时测试计划增加 auto_recover 配置,补齐前后端类型、接口、仓储与数据库迁移
      - 在定时测试成功后自动恢复账号 error、rate-limit 等可恢复运行时状态
      - 新增 /admin/accounts/:id/recover-state 接口,合并原有重置状态与清限流操作
      - 更新账号管理菜单与定时测试面板,补充自动恢复开关、说明提示和状态展示
      - 补充账号恢复、限流清理与仓储同步相关测试
      0c29468f
    • 神乐's avatar
      0debe0a8
  4. 06 Mar, 2026 1 commit
  5. 04 Mar, 2026 2 commits
  6. 02 Mar, 2026 1 commit
    • zqq61's avatar
      fix: OAuth 401 不再永久锁死账号,改用临时不可调度实现自动恢复 · ec6bcfeb
      zqq61 authored
      OAuth 账号收到 401 时,原逻辑同时设置 expires_at=now() 和 SetError(),
      但刷新服务只查询 status=active 的账号,导致 error 状态的账号永远无法
      被刷新服务拾取,expires_at=now() 实际上是死代码。
      
      修复:
      - OAuth 401 使用 SetTempUnschedulable 替代 SetError,保持 status=active
      - 新增 oauth_401_cooldown_minutes 配置项(默认 10 分钟)
      - 刷新成功后同步清除 DB 和 Redis 中的临时不可调度状态
      - 不可重试错误检查(invalid_grant 等)从 Antigravity 推广到所有平台
      - 可重试错误耗尽后不再标记 error,下个刷新周期继续重试
      
      恢复流程:
      OAuth 401 → temp_unschedulable + expires_at=now → 刷新服务拾取
        → 成功: 清除 temp_unschedulable → 自动恢复
        → invalid_grant: SetError → 永久禁用
        → 网络错误: 仅记日志 → 下周期重试
      ec6bcfeb
  7. 28 Feb, 2026 1 commit
  8. 22 Feb, 2026 1 commit
  9. 13 Feb, 2026 1 commit
    • shaw's avatar
      fix: Anthropic 429 限流使用精确的窗口重置时间而非聚合最大值 · e6814314
      shaw authored
      当账号仅触发 5h 窗口限流时,旧逻辑从聚合头
      anthropic-ratelimit-unified-reset 读取重置时间,该值为所有窗口的
      最大值(即 7d 重置时间),导致账号被标记为不可调度约 6 天。
      
      新增 calculateAnthropic429ResetTime 函数,解析 Anthropic 的
      per-window 头(5h-utilization/reset、7d-utilization/reset、
      surpassed-threshold),判断实际触发的窗口并使用对应的重置时间:
      - 仅 5h 超标 → 使用 5h-reset(约 5 小时)
      - 仅 7d 超标 → 使用 7d-reset
      - 两者均超标 → 使用 7d-reset(较长冷却)
      - per-window 头不存在 → 回退到聚合头(向后兼容)
      e6814314
  10. 09 Feb, 2026 1 commit
  11. 08 Feb, 2026 1 commit
  12. 07 Feb, 2026 1 commit
    • erio's avatar
      feat(antigravity): comprehensive enhancements - model mapping, rate limiting, scheduling & ops · 5e98445b
      erio authored
      Key changes:
      - Upgrade model mapping: Opus 4.5 → Opus 4.6-thinking with precise matching
      - Unified rate limiting: scope-level → model-level with Redis snapshot sync
      - Load-balanced scheduling by call count with smart retry mechanism
      - Force cache billing support
      - Model identity injection in prompts with leak prevention
      - Thinking mode auto-handling (max_tokens/budget_tokens fix)
      - Frontend: whitelist mode toggle, model mapping validation, status indicators
      - Gemini session fallback with Redis Trie O(L) matching
      - Ops: enhanced concurrency monitoring, account availability, retry logic
      - Migration scripts: 049-051 for model mapping unification
      5e98445b
  13. 02 Feb, 2026 1 commit
  14. 26 Jan, 2026 1 commit
    • ianshaw's avatar
      fix(ratelimit): 修复 OpenAI usage_limit_reached 错误的重置时间解析 · a55cfebd
      ianshaw authored
      - 问题:OpenAI 的 usage_limit_reached 错误(需 37 小时重置)被错误地设置为 5 分钟
      - 原因:handle429 只检查 Anthropic 响应头,没有解析 OpenAI 响应体中的 resets_in_seconds
      - 修复:新增 parseOpenAIRateLimitResetTime 函数解析 OpenAI 响应体
      - 影响:避免调度器不断尝试已达配额上限的账户
      a55cfebd
  15. 25 Jan, 2026 1 commit
  16. 19 Jan, 2026 1 commit
  17. 18 Jan, 2026 1 commit
  18. 16 Jan, 2026 1 commit
  19. 15 Jan, 2026 4 commits
  20. 14 Jan, 2026 2 commits
    • longgexx's avatar
      fix(admin): 修复使用记录页面趋势图筛选联动和日期选择问题 · 806f402b
      longgexx authored
         修复两个问题:
         1. Token使用趋势图和模型分布图未响应筛选条件
         2. 上午时段选择今天刷新后日期回退到前一天
      
         前端修改:
         - 更新 dashboard API 类型定义,添加 model、account_id、group_id、stream 参数支持
         - 修改 UsageView 趋势图加载逻辑,传递所有筛选参数到后端
         - 修复日期格式化函数,使用本地时区避免 UTC 转换导致的日期偏移
      
         后端修改:
         - Handler 层:接收并解析所有筛选参数(model、account_id、group_id、stream)
         - Service 层:传递完整的筛选参数到 Repository 层
         - Repository 层:SQL 查询动态添加所有过滤条件
         - 更新接口定义和所有调用点以保持一致性
      
         影响范围:
         - /admin/dashboard/trend 端点现支持完整筛选
         - /admin/dashboard/models 端点现支持完整筛选
         - 用户在后台使用记录页面选择任意筛选条件时,趋势图和模型分布图会实时响应
         - 日期选择器在任何时区下都能正确保持今天的选择
      806f402b
    • yangjianbo's avatar
      fix(认证): 修复 OAuth token 缓存失效与 401 处理 · daf10907
      yangjianbo authored
      新增 token 缓存失效接口并在刷新后清理
      401 限流支持自定义规则与可配置冷却时间
      补齐缓存失效与 401 处理测试
      测试: make test
      daf10907
  21. 12 Jan, 2026 2 commits
    • ianshaw's avatar
      fix(gateway): 自定义错误码触发停止调度 · 6dcb2763
      ianshaw authored
      - 修改 HandleUpstreamError 逻辑,启用自定义错误码时所有在列表中的错误码都会停止调度
      - 添加 handleCustomErrorCode 函数处理自定义错误码的账号停用
      - 前端添加 429/529 错误码的警告提示,因为这些错误码已有内置处理机制
      - 更新 EditAccountModal、CreateAccountModal、BulkEditAccountModal 的错误码添加逻辑
      6dcb2763
    • ianshaw's avatar
      feat(gateway): 添加流超时处理机制 · 2a0758bd
      ianshaw authored
      - 添加 StreamTimeoutSettings 配置结构体和系统设置
      - 实现 TimeoutCounterCache Redis 计数器用于累计超时次数
      - 在 RateLimitService 添加 HandleStreamTimeout 方法
      - 在 gateway_service、openai_gateway_service、antigravity_gateway_service 中调用超时处理
      - 添加后端 API 端点 GET/PUT /admin/settings/stream-timeout
      - 添加前端配置界面到系统设置页面
      - 支持配置:启用开关、超时阈值、处理方式、暂停时长、触发阈值、阈值窗口
      
      默认配置:
      - 启用:true
      - 超时阈值:60秒
      - 处理方式:临时不可调度
      - 暂停时长:5分钟
      - 触发阈值:3次
      - 阈值窗口:10分钟
      2a0758bd
  22. 11 Jan, 2026 1 commit
    • IanShaw027's avatar
      feat(ops): 实现上游错误事件记录与查询功能 · 7ebca553
      IanShaw027 authored
      **新增功能**:
      - 新建ops_upstream_error_events表存储上游服务错误详情
      - 支持记录上游429/529/5xx错误的详细上下文信息
      - 提供按时间范围查询上游错误事件的API
      
      **后端改动**:
      1. 模型层(ops_models.go, ops_port.go):
         - 新增UpstreamErrorEvent结构体
         - 扩展Repository接口支持上游错误事件CRUD
      
      2. 仓储层(ops_repo.go):
         - 实现InsertUpstreamErrorEvent写入上游错误
         - 实现GetUpstreamErrorEvents按时间范围查询
      
      3. 服务层(ops_service.go, ops_upstream_context.go):
         - ops_service: 新增GetUpstreamErrorEvents查询方法
         - ops_upstream_context: 封装上游错误上下文构建逻辑
      
      4. Handler层(ops_error_logger.go):
         - 新增GetUpstreamErrorsHandler处理上游错误查询请求
      
      5. Gateway层集成:
         - antigravity_gateway_service.go: 429/529错误时记录上游事件
         - gateway_service.go: OpenAI 429/5xx错误时记录
         - gemini_messages_compat_service.go: Gemini 429/5xx错误时记录
         - openai_gateway_service.go: OpenAI 429/5xx错误时记录
         - ratelimit_service.go: 429限流错误时记录
      
      **数据记录字段**:
      - request_id: 关联ops_logs主记录
      - platform/model: 上游服务标识
      - status_code/error_message: 错误详情
      - request_headers/response_body: 调试信息(可选)
      - created_at: 错误发生时间
      7ebca553
  23. 09 Jan, 2026 2 commits
  24. 04 Jan, 2026 1 commit
    • IanShaw027's avatar
      feat(gemini): 完善 Gemini OAuth 配额系统和用量显示 · a185ad11
      IanShaw027 authored
      主要改动:
      - 后端:重构 Gemini 配额服务,支持多层级配额策略(GCP Standard/Free, Google One, AI Studio, Code Assist)
      - 后端:优化 OAuth 服务,增强 tier_id 识别和存储逻辑
      - 后端:改进用量统计服务,支持不同平台的配额查询
      - 后端:优化限流服务,增加临时解除调度状态管理
      - 前端:统一四种授权方式的用量显示格式和徽标样式
      - 前端:增强账户配额信息展示,支持多种配额类型
      - 前端:改进创建和重新授权模态框的用户体验
      - 国际化:完善中英文配额相关文案
      - 移除 CHANGELOG.md 文件
      
      测试:所有单元测试通过
      a185ad11
  25. 03 Jan, 2026 1 commit
    • ianshaw's avatar
      feat(admin): 添加临时不可调度功能 · 09da6904
      ianshaw authored
      当账号触发特定错误码和关键词匹配时,自动临时禁用调度:
      
      后端:
      - 新增 TempUnschedCache Redis 缓存层
      - RateLimitService 支持规则匹配和状态管理
      - 添加 GET/DELETE /accounts/:id/temp-unschedulable API
      - 数据库迁移添加 temp_unschedulable_until/reason 字段
      
      前端:
      - 账号状态指示器显示临时不可调度状态
      - 新增 TempUnschedStatusModal 详情弹窗
      - 创建/编辑账号时支持配置规则和预设模板
      - 完整的中英文国际化支持
      09da6904
  26. 01 Jan, 2026 2 commits
    • IanShaw027's avatar
      fix: 修复 P0 安全和并发问题 · 1d5e05b8
      IanShaw027 authored
      - 修复敏感信息泄露:移除 Drive API 完整响应体打印,只记录状态码
      - 修复并发安全问题:升级为 RWMutex,读写分离提升性能
      - 修复资源泄漏风险:使用 defer 确保 resp.Body 正确关闭
      1d5e05b8
    • IanShaw027's avatar
      refactor(frontend): 优化 Gemini 配额显示,参考 Antigravity 样式 · 81817466
      IanShaw027 authored
      - 简化标签:将 "RPD Pro/Flash" 改为 "Pro/Flash",避免文字截断
      - 添加账号类型徽章(Free/Pro/Ultra),带颜色区分
      - 添加帮助图标(?),悬停显示限流政策和官方文档链接
      - 重构显示布局:账号类型 + 两行配额(Pro/Flash)
      - 移除冗余的 AccountQuotaInfo 组件调用
      81817466
  27. 31 Dec, 2025 2 commits
  28. 26 Dec, 2025 1 commit
  29. 25 Dec, 2025 1 commit