1. 10 Feb, 2026 3 commits
    • Tian's avatar
      feat(antigravity): 支持 Refresh Token 批量导入创建 OAuth 账号 · c8f87a9c
      Tian authored
      后端新增 ValidateRefreshToken service 方法和 POST /oauth/refresh-token 端点,
      前端新增 API/Composable/UI 集成,OAuthAuthorizationFlow i18n 动态化,
      支持在 Antigravity 创建账号时批量粘贴 Refresh Token 自动验证并创建账号。
      c8f87a9c
    • Edric Li's avatar
      fix: 修复错误透传规则 skip_monitoring 未生效的问题 · 2d4236f7
      Edric Li authored
      - ops_error_logger: status < 400 分支增加 OpsSkipPassthroughKey 检查
      - ops_upstream_context: 新增 checkSkipMonitoringForUpstreamEvent,中间重试/故障转移事件也能触发跳过标记
      - gateway_handler/openai_gateway_handler/gemini_v1beta_handler: handleFailoverExhausted 匹配规则后设置 OpsSkipPassthroughKey
      - antigravity_gateway_service: writeMappedClaudeError 增加 applyErrorPassthroughRule 调用
      2d4236f7
    • Edric Li's avatar
      feat: 错误透传规则支持 skip_monitoring 跳过运维监控记录 · d95e04fd
      Edric Li authored
      在每条错误透传规则上新增 skip_monitoring 选项,开启后匹配该规则的错误
      不会被记录到 ops_error_logs,减少监控噪音。默认关闭,不影响现有规则。
      d95e04fd
  2. 09 Feb, 2026 6 commits
    • Edric Li's avatar
      feat: same-account retry before failover for transient errors · d6c2921f
      Edric Li authored
      For retryable transient errors (Google 400 "invalid project resource name"
      and empty stream responses), retry on the same account up to 2 times
      (with 500ms delay) before switching to another account.
      
      - Add RetryableOnSameAccount field to UpstreamFailoverError
      - Add same-account retry loop in both Gemini and Claude/OpenAI handler paths
      - Move temp-unschedule from service layer to handler layer (only after
        all same-account retries exhausted)
      - Reduce temp-unschedule cooldown from 30 minutes to 1 minute
      d6c2921f
    • Rose Ding's avatar
      test: 添加单账号 503 退避重试机制的单元测试 · e4bc3515
      Rose Ding authored
      
      
      覆盖 Service 层和 Handler 层的所有新增逻辑:
      - isSingleAccountRetry context 标记检查
      - handleSmartRetry 中 503 + SingleAccountRetry 分支
      - handleSingleAccountRetryInPlace 原地重试逻辑
      - antigravityRetryLoop 预检查跳过限流
      - sleepAntigravitySingleAccountBackoff 固定延迟退避
      - 端到端集成场景验证
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      e4bc3515
    • Rose Ding's avatar
      fix: 单账号分组首次 503 不设模型限流标记,避免后续请求雪崩 · 021abfca
      Rose Ding authored
      单账号 antigravity 分组收到 503 (MODEL_CAPACITY_EXHAUSTED) 时,
      原逻辑会设置 ~29s 模型限流标记。由于只有一个账号无法切换,
      后续所有新请求在预检查时命中限流 → 几毫秒内直接返回 503,
      导致约 30 秒的雪崩窗口。
      
      修复:在 Handler 入口处检查分组是否只有单个 antigravity 账号,
      如果是则提前设置 SingleAccountRetry context 标记,让 Service 层
      首次 503 就走原地重试逻辑(不设限流标记),避免污染后续请求。
      021abfca
    • Rose Ding's avatar
      feat: 添加 Antigravity 单账号 503 退避重试机制 · f6cfab99
      Rose Ding authored
      当分组内只有一个可用账号且上游返回 503 (MODEL_CAPACITY_EXHAUSTED) 时,
      不再设置模型限流+切换账号(因为切换回来还是同一个账号),而是在 Service 层
      原地等待+重试,避免双重等待问题。
      
      主要变更:
      - Handler 层:检测单账号 503 场景,清除排除列表并设置 SingleAccountRetry 标记
      - Service 层:新增 handleSingleAccountRetryInPlace 原地重试逻辑
      - Service 层:预检查跳过单账号模式下的限流检查
      - 新增 ctxkey.SingleAccountRetry 上下文标记
      f6cfab99
    • QTom's avatar
      feat(admin): 新增 CRS 同步预览和账号选择功能 · 5e0d7894
      QTom authored
      - 后端新增 PreviewFromCRS 接口,允许用户先预览 CRS 中的账号
      - 后端支持在同步时选择特定账号,不选中的账号将被跳过
      - 前端重构 SyncFromCrsModal 为三步向导:输入凭据 → 预览账号 → 执行同步
      - 改进表单无障碍性:添加 for/id 关联和 required 属性
      - 修复 Back 按钮返回时的状态清理
      - 新增 buildSelectedSet 和 shouldCreateAccount 的单元测试
      - 完整的向后兼容性:旧客户端不发送 selected_account_ids 时行为不变
      5e0d7894
    • erio's avatar
      refactor: replace scope-level rate limiting with model-level rate limiting · fc095bf0
      erio authored
      Merge functional changes from develop branch:
      - Remove AntigravityQuotaScope system (claude/gemini_text/gemini_image)
      - Replace with per-model rate limiting using resolveAntigravityModelKey
      - Remove model load statistics (IncrModelCallCount/GetModelLoadBatch)
      - Simplify account selection to unified priority→load→LRU algorithm
      - Remove SetAntigravityQuotaScopeLimit from AccountRepository
      - Clean up scope-related UI indicators and API fields
      fc095bf0
  3. 08 Feb, 2026 9 commits
    • erio's avatar
      b889d501
    • erio's avatar
    • erio's avatar
    • erio's avatar
      fix: parse Gemini native request format in ParseGatewayRequest for correct session hash generation · 35598d56
      erio authored
      ParseGatewayRequest only parsed Anthropic format (system/messages),
      ignoring Gemini native format (systemInstruction/contents). This caused
      GenerateSessionHash to produce identical hashes for all Gemini sessions.
      
      Add protocol parameter to ParseGatewayRequest to branch between
      Anthropic and Gemini parsing. Update GenerateSessionHash message
      traversal to extract text from both formats.
      35598d56
    • erio's avatar
      fix: prevent sessionHash collision for different users with same messages · 5c76b9e4
      erio authored
      Mix SessionContext (ClientIP, UserAgent, APIKeyID) into
      GenerateSessionHash 3rd-level fallback to differentiate requests
      from different users sending identical content.
      
      Also switch hashContent from SHA256-truncated to XXHash64 for
      better performance, and optimize Trie Lua script to match from
      longest prefix first.
      5c76b9e4
    • erio's avatar
      fix: clean thoughtSignature for all clients, not just CLI · 0b8fea4c
      erio authored
      Previously, thoughtSignature cleanup only applied to Gemini CLI
      requests (detected via x-gemini-api-privileged-user-id header or
      tmp dir pattern). This caused 400 errors for non-CLI clients when
      session cache expired and they sent stale signatures.
      
      Remove the isGeminiCLIRequest guard so all clients benefit from
      proactive thoughtSignature cleanup on session binding miss.
      0b8fea4c
    • bayma888's avatar
      feat(admin): add drag-and-drop group sort order · bac9e2bf
      bayma888 authored
      - Add `sort_order` field to groups table with migration
      - Add `PUT /api/v1/admin/groups/sort-order` API for batch update
      - Implement drag-and-drop UI using vue-draggable-plus
      - All queries now order groups by sort_order
      - Add i18n support (en/zh) for sort-related UI text
      - Update test stubs to satisfy new interface methods
      bac9e2bf
    • shaw's avatar
      feat(ui): 用户列表页显示当前并发数 · e4d74ae1
      shaw authored
      优化 /admin/users 页面的并发数列,显示「当前/最大」格式,
      参考 AccountCapacityCell 的设计风格。
      
      - 后端 UserHandler 注入 ConcurrencyService,批量查询用户当前并发数
      - 新增 UserConcurrencyCell 组件,支持颜色状态(空闲灰/使用中黄/满载红)
      - 前端 AdminUser 类型添加 current_concurrency 字段
      e4d74ae1
    • erio's avatar
      refactor(upstream): replace upstream account type with apikey, auto-append /antigravity · fb58560d
      erio authored
      Upstream accounts now use the standard APIKey type instead of a dedicated
      upstream type. GetBaseURL() and new GetGeminiBaseURL() automatically append
      /antigravity for Antigravity platform APIKey accounts, eliminating the need
      for separate upstream forwarding methods.
      
      - Remove ForwardUpstream, ForwardUpstreamGemini, testUpstreamConnection
      - Remove upstream branch guards in Forward/ForwardGemini/TestConnection
      - Add migration 052 to convert existing upstream accounts to apikey
      - Update frontend CreateAccountModal to create apikey type
      - Add unit tests for GetBaseURL and GetGeminiBaseURL
      fb58560d
  4. 07 Feb, 2026 7 commits
  5. 05 Feb, 2026 10 commits
    • shaw's avatar
      feat: 新增全局错误透传规则功能 · 39e05a2d
      shaw authored
      支持管理员配置上游错误如何返回给客户端:
      - 新增 ErrorPassthroughRule 数据模型和 Ent Schema
      - 实现规则的 CRUD API(/admin/error-passthrough-rules)
      - 支持按错误码、关键词匹配,支持 any/all 匹配模式
      - 支持按平台过滤(anthropic/openai/gemini/antigravity)
      - 支持透传或自定义响应状态码和错误消息
      - 实现两级缓存(Redis + 本地内存)和多实例同步
      - 集成到 gateway_handler 的错误处理流程
      - 新增前端管理界面组件
      - 新增单元测试覆盖核心匹配逻辑
      
      优化:
      - 移除 refreshLocalCache 中的冗余排序(数据库已排序)
      - 后端 Validate() 增加匹配条件非空校验
      39e05a2d
    • LLLLLLiulei's avatar
      fix: remove unused listAllAccounts · 029994a8
      LLLLLLiulei authored
      029994a8
    • LLLLLLiulei's avatar
      fix: harden import/export flow · 37047919
      LLLLLLiulei authored
      37047919
    • LLLLLLiulei's avatar
      perf: batch fetch proxies for account export · 0b45d48e
      LLLLLLiulei authored
      0b45d48e
    • LLLLLLiulei's avatar
      feat: refine proxy export and toolbar layout · 0c660f83
      LLLLLLiulei authored
      0c660f83
    • LLLLLLiulei's avatar
      feat: add proxy import flow · ce9a247a
      LLLLLLiulei authored
      ce9a247a
    • LLLLLLiulei's avatar
      feat: add data import/export bundle · b4bd46d0
      LLLLLLiulei authored
      b4bd46d0
    • shaw's avatar
      feat: 支持用户专属分组倍率配置 · 2b192f7d
      shaw authored
      2b192f7d
    • shaw's avatar
      feat(auth): 实现 Refresh Token 机制 · 49a3c437
      shaw authored
      - 新增 Access Token + Refresh Token 双令牌认证
      - 支持 Token 自动刷新和轮转
      - 添加登出和撤销所有会话接口
      - 前端实现无感刷新和主动刷新定时器
      49a3c437
    • JIA-ss's avatar
      feat(gateway): filter /v1/usage stats by API Key instead of UserID · fa3ea5ee
      JIA-ss authored
      
      
      Previously the /v1/usage endpoint aggregated usage stats (today/total
      tokens, cost, RPM/TPM) across all API Keys belonging to the user.
      This made it impossible to distinguish usage from different API Keys
      (e.g. balance vs subscription keys).
      
      Now the usage stats are filtered by the current request's API Key ID,
      so each key only sees its own usage data. The balance/remaining fields
      are unaffected and still reflect the user-level wallet balance.
      
      Changes:
      - Add GetAPIKeyDashboardStats to repository interface and implementation
      - Add getPerformanceStatsByAPIKey helper (also fixes TPM to include
        cache_creation_tokens and cache_read_tokens)
      - Add GetAPIKeyDashboardStats to UsageService
      - Update Usage handler to call GetAPIKeyDashboardStats(apiKey.ID)
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      fa3ea5ee
  6. 03 Feb, 2026 5 commits
    • shaw's avatar
      chore: fix gofmt formatting · df1c2383
      shaw authored
      df1c2383
    • bayma888's avatar
      fix(test): add IncrementQuotaUsed to all APIKeyRepository test stubs · be7bc658
      bayma888 authored
      - Add missing IncrementQuotaUsed method to stubApiKeyRepo in api_contract_test.go
      - Fix gofmt formatting issues in api_key_service.go, dto/types.go, api_key_handler.go
      be7bc658
    • bayma888's avatar
      feat(api-key): add independent quota and expiration support · 6146be14
      bayma888 authored
      This feature allows API Keys to have their own quota limits and expiration
      times, independent of the user's balance.
      
      Backend:
      - Add quota, quota_used, expires_at fields to api_key schema
      - Implement IsExpired() and IsQuotaExhausted() checks in middleware
      - Add ResetQuota and ClearExpiration API endpoints
      - Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini)
      - Include quota/expiration fields in auth cache for performance
      - Expiration check returns 403, quota exhausted returns 429
      
      Frontend:
      - Add quota and expiration inputs to key create/edit dialog
      - Add quick-select buttons for expiration (+7, +30, +90 days)
      - Add reset quota confirmation dialog
      - Add expires_at column to keys list
      - Add i18n translations for new features (en/zh)
      
      Migration:
      - Add 045_add_api_key_quota.sql for new columns
      6146be14
    • bayma888's avatar
      fix(test): add missing stub methods for RedeemCodeRepository and AdminService · d008941c
      bayma888 authored
      Add ListByUserPaginated and SumPositiveBalanceByUser to redeemRepoStub
      Add GetUserBalanceHistory to stubAdminService
      
      Fixes CI test compilation errors
      d008941c
    • song's avatar
      chore: gofmt · f1aafbc0
      song authored
      f1aafbc0