1. 16 Mar, 2026 8 commits
    • erio's avatar
      fix(billing): add window expiration check to Redis rate limit Lua script · 67c05062
      erio authored
      The updateRateLimitUsageScript Lua script previously performed
      unconditional HINCRBYFLOAT on all usage counters without checking
      whether the rate limit window had expired. This caused usage to
      accumulate across window boundaries in Redis while the DB correctly
      reset on expiration, leading to incorrect 429 rate limiting that
      could persist for up to 24 hours.
      
      The Lua script now checks each window timestamp before incrementing:
      - If the window has expired, usage is reset to the current cost and
        the window timestamp is updated (matching DB-side semantics)
      - If the window is still valid, usage is accumulated normally
      
      This also resolves the async race condition where stale HINCRBYFLOAT
      tasks from the worker queue could pollute a freshly rebuilt cache
      after invalidation, since the script now self-corrects expired windows.
      
      Closes #1049
      67c05062
    • Wesley Liddick's avatar
      Merge pull request #1047 from DaydreamCoding/fix/codex-stream-isolation · 6447be45
      Wesley Liddick authored
      fix(gateway): 防止 OpenAI Codex 跨用户串流 + WS 连接池条件式 MarkBroken
      6447be45
    • 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
    • Wesley Liddick's avatar
      Merge pull request #1043 from touwaeriol/pr/antigravity-credits-overages · 474165d7
      Wesley Liddick authored
      feat: Antigravity AI Credits overages handling & balance display
      474165d7
    • Wesley Liddick's avatar
      Merge pull request #1040 from 0xObjc/codex/fix-user-spending-ranking-others · 94e067a2
      Wesley Liddick authored
      fix(admin): polish spending ranking and usage defaults
      94e067a2
    • Wesley Liddick's avatar
      Merge pull request #1036 from Ethan0x0000/feat/usage-endpoint-distribution · 4293c891
      Wesley Liddick authored
      fix: record endpoint info for all API surfaces & unify normalization via middleware
      4293c891
    • Wesley Liddick's avatar
      Merge pull request #1042 from touwaeriol/feat/unified-oauth-refresh-api · ec82c37d
      Wesley Liddick authored
      feat: unified OAuth token refresh API with distributed locking
      ec82c37d
  2. 15 Mar, 2026 32 commits