1. 19 Mar, 2026 1 commit
  2. 16 Mar, 2026 1 commit
  3. 15 Mar, 2026 2 commits
  4. 13 Mar, 2026 1 commit
    • 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
  5. 12 Mar, 2026 1 commit
    • kunish's avatar
      fix: remove SSE termination marker from DefaultStopSequences · cdb64b0d
      kunish authored
      The SSE stream termination marker string was incorrectly included in
      DefaultStopSequences, causing Gemini to prematurely stop generating
      output whenever the model produced text containing that marker.
      
      The SSE-level protocol filtering in stream_transformer.go already
      handles this marker correctly; it should not be a stop sequence for
      the model's text generation.
      cdb64b0d
  6. 11 Mar, 2026 1 commit
  7. 09 Mar, 2026 2 commits
  8. 06 Mar, 2026 1 commit
  9. 03 Mar, 2026 1 commit
    • shaw's avatar
      fix: 恢复 PR #682 中被误替换为占位符的 OAuth client_secret · 0fe09f1d
      shaw authored
      PR #682 (release → main 全量同步) 将 Antigravity 和 Gemini CLI 的
      OAuth client_secret 硬编码值替换为了 "GOCSPX-your-client-secret" 占位符,
      导致未配置环境变量的部署环境中 token 刷新失败。
      
      恢复内容:
      - antigravity/oauth.go: 恢复真实 client_secret
      - antigravity/oauth_test.go: 恢复测试断言中的真实值
      - geminicli/constants.go: 恢复真实 client_secret
      0fe09f1d
  10. 02 Mar, 2026 1 commit
    • QTom's avatar
      feat(proxy): 集中代理 URL 验证并实现全局 fail-fast · fdcbf7aa
      QTom authored
      提取 proxyurl.Parse() 公共包,将分散在 6 处的代理 URL 验证逻辑
      统一收敛,确保无效代理配置在创建时立即失败,永不静默回退直连。
      
      主要变更:
      - 新增 proxyurl 包:统一 TrimSpace → url.Parse → Host 校验 → Scheme 白名单
      - socks5:// 自动升级为 socks5h://,防止 DNS 泄漏(大小写不敏感)
      - antigravity: http.ProxyURL → proxyutil.ConfigureTransportProxy 支持 SOCKS5
      - openai_oauth: 删除 newOpenAIOAuthHTTPClient,收编至 httpclient.GetClient
      - 移除未使用的 ProxyStrict 字段(fail-fast 已是全局默认行为)
      - 补充 15 个 proxyurl 测试 + pricing/usage fail-fast 测试
      fdcbf7aa
  11. 28 Feb, 2026 1 commit
  12. 27 Feb, 2026 1 commit
  13. 26 Feb, 2026 1 commit
  14. 25 Feb, 2026 2 commits
  15. 24 Feb, 2026 7 commits
  16. 23 Feb, 2026 1 commit
  17. 11 Feb, 2026 4 commits
    • sususu98's avatar
      fix: include Gemini thoughtsTokenCount in output token billing · d21d70a5
      sususu98 authored
      Gemini 2.5 Pro/Flash thinking models return thoughtsTokenCount separately
      from candidatesTokenCount in usageMetadata, but this field was not parsed
      or included in billing calculations, causing thinking tokens to be
      unbilled.
      
      - Add ThoughtsTokenCount field to GeminiUsageMetadata struct
      - Include thoughtsTokenCount in OutputTokens across all 3 Gemini usage
        parsing paths (non-streaming, streaming, compat layer)
      - Add tests covering thinking token scenarios
      
      Closes #554
      d21d70a5
    • Edric Li's avatar
      feat(antigravity): 添加 onboardUser 支持并修复 project_id 补齐逻辑 · a4a46a86
      Edric Li authored
      - 新增 OnboardUser API 客户端方法,支持账号 onboarding 获取 project_id
      - loadProjectIDWithRetry 增加 onboard 回退:LoadCodeAssist 未返回 project_id 时自动触发 onboarding
      - GetAccessToken 中 project_id 补齐改用轻量 FillProjectID 替代全量 RefreshAccountToken
      - 补齐逻辑增加 5 分钟冷却机制,防止频繁重试
      - OnboardUser 轮询等待改为 context 感知,支持提前取消
      - 提取 mergeCredentials 辅助方法消除重复代码
      - 新增 extractProjectIDFromOnboardResponse 和 resolveDefaultTierID 单元测试
      a4a46a86
    • SilentFlower's avatar
      [UPDATE] 优化思考预算逻辑与代码结构 · 6ae82e04
      SilentFlower authored
      🧠 refactor(antigravity): 完善 thinking 预算分配策略并重构工具构建逻辑
      6ae82e04
    • SilentFlower's avatar
      [UPDATE] 增强 Claude Thinking 模式支持与 Opus 4.6 动态预算适配 · 19cca11e
      SilentFlower authored
       feat(antigravity): 支持 thinking adaptive 类型并适配 Opus 4.6 动态预算
      🧪 test(gateway): 增加 thinking 模式解析与签名块过滤的边界用例测试
      19cca11e
  18. 10 Feb, 2026 1 commit
  19. 09 Feb, 2026 2 commits
    • 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
  20. 07 Feb, 2026 6 commits
    • yangjianbo's avatar
      test: 为代码审核修复添加详细单元测试(7个测试文件,50+测试用例) · 00caf0bc
      yangjianbo authored
      
      
      新增测试文件:
      - cors_test.go: CORS 条件化头部测试(12个测试,覆盖白名单/黑名单/通配符/凭证/多源/Vary)
      - gateway_helper_backoff_test.go: nextBackoff 退避测试(6个测试+基准,验证指数增长/边界/抖动/收敛)
      - billing_cache_jitter_test.go: jitteredTTL 抖动测试(5个测试+基准,验证范围/上界/方差/均值)
      - subscription_calculate_progress_test.go: calculateProgress 纯函数测试(9个测试,覆盖日/周/月限额/超限截断/过期)
      - openai_gateway_handler_test.go: SSE JSON 转义测试(7个子用例,验证双引号/反斜杠/换行符安全)
      
      更新测试文件:
      - response_transformer_test.go: 增强 generateRandomID 测试(7个测试,含并发/字符集/降级计数器)
      - security_headers_test.go: 适配 GenerateNonce 新签名
      - api_key_auth_test.go: 适配 NewSubscriptionService 新参数
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      00caf0bc
    • 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
      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
    • erio's avatar
      fix(antigravity): auto-fix max_tokens <= budget_tokens causing 400 error · 49233ec2
      erio authored
      When extended thinking is enabled, Claude API requires max_tokens >
      thinking.budget_tokens. If misconfigured, this auto-adjusts max_tokens
      to budget_tokens + 1000 instead of returning a 400 error.
      
      - Add ensureMaxTokensGreaterThanBudget helper function
      - Extract Gemini25FlashThinkingBudgetLimit constant (24576)
      - Log adjustment for debugging
      49233ec2
  21. 03 Feb, 2026 2 commits
    • liuxiongfeng's avatar
      fix(gemini): 导出 DummyThoughtSignature 常量并修复跨账号签名验证 · 6baf8108
      liuxiongfeng authored
      - 将 dummyThoughtSignature 改为导出的 DummyThoughtSignature 常量,供跨包使用
      - 修改 gemini_native_signature_cleaner.go 将删除签名改为替换为 dummy 签名
        这样可以跳过 Gemini 3 的签名验证,解决粘性会话切换账号时的验证失败问题
      - 更新相关测试文件
      
      Fixes: 粘性会话切换账号时 thoughtSignature 验证失败导致 400 错误
      6baf8108
    • song's avatar
      chore: gofmt · f1aafbc0
      song authored
      f1aafbc0