1. 20 Mar, 2026 4 commits
    • wucm667's avatar
      fix: quota display shows stale cumulative usage after daily/weekly reset · 0d45d866
      wucm667 authored
      The quota reset mechanism is lazy — quota_daily_used/quota_weekly_used
      in the database are only reset on the next IncrementQuotaUsed call.
      The scheduling layer (IsQuotaExceeded) correctly checks period expiry
      before enforcing limits, so the account remains usable. However, the
      API response mapper reads the raw DB value without checking expiry,
      causing the frontend to display cumulative usage (e.g. 110%) even
      after the reset period has passed.
      
      Add IsDailyQuotaPeriodExpired/IsWeeklyQuotaPeriodExpired methods and
      use them in the mapper to return used=0 when the period has expired.
      0d45d866
    • github-actions[bot]'s avatar
      94bba415
    • shaw's avatar
    • shaw's avatar
      feat: add max_claude_code_version setting and disable auto-upgrade env var · 01d8286b
      shaw authored
      Add maximum Claude Code version limit to complement the existing minimum
      version check. Refactor the version cache from single-value to unified
      bounds struct (min+max) with a single atomic.Value and singleflight group.
      
      - Backend: new constant, struct field, cache refactor, validation (semver
        format + cross-validation max >= min), gateway enforcement, audit diff
      - Frontend: settings UI input, TypeScript types, zh/en i18n
      - Add CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 to all Claude Code
        tutorials on /keys page (unix/cmd/powershell/vscode settings.json)
      01d8286b
  2. 19 Mar, 2026 10 commits
    • erio's avatar
      fix(antigravity): correctly mark credits exhausted on "Resource has been exhausted" 429 · 21b6f2d5
      erio authored
      shouldMarkCreditsExhausted was blocked by isURLLevelRateLimit check when
      credit overages retry returned "Resource has been exhausted (e.g. check quota).",
      causing credits to never be marked as exhausted. This led to an infinite loop
      where each request injected credits, bypassed model rate limits, and failed again.
      
      - Remove isURLLevelRateLimit guard from shouldMarkCreditsExhausted (only called
        for credit retry responses — if credits retry fails, mark exhausted)
      - Add "resource has been exhausted" to creditsExhaustedKeywords
      - Update tests to match corrected behavior
      21b6f2d5
    • erio's avatar
      fix(antigravity): fast-fail on proxy unavailable, temp-unschedule account · 528ff5d2
      erio authored
      ## Problem
      
      When a proxy is unreachable, token refresh retries up to 4 times with
      30s timeout each, causing requests to hang for ~2 minutes before
      failing with a generic 502 error. The failed account is not marked,
      so subsequent requests keep hitting it.
      
      ## Changes
      
      ### Proxy connection fast-fail
      - Set TCP dial timeout to 5s and TLS handshake timeout to 5s on
        antigravity client, so proxy connectivity issues fail within 5s
        instead of 30s
      - Reduce overall HTTP client timeout from 30s to 10s
      - Export `IsConnectionError` for service-layer use
      - Detect proxy connection errors in `RefreshToken` and return
        immediately with "proxy unavailable" error (no retries)
      
      ### Token refresh temp-unschedulable
      - Add 8s context timeout for token refresh on request path
      - Mark account as temp-unschedulable for 10min when refresh fails
        (both background `TokenRefreshService` and request-path
        `GetAccessToken`)
      - Sync temp-unschedulable state to Redis cache for immediate
        scheduler effect
      - Inject `TempUnschedCache` into `AntigravityTokenProvider`
      
      ### Account failover
      - Return `UpstreamFailoverError` on `GetAccessToken` failure in
        `Forward`/`ForwardGemini` to trigger handler-level account switch
        instead of returning 502 directly
      
      ### Proxy probe alignment
      - Apply same 5s dial/TLS timeout to shared `httpclient` pool
      - Reduce proxy probe timeout from 30s to 10s
      528ff5d2
    • QTom's avatar
      feat(admin): 用户管理新增分组列、分组筛选与专属分组一键替换 · ba7d2aec
      QTom authored
      - 新增分组列:展示用户的专属/公开分组,支持 hover 查看详情
      - 新增分组筛选:下拉选择或模糊搜索分组名过滤用户
      - 专属分组替换:点击专属分组弹出操作菜单,选择目标分组后
        自动授予新分组权限、迁移绑定的 Key、移除旧分组权限
      - 后端新增 POST /admin/users/:id/replace-group 端点,事务内
        完成分组替换并失效认证缓存
      ba7d2aec
    • Rose Ding's avatar
    • Rose Ding's avatar
      fix: Anthropic tool schema 转 Responses API 时补充缺失的 properties 字段 · 963494ec
      Rose Ding authored
      
      
      当 Claude Code 发来的 MCP tool 的 input_schema 为 {"type":"object"} 且缺少
      properties 字段时,OpenAI Codex 后端会拒绝并报错:
      Invalid schema for function '...': object schema missing properties.
      
      新增 normalizeToolParameters 函数,在 convertAnthropicToolsToResponses 中
      对每个 tool 的 InputSchema 做规范化处理后再赋给 Parameters。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      963494ec
    • shaw's avatar
      feat: Anthropic 账号被动用量采样,页面默认展示被动数据 · 525cdb88
      shaw authored
      从上游 /v1/messages 响应头被动采集 5h/7d utilization 并存储到
      Account.Extra,页面加载时直接读取本地数据而非调用外部 Usage API。
      用户可点击"查询"按钮主动拉取最新数据,主动查询结果自动回写被动缓存。
      
      后端:
      - UpdateSessionWindow 合并采集 5h + 7d headers 为单次 DB 写入
      - 新增 GetPassiveUsage 从 Extra 构建 UsageInfo (复用 estimateSetupTokenUsage)
      - GetUsage 主动查询后 syncActiveToPassive 回写被动缓存
      - passive_usage_ 前缀注册为 scheduler-neutral
      
      前端:
      - Anthropic 账号 mount/refresh 默认 source=passive
      - 新增"被动采样"标签和"查询"按钮 (带 loading 动画)
      525cdb88
    • shaw's avatar
    • Hg's avatar
      feat: add ungrouped filter to account · 8027531d
      Hg authored
      8027531d
    • QTom's avatar
    • haruka's avatar
      fix: record original upstream status code when failover exhausted (#1128) · 1fd1a58a
      haruka authored
      
      
      When all failover accounts are exhausted, handleFailoverExhausted maps
      the upstream status code (e.g. 403) to a client-facing code (e.g. 502)
      but did not write the original code to the gin context. This caused ops
      error logs to show the mapped code instead of the real upstream code.
      
      Call SetOpsUpstreamError before mapUpstreamError in all failover-
      exhausted paths so that ops_error_logger captures the true upstream
      status code and message.
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      1fd1a58a
  3. 18 Mar, 2026 14 commits
  4. 17 Mar, 2026 9 commits
    • Ethan0x0000's avatar
    • Ethan0x0000's avatar
      test(backend): add tests for upstream model tracking and model source filtering · eeff451b
      Ethan0x0000 authored
      Cover IsValidModelSource/NormalizeModelSource, resolveModelDimensionExpression SQL expressions, invalid model_source 400 responses on both GetModelStats and GetUserBreakdown, upstream_model in scan/insert SQL mock expectations, and updated passthrough/billing test signatures.
      eeff451b
    • Ethan0x0000's avatar
      feat(api): expose model_source filter in dashboard endpoints · 56fcb20f
      Ethan0x0000 authored
      Add model_source query parameter to GetModelStats and GetUserBreakdown handlers with explicit IsValidModelSource validation. Include model_source in cache key to prevent cross-source cache hits. Expose upstream_model in usage log DTO with omitempty semantics.
      56fcb20f
    • Ethan0x0000's avatar
      feat(dashboard): add model source dimension to stats queries · 7134266a
      Ethan0x0000 authored
      Support querying model statistics by 'requested', 'upstream', or 'mapping' dimension. Add resolveModelDimensionExpression for safe SQL expression generation, IsValidModelSource whitelist validator, and NormalizeModelSource fallback. Repository persists and scans upstream_model in all insert/select paths.
      7134266a
    • Ethan0x0000's avatar
      feat(service): record upstream model across all gateway paths · 2e4ac88a
      Ethan0x0000 authored
      Propagate UpstreamModel through ForwardResult and OpenAIForwardResult in Anthropic direct, API-key passthrough, Bedrock, and OpenAI gateway flows. Extract optionalNonEqualStringPtr and optionalTrimmedStringPtr into usage_log_helpers.go. Store upstream_model only when it differs from the requested model.
      
      Also introduces anthropicPassthroughForwardInput struct to reduce parameter count.
      2e4ac88a
    • Ethan0x0000's avatar
      feat(db): add upstream_model column to usage_logs · 51547fa2
      Ethan0x0000 authored
      Add nullable VARCHAR(100) column to record the actual model sent to upstream providers when model mapping is applied. NULL means no mapping — the requested model was used as-is.
      
      Includes migration, concurrent index for aggregation queries, Ent schema regeneration, and migration README correction (forward-only runner, not goose).
      51547fa2
    • laukkw's avatar
      fix(setup): align install validation and expose backend errors · aa6047c4
      laukkw authored
      Make setup password requirements consistent with backend rules and show API-provided error messages so install failures are actionable. Trim admin email before validation to avoid false invalid-email rejections from surrounding whitespace.
      aa6047c4
    • haruka's avatar
      fix(review): address Copilot PR feedback · 869952d1
      haruka authored
      
      
      - Add compile-time interface assertion for sessionWindowMockRepo
      - Fix flaky fallback test by capturing time.Now() before calling UpdateSessionWindow
      - Replace stale hardcoded timestamps with dynamic future values
      - Add millisecond detection and bounds validation for reset header timestamp
      - Use pause/resume pattern for interval in UsageProgressBar to avoid idle timers on large lists
      - Fix gofmt comment alignment
      Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
      869952d1
    • luxiang's avatar
      7e34bb94
  5. 16 Mar, 2026 3 commits