1. 20 Mar, 2026 1 commit
  2. 19 Mar, 2026 1 commit
  3. 15 Mar, 2026 2 commits
  4. 14 Mar, 2026 1 commit
  5. 12 Mar, 2026 1 commit
  6. 09 Mar, 2026 1 commit
  7. 08 Mar, 2026 1 commit
  8. 07 Mar, 2026 2 commits
  9. 06 Mar, 2026 5 commits
  10. 05 Mar, 2026 2 commits
  11. 28 Feb, 2026 1 commit
  12. 22 Feb, 2026 1 commit
  13. 14 Feb, 2026 1 commit
  14. 12 Feb, 2026 5 commits
  15. 10 Feb, 2026 3 commits
    • 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
    • yangjianbo's avatar
      fix(handler): 修复 gjson 迁移后的请求校验语义回退 · 5d1c51a3
      yangjianbo authored
      
      
      - OpenAI handler: 添加 gjson.ValidBytes 校验 JSON 合法性;model 校验改为
        检查 gjson.String 类型而非仅判断非空(拒绝 model:123 等非法类型);stream
        字段添加 True/False 类型检查;sjson.SetBytes 返回值显式处理错误
      - Sora handler: 添加 gjson.ValidBytes 校验;model 校验同上改为类型检查;
        messages 校验从 Exists+Type==JSON 改为 IsArray+len>0(拒绝空数组和对象)
      - 补充 TestOpenAIHandler_GjsonValidation 和更新 TestSoraHandler_ValidationExtraction
        覆盖新增的边界校验场景
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      5d1c51a3
    • yangjianbo's avatar
      perf(backend): 使用 gjson/sjson 优化热路径 JSON 处理 · 58912d4a
      yangjianbo authored
      
      
      将 API 网关热路径中的 json.Unmarshal+json.Marshal 替换为 gjson 零拷贝查询和 sjson 精准写入:
      - unwrapV1InternalResponse 性能提升 22x(4009ns→182ns),内存分配减少 28.5x
      - unwrapGeminiResponse、extractGeminiUsage、estimateGeminiCountTokens、ParseGeminiRateLimitResetTime 改为接收 []byte 使用 gjson 提取
      - ParseGatewayRequest 的 model/stream/metadata/thinking/max_tokens 改用 gjson 类型安全提取
      - Handler 层(sora/openai)改用 gjson 提取字段、sjson 注入/修改字段,移除 map[string]any 中间变量
      - Sora Client 响应解析改用 gjson ForEach 遍历,减少内存分配
      - 新增约 100 个单元测试用例,所有改动函数覆盖率 >85%
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      58912d4a
  16. 07 Feb, 2026 7 commits
    • yangjianbo's avatar
      fix: 修复代码审核发现的10个问题(P0安全+P1数据一致性+P2性能优化) · 9634494b
      yangjianbo authored
      
      
      P0: OpenAI SSE 错误消息 JSON 注入 — 使用 json.Marshal 替代 fmt.Sprintf
      P1: subscription 续期包裹 Ent 事务确保原子性
      P1: CSP nonce 生成处理 crypto/rand 错误,失败降级为 unsafe-inline
      P1: singleflight 透传数据库真实错误,不再吞没为 not found
      P1: GetUserSubscriptionsWithProgress 提取 calculateProgress 消除 N+1
      P2: billing_cache/gateway_helper 迁移到 math/rand/v2 消除全局锁争用
      P2: generateRandomID 降级分支增加原子计数器防碰撞
      P2: CORS 非白名单 origin 不再设置 Allow-Headers/Methods/Max-Age
      P2: Turnstile 验证移除 VerifyCode 空值跳过条件防绕过
      P2: Redis Cluster Lua 脚本空 KEYS 添加兼容性警告注释
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      9634494b
    • yangjianbo's avatar
      fix: 修复批量更新凭证明细与缓存TTL抖动 · 4a20a2a8
      yangjianbo authored
      - BatchUpdateCredentials 返回 success/failed/results 及 success_ids/failed_ids
      
      - billing jitteredTTL 改为只减不增,确保TTL不超上界
      
      - crypto/rand 失败时随机ID降级避免 panic
      
      - OpenAI SelectAccount 失败日志去重并补充字段
      
      - 修复两处类型断言以通过 errcheck
      4a20a2a8
    • yangjianbo's avatar
      fix(audit): 第二批审计修复 — P0 生产 Bug、安全加固、性能优化、缓存一致性、代码质量 · 2588fa6a
      yangjianbo authored
      
      
      基于 backend-code-audit 审计报告,修复剩余 P0/P1/P2 共 34 项问题:
      
      P0 生产 Bug:
      - 修复 time.Since(time.Now()) 计时逻辑错误 (P0-03)
      - generateRandomID 改用 crypto/rand 替代固定索引 (P0-04)
      - IncrementQuotaUsed 重写为 Ent 原子操作消除 TOCTOU 竞态 (P0-05)
      
      安全加固:
      - gateway/openai handler 错误响应替换为泛化消息,防止内部信息泄露 (P1-14)
      - usage_log_repo dateFormat 参数改用白名单映射,防止 SQL 注入 (P1-16)
      - 默认配置安全加固:sslmode=prefer、response_headers=true、mode=release (P1-18/19, P2-15)
      
      性能优化:
      - gateway handler 循环内 defer 替换为显式 releaseWait 闭包 (P1-02)
      - group_repo/promo_code_repo Count 前 Clone 查询避免状态污染 (P1-03)
      - usage_log_repo 四个查询添加 LIMIT 10000 防止 OOM (P1-07)
      - GetBatchUsageStats 添加时间范围参数,默认最近 30 天 (P1-10)
      - ip.go CIDR 预编译为包级变量 (P1-11)
      - BatchUpdateCredentials 重构为先验证后更新 (P1-13)
      
      缓存一致性:
      - billing_cache 添加 jitteredTTL 防止缓存雪崩 (P2-10)
      - DeductUserBalance/UpdateSubscriptionUsage 错误传播修复 (P2-12)
      - UserService.UpdateBalance 成功后异步失效 billingCache (P2-13)
      
      代码质量:
      - search 截断改为按 rune 处理,支持多字节字符 (P2-01)
      - TLS Handshake 改为 HandshakeContext 支持 context 取消 (P2-07)
      - CORS 预检添加 Access-Control-Max-Age: 86400 (P2-16)
      
      测试覆盖:
      - 新增 user_service_test.go(UpdateBalance 缓存失效 6 个用例)
      - 新增 batch_update_credentials_test.go(fail-fast + 类型验证 7 个用例)
      - 新增 response_transformer_test.go、ip_test.go、usage_log_repo_unit_test.go、search_truncate_test.go
      - 集成测试:IncrementQuotaUsed 并发测试、billing_cache 错误传播测试
      - config_test.go 补充 server.mode/sslmode 默认值断言
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      2588fa6a
    • erio's avatar
      edb09370
    • 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
    • shaw's avatar
    • yangjianbo's avatar
      feat(gateway): 支持强制 Codex CLI 模式并伪装 UA · ce764bf2
      yangjianbo authored
      - Codex CLI 请求仅使用内置 instructions,不再读取 opencode 缓存/回源\n- 新增 gateway.force_codex_cli(环境变量 GATEWAY_FORCE_CODEX_CLI)\n- ForceCodexCLI=true 时转发上游强制 User-Agent=codex_cli_rs/0.0.0\n- 更新 deploy 示例配置
      ce764bf2
  17. 05 Feb, 2026 1 commit
    • 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
  18. 03 Feb, 2026 1 commit
    • 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
  19. 02 Feb, 2026 1 commit
  20. 16 Jan, 2026 2 commits
    • IanShaw027's avatar
      fix(openai): 使用 prompt_cache_key 兜底粘性会话 · ae21db77
      IanShaw027 authored
      opencode 请求不带 session_id/conversation_id,导致粘性会话失效。现在按 header 优先、prompt_cache_key 兜底生成 session hash,并补充单测验证优先级。
      ae21db77
    • song's avatar
      feat(gateway): 账户切换次数和 Antigravity 限流时间可配置 · 34d6b0a6
      song authored
      - gateway.max_account_switches: 账户切换最大次数,默认 10
      - gateway.max_account_switches_gemini: Gemini 账户切换次数,默认 3
      - gateway.antigravity_fallback_cooldown_minutes: Antigravity 429 fallback 限流时间,默认 5 分钟
      - Antigravity 429 不再重试,直接标记账户限流
      34d6b0a6