1. 12 Feb, 2026 9 commits
  2. 11 Feb, 2026 1 commit
    • yangjianbo's avatar
      fix(openai): 修复 OAuth 透传流式断开与压缩头问题 · a88bb868
      yangjianbo authored
      - 透传流式在客户端断开后继续 drain 上游并解析 usage,避免计费信息丢失
      
      - 阻断透传 accept-encoding,避免压缩响应影响 SSE/usage 解析
      
      - 阻断 proxy-authorization,避免透传代理鉴权信息
      
      - 补充回归测试:请求头阻断与断流后 usage 采集
      a88bb868
  3. 10 Feb, 2026 8 commits
    • yangjianbo's avatar
      feat(openai): 增加 OAuth 透传开关 · f1e884ce
      yangjianbo authored
      
      
      - 仅对 Codex CLI 且账号开启时走原样透传(只替换认证)
      
      - 透传模式禁用工具修正/模型替换,并旁路解析 usage 用于计费
      
      - 管理后台增加开关与文案,ops upstream error 记录 passthrough 标记
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      f1e884ce
    • yangjianbo's avatar
      perf(service): 优化重试场景 thinking 过滤性能 · 86f31247
      yangjianbo authored
      
      
      - 避免全量 Unmarshal 请求体,改为仅解析 messages 子树
      
      - 顶层 thinking 使用 sjson 直接删除,减少整体重写
      
      - content 仅在需要修改时延迟分配 new slice
      
      - 增加 FilterThinkingBlocksForRetry 基准测试
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      86f31247
    • yangjianbo's avatar
    • yangjianbo's avatar
      test(backend): 补充改动代码单元测试覆盖率至 85%+ · e4899967
      yangjianbo authored
      
      
      新增 48 个测试用例覆盖修复代码的各分支路径:
      - subscription_maintenance_queue: nil receiver/task、Stop 幂等、零值参数 (+6)
      - billing_service: CalculateCostWithConfig、错误传播、SoraImageCost 等 (+12)
      - timing_wheel_service: Schedule/ScheduleRecurring after Stop (+3)
      - sora_media_cleanup_service: nil guard、Start/Stop 各分支、timezone (+10)
      - sora_gateway_service: normalizeSoraMediaURLs、buildSoraContent 等辅助函数 (+17)
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      e4899967
    • yangjianbo's avatar
      fix(backend): 修复代码审核发现的 8 个确认问题 · 54fe3632
      yangjianbo authored
      
      
      - P0-1: subscription_maintenance_queue 使用 RWMutex 防止 channel close/send 竞态
      - P0-2: billing_service CalculateCostWithLongContext 修复被吞没的 out-range 错误
      - P1-1: timing_wheel_service Schedule/ScheduleRecurring 添加 SetTimer 错误日志
      - P1-2: sora_gateway_service StoreFromURLs 失败时降级使用原始 URL
      - P1-3: concurrency_cache 用 Pipeline 替代 Lua 脚本兼容 Redis Cluster
      - P1-6: sora_media_cleanup_service runCleanup 添加 nil cfg/storage 防护
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      54fe3632
    • shaw's avatar
    • 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
  4. 09 Feb, 2026 16 commits
    • yangjianbo's avatar
      29ca1290
    • yangjianbo's avatar
    • 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
    • yangjianbo's avatar
    • erio's avatar
    • erio's avatar
      a70d37a6
    • erio's avatar
      fix: skip rate limiting when custom error codes don't match upstream status · 6892e84a
      erio authored
      Add ShouldHandleErrorCode guard at the entry of handleGeminiUpstreamError
      and AntigravityGatewayService.handleUpstreamError so that accounts with
      custom error codes (e.g. [599]) are not rate-limited when the upstream
      returns a non-matching status (e.g. 429).
      6892e84a
    • erio's avatar
      feat: ErrorPolicySkipped returns 500 instead of upstream status code · 73f45574
      erio authored
      When custom error codes are enabled and the upstream error code is NOT
      in the configured list, return HTTP 500 to the client instead of
      transparently forwarding the original status code.
      
      Also adds integration test TestCustomErrorCode599 verifying that 429,
      500, 503, 401, 403 all return 500 without triggering SetRateLimited
      or SetError.
      73f45574
    • 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
      04cedce9
    • QTom's avatar
      feat(admin): 新增 CRS 同步预览和账号选择功能 · 5e0d7894
      QTom authored
      - 后端新增 PreviewFromCRS 接口,允许用户先预览 CRS 中的账号
      - 后端支持在同步时选择特定账号,不选中的账号将被跳过
      - 前端重构 SyncFromCrsModal 为三步向导:输入凭据 → 预览账号 → 执行同步
      - 改进表单无障碍性:添加 for/id 关联和 required 属性
      - 修复 Back 按钮返回时的状态清理
      - 新增 buildSelectedSet 和 shouldCreateAccount 的单元测试
      - 完整的向后兼容性:旧客户端不发送 selected_account_ids 时行为不变
      5e0d7894
    • yangjianbo's avatar
      fix: 修复代码审核发现的安全和质量问题 · d7011163
      yangjianbo authored
      
      
      安全修复(P0):
      - 移除硬编码的 OAuth client_secret(Antigravity、Gemini CLI),
        改为通过环境变量注入(ANTIGRAVITY_OAUTH_CLIENT_SECRET、
        GEMINI_CLI_OAUTH_CLIENT_SECRET)
      - 新增 logredact.RedactText() 对非结构化文本做敏感信息脱敏,
        覆盖 GOCSPX-*/AIza* 令牌和常见 key=value 模式
      - 日志中不再打印 org_uuid、account_uuid、email_address 等敏感值
      
      安全修复(P1):
      - URL 验证增强:新增 ValidateHTTPURL 统一入口,支持 allowlist 和
        私网地址阻断(localhost/内网 IP)
      - 代理回退安全:代理初始化失败时默认阻止直连回退,防止 IP 泄露,
        可通过 security.proxy_fallback.allow_direct_on_error 显式开启
      - Gemini OAuth 配置校验:client_id 与 client_secret 必须同时
        设置或同时留空
      
      其他改进:
      - 新增 tools/secret_scan.py 密钥扫描工具和 Makefile secret-scan 目标
      - 更新所有 docker-compose 和部署配置,传递 OAuth secret 环境变量
      - google_one OAuth 类型使用固定 redirectURI,与 code_assist 对齐
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      d7011163
    • yangjianbo's avatar
      test: 删除CI工作流,大幅提升后端单元测试覆盖率至50%+ · fc8a39e0
      yangjianbo authored
      
      
      删除因GitHub计费锁定而失败的CI工作流。
      为6个核心Go源文件补充单元测试,全部达到50%以上覆盖率:
      - response/response.go: 97.6%
      - antigravity/oauth.go: 90.1%
      - antigravity/client.go: 88.6% (新增27个HTTP客户端测试)
      - geminicli/oauth.go: 91.8%
      - service/oauth_service.go: 61.2%
      - service/gemini_oauth_service.go: 51.9%
      
      新增/增强8个测试文件,共计5600+行测试代码。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      fc8a39e0
    • erio's avatar
      fix: resolve CI failures from scope removal refactor · 9a479d1b
      erio authored
      - Fix gofmt alignment in ops_realtime_models.go
      - Remove SetAntigravityQuotaScopeLimit mock from api_contract_test.go
      - Add UpdateSortOrders mock to mockGroupRepoForGateway
      9a479d1b
    • 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
  5. 08 Feb, 2026 6 commits