1. 14 Feb, 2026 1 commit
  2. 12 Feb, 2026 1 commit
    • yangjianbo's avatar
      chore(logging): 完成后端日志审计与结构化迁移 · 584cfc3d
      yangjianbo authored
      - 将高密度服务与处理器日志迁移到新日志系统(LegacyPrintf/结构化日志)
      - 增加 stdlog bridge 与兼容测试,保留旧日志捕获能力
      - 将 OpenAI 断流告警改为结构化 Warn 并改造对应测试为 sink 捕获
      - 补齐后端相关文件 logger 引用并通过全量 go test
      584cfc3d
  3. 11 Feb, 2026 1 commit
    • 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
  4. 10 Feb, 2026 1 commit
    • 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
  5. 09 Feb, 2026 5 commits
    • Edric Li's avatar
      feat: same-account retry before failover for transient errors · d6c2921f
      Edric Li authored
      For retryable transient errors (Google 400 "invalid project resource name"
      and empty stream responses), retry on the same account up to 2 times
      (with 500ms delay) before switching to another account.
      
      - Add RetryableOnSameAccount field to UpstreamFailoverError
      - Add same-account retry loop in both Gemini and Claude/OpenAI handler paths
      - Move temp-unschedule from service layer to handler layer (only after
        all same-account retries exhausted)
      - Reduce temp-unschedule cooldown from 30 minutes to 1 minute
      d6c2921f
    • Edric Li's avatar
      feat: failover and temp-unschedule on Google "Invalid project resource name" 400 · 89905ec4
      Edric Li authored
      Google 后端间歇性返回 400 "Invalid project resource name" 错误,
      此前该错误直接透传给客户端且不触发账号切换,导致请求失败。
      
      - 在 Antigravity 和 Gemini 两个平台的所有转发路径中,
        精确匹配该错误消息后触发 failover 自动换号重试
      - 命中后将账号临时封禁 1 小时,避免反复调度到同一故障账号
      - 提取共享函数 isGoogleProjectConfigError / tempUnscheduleGoogleConfigError
        消除跨 Service 的代码重复
      89905ec4
    • 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
  6. 08 Feb, 2026 2 commits
    • erio's avatar
      a67d9337
    • erio's avatar
      refactor(upstream): replace upstream account type with apikey, auto-append /antigravity · fb58560d
      erio authored
      Upstream accounts now use the standard APIKey type instead of a dedicated
      upstream type. GetBaseURL() and new GetGeminiBaseURL() automatically append
      /antigravity for Antigravity platform APIKey accounts, eliminating the need
      for separate upstream forwarding methods.
      
      - Remove ForwardUpstream, ForwardUpstreamGemini, testUpstreamConnection
      - Remove upstream branch guards in Forward/ForwardGemini/TestConnection
      - Add migration 052 to convert existing upstream accounts to apikey
      - Update frontend CreateAccountModal to create apikey type
      - Add unit tests for GetBaseURL and GetGeminiBaseURL
      fb58560d
  7. 07 Feb, 2026 3 commits
  8. 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
  9. 02 Feb, 2026 3 commits
  10. 29 Jan, 2026 1 commit
    • song's avatar
      fix(gateway): 过滤 Gemini 请求中 parts 为空的消息 · 7ade9baa
      song authored
      Gemini API 不接受 contents 数组中 parts 为空的消息,会返回 400 INVALID_ARGUMENT 错误。
      添加 filterEmptyPartsFromGeminiRequest 函数在转发前过滤这类消息。
      
      影响范围:ForwardGemini (antigravity) 和 ForwardNative (gemini)
      7ade9baa
  11. 26 Jan, 2026 2 commits
  12. 23 Jan, 2026 1 commit
    • lynoot's avatar
      fix(gateway): aggregate all text chunks in non-streaming Gemini responses · 909b8a8f
      lynoot authored
      Previously, collectGeminiSSE() only returned the last chunk received
      from the upstream streaming response when converting to non-streaming.
      This caused incomplete responses where only the final text fragment
      was returned to clients.
      
      For example, a request asking to "count from 1 to 10" would only
      return "\n" (the last chunk) instead of "1\n2\n3\n...\n10\n".
      
      This was especially problematic for JSON structured output where
      the opening brace "{" from the first chunk was lost, resulting
      in invalid JSON like: colors": ["red", "blue"]}
      
      The fix:
      - Collect all text parts from each SSE chunk into a slice
      - Merge all collected text parts into the final response
      - Reuse the same pattern as handleGeminiStreamToNonStreaming
        in antigravity_gateway_service.go
      
      Fixes: non-streaming responses returning incomplete text
      Fixes: structured output (JSON schema) returning invalid JSON
      909b8a8f
  13. 20 Jan, 2026 2 commits
  14. 15 Jan, 2026 1 commit
  15. 14 Jan, 2026 2 commits
  16. 12 Jan, 2026 1 commit
  17. 11 Jan, 2026 1 commit
    • IanShaw027's avatar
      feat(ops): 实现上游错误事件记录与查询功能 · 7ebca553
      IanShaw027 authored
      **新增功能**:
      - 新建ops_upstream_error_events表存储上游服务错误详情
      - 支持记录上游429/529/5xx错误的详细上下文信息
      - 提供按时间范围查询上游错误事件的API
      
      **后端改动**:
      1. 模型层(ops_models.go, ops_port.go):
         - 新增UpstreamErrorEvent结构体
         - 扩展Repository接口支持上游错误事件CRUD
      
      2. 仓储层(ops_repo.go):
         - 实现InsertUpstreamErrorEvent写入上游错误
         - 实现GetUpstreamErrorEvents按时间范围查询
      
      3. 服务层(ops_service.go, ops_upstream_context.go):
         - ops_service: 新增GetUpstreamErrorEvents查询方法
         - ops_upstream_context: 封装上游错误上下文构建逻辑
      
      4. Handler层(ops_error_logger.go):
         - 新增GetUpstreamErrorsHandler处理上游错误查询请求
      
      5. Gateway层集成:
         - antigravity_gateway_service.go: 429/529错误时记录上游事件
         - gateway_service.go: OpenAI 429/5xx错误时记录
         - gemini_messages_compat_service.go: Gemini 429/5xx错误时记录
         - openai_gateway_service.go: OpenAI 429/5xx错误时记录
         - ratelimit_service.go: 429限流错误时记录
      
      **数据记录字段**:
      - request_id: 关联ops_logs主记录
      - platform/model: 上游服务标识
      - status_code/error_message: 错误详情
      - request_headers/response_body: 调试信息(可选)
      - created_at: 错误发生时间
      7ebca553
  18. 09 Jan, 2026 4 commits
  19. 08 Jan, 2026 1 commit
    • Edric Li's avatar
      feat(groups): add Claude Code client restriction and session isolation · a4210588
      Edric Li authored
      - Add claude_code_only field to restrict groups to Claude Code clients only
      - Add fallback_group_id for non-Claude Code requests to use alternate group
      - Implement ClaudeCodeValidator for User-Agent detection
      - Add group-level session binding isolation (groupID in Redis key)
      - Prevent cross-group sticky session pollution
      - Update frontend with Claude Code restriction controls
      a4210588
  20. 05 Jan, 2026 2 commits
    • yangjianbo's avatar
      fix(安全): 关闭白名单时保留最小校验与默认白名单 · 048ed061
      yangjianbo authored
      实现 allow_insecure_http 并在关闭校验时执行最小格式验证
      - 关闭 allowlist 时要求 URL 可解析且 scheme 合规
      - 响应头过滤关闭时使用默认白名单策略
      - 更新相关文档、示例与测试覆盖
      048ed061
    • yangjianbo's avatar
      feat(安全): 添加安全开关并完善测试流程 · 794a9f96
      yangjianbo authored
      实现安全开关默认关闭与响应头透传逻辑
      - URL 校验与响应头过滤支持开关并覆盖流式路径
      - 非流式 Content-Type 透传/默认值按配置生效
      - 接入 go test、golangci-lint 与前端 lint/typecheck
      - 补充相关测试与配置/文档说明
      794a9f96
  21. 04 Jan, 2026 3 commits
    • IanShaw027's avatar
      fix(backend): 改进 thinking/tool block 签名处理和重试策略 · 87426e5d
      IanShaw027 authored
      主要改动:
      - request_transformer: thinking block 缺少签名时降级为文本而非丢弃,保留内容并在上层禁用 thinking mode
      - antigravity_gateway_service: 新增两阶段降级策略,先处理 thinking blocks,如仍失败且涉及 tool 签名错误则进一步降级 tool blocks
      - gateway_request: 新增 FilterSignatureSensitiveBlocksForRetry 函数,支持将 tool_use/tool_result 降级为文本
      - gateway_request: 改进 FilterThinkingBlocksForRetry,禁用顶层 thinking 配置以避免结构约束冲突
      - gateway_service: 实现保守的两阶段重试逻辑,优先保留内容,仅在必要时降级工具调用
      - 新增 antigravity_gateway_service_test.go 测试签名块剥离逻辑
      - 更新相关测试用例以验证降级行为
      
      此修复解决了跨平台/账户切换时历史消息签名失效导致的请求失败问题。
      87426e5d
    • IanShaw027's avatar
      fix(lint): 修复所有 Go 命名规范问题 · a4953785
      IanShaw027 authored
      - 全局替换 ApiKey → APIKey(类型、字段、方法、变量)
      - 修复所有 initialism 命名(API, SMTP, HTML, URL 等)
      - 添加所有缺失的包注释
      - 修复导出符号的注释格式
      
      主要修改:
      - ApiKey → APIKey(所有出现的地方)
      - ApiKeyID → APIKeyID
      - ApiKeyIDs → APIKeyIDs
      - TestSmtpConnection → TestSMTPConnection
      - HtmlURL → HTMLURL
      - 添加 20+ 个包注释
      - 修复 10+ 个导出符号注释格式
      
      验证结果:
      - ✓ golangci-lint: 0 issues
      - ✓ 单元测试: 通过
      - ✓ 集成测试: 通过
      a4953785
    • IanShaw027's avatar
      feat(gemini): 完善 Gemini OAuth 配额系统和用量显示 · a185ad11
      IanShaw027 authored
      主要改动:
      - 后端:重构 Gemini 配额服务,支持多层级配额策略(GCP Standard/Free, Google One, AI Studio, Code Assist)
      - 后端:优化 OAuth 服务,增强 tier_id 识别和存储逻辑
      - 后端:改进用量统计服务,支持不同平台的配额查询
      - 后端:优化限流服务,增加临时解除调度状态管理
      - 前端:统一四种授权方式的用量显示格式和徽标样式
      - 前端:增强账户配额信息展示,支持多种配额类型
      - 前端:改进创建和重新授权模态框的用户体验
      - 国际化:完善中英文配额相关文案
      - 移除 CHANGELOG.md 文件
      
      测试:所有单元测试通过
      a185ad11
  22. 03 Jan, 2026 1 commit
    • ianshaw's avatar
      feat(gemini): 优化 OAuth 和配额展示 · 26106eb0
      ianshaw authored
      主要改进:
      - 修复 google_one OAuth scopes 配置问题
      - 添加 Gemini 账号配额展示组件
      - 优化 Code Assist 类型检测逻辑
      - 添加 OAuth 测试用例
      26106eb0