1. 16 Mar, 2026 8 commits
    • Elysia's avatar
      fix(oauth): extract system-role input items into instructions field · fa2e6188
      Elysia authored
      
      
      OAuth upstreams (ChatGPT) reject requests containing role:"system" in
      the input array with HTTP 400 "System messages are not allowed". Extract
      such items before forwarding and merge their content into the top-level
      instructions field, prepending to any existing value.
      Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
      fa2e6188
    • Ethan0x0000's avatar
    • QTom's avatar
      feat(backup): 备份/恢复异步化,解决 504 超时 · c1fab7f8
      QTom authored
      
      
      POST /backups 和 POST /backups/:id/restore 改为异步:立即返回 HTTP 202,
      后台 goroutine 独立执行 pg_dump → gzip → S3 上传,前端每 2s 轮询状态。
      
      后端:
      - 新增 StartBackup/StartRestore 方法,后台 goroutine 不依赖 HTTP 连接
      - Graceful shutdown 等待活跃操作完成,启动时清理孤立 running 记录
      - BackupRecord 新增 progress/restore_status 字段支持进度和恢复状态追踪
      
      前端:
      - 创建备份/恢复后轮询 GET /backups/:id 直到完成或失败
      - 标签页切换暂停/恢复轮询,组件卸载清理定时器
      - 正确处理 409(备份进行中)和轮询超时
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      c1fab7f8
    • kunish's avatar
      fix(antigravity): add stream keepalive to prevent connection drops · d7957343
      kunish authored
      Antigravity streaming handlers were missing the keepalive mechanism
      that exists in the standard gateway, causing proxy/CDN idle timeouts
      to break connections during long thinking phases (e.g. claude-opus-4-6).
      This resulted in truncated responses with missing tool calls.
      
      Add StreamKeepaliveInterval support to all three Antigravity streaming
      paths: Claude SSE, Gemini SSE, and upstream passthrough.
      d7957343
    • Ethan0x0000's avatar
      fix: always attach OpenAI 5h/7d window stats regardless of zero values · fa782e70
      Ethan0x0000 authored
      Removes hasMeaningfulWindowStats guard so the /usage endpoint consistently
      returns WindowStats for both time windows. The frontend now controls
      zero-value display filtering at the component level.
      fa782e70
    • Ethan0x0000's avatar
      fix: allow empty extra payload to clear account quota limits · afd72abc
      Ethan0x0000 authored
      UpdateAccount previously required len(input.Extra) > 0, causing explicit
      empty payloads (extra:{}) to be silently skipped. Change condition to
      input.Extra != nil so clearing quota keys actually persists.
      afd72abc
    • QTom's avatar
      fix(gateway): WS 连接池条件式 MarkBroken 防止跨请求串流 · 3741617e
      QTom authored
      正常终端事件(response.completed 等)退出后连接归还复用,
      仅异常路径(读写错误、error 事件、客户端断连)MarkBroken 销毁。
      
      Generate 模式:
      - 引入 cleanExit 标记,仅在 isTerminalEvent break 时设置 true
      - defer 中根据 cleanExit 决定是否 MarkBroken
      - 所有异常路径已在各自分支中提前调用 MarkBroken
      
      Ingress 模式:
      - 引入 lastTurnClean 标记,sendAndRelay 正常完成时设为 true
      - releaseSessionLease 根据 lastTurnClean 决定是否 MarkBroken
      - 错误路径重置 lastTurnClean = false
      - 客户端断连后 drain 仍保守 MarkBroken(L2916)
      3741617e
    • QTom's avatar
      fix(gateway): 防止 OpenAI Codex 跨用户串流 · ab4e8b2c
      QTom authored
      根因:多个用户共享同一 OAuth 账号时,conversation_id/session_id 头
      未做用户隔离,导致上游 chatgpt.com 将不同用户的请求关联到同一会话。
      
      HTTP SSE 修复:
      - 新增 isolateOpenAISessionID(apiKeyID, raw),将 API Key ID 混入
        session 标识符(xxhash),确保不同 Key 的用户产生不同上游会话
      - buildUpstreamRequest: OAuth 分支先 Del 客户端透传的 session 头,
        再用隔离值覆盖
      - buildUpstreamRequestOpenAIPassthrough: 透传路径同样隔离
      - ForwardAsAnthropic: Anthropic Messages 兼容路径同步修复
      - buildOpenAIWSHeaders: WS 路径的 OAuth session 头同步隔离
      ab4e8b2c
  2. 15 Mar, 2026 16 commits
  3. 14 Mar, 2026 10 commits
  4. 13 Mar, 2026 6 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
    • Ylarod's avatar
      fix lint · e90ec847
      Ylarod authored
      e90ec847
    • 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
    • Peter's avatar
      feat(ops): allow hiding alert events · 29b0e4a8
      Peter authored
      29b0e4a8
    • Ylarod's avatar
      sub2api: add bedrock support · 11f7b835
      Ylarod authored
      11f7b835
    • Rose Ding's avatar