1. 09 Feb, 2026 2 commits
    • 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
    • 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
  2. 08 Feb, 2026 9 commits
  3. 07 Feb, 2026 9 commits
    • erio's avatar
      fix(gateway): restore upstream account forwarding with dedicated methods · 77b66653
      erio authored
      v0.1.74 merged upstream accounts into the OAuth path, causing requests
      to hit the wrong protocol and endpoint. Add three upstream-specific
      methods (testUpstreamConnection, ForwardUpstream, ForwardUpstreamGemini)
      that use base_url + apiKey auth and passthrough the original body, while
      reusing the existing response handling and error/retry logic.
      77b66653
    • erio's avatar
      feat: smart retry max 1 attempt + clear sticky session on failure · 3077fd27
      erio authored
      - Change antigravitySmartRetryMaxAttempts from 3 to 1 to prevent
        repeated rate limiting and long waits
      - Clear sticky session binding (DeleteSessionAccountID) after smart
        retry exhaustion, so subsequent requests don't hit the same
        rate-limited account
      - Add flow diagrams to Forward/ForwardGemini doc comments
      - Add comprehensive unit tests covering:
        - Sticky session cleared on retry failure (429, 503, network error)
        - Sticky session NOT cleared on retry success
        - Sticky session NOT cleared for non-sticky requests (empty hash)
        - Sticky session NOT cleared on long delay path (handled by handler)
        - Nil cache safety (no panic)
        - MaxAttempts constant verification
        - End-to-end retryLoop → switchError propagation with session clear
      3077fd27
    • shaw's avatar
      fix(gateway): harden digest logging and align antigravity ops · 1439eb39
      shaw authored
      - avoid panic by using safe UUID prefix truncation in Gemini digest fallback logs\n- remove unconditional Antigravity 429 full-body debug logs and honor log truncation config\n- align Antigravity quick preset mappings to opus 4.6-thinking targets only\n- restore scope rate-limit aggregation/output in ops availability stats
      1439eb39
    • erio's avatar
      refactor: simplify sticky session rate limit handling — switch immediately on any rate limit · e1a68497
      erio authored
      Remove threshold-based waiting in both sticky session and antigravity
      pre-check paths. When a model is rate-limited, immediately clear the
      sticky session and switch accounts instead of waiting for short durations.
      e1a68497
    • erio's avatar
      fix(antigravity): fetch default mapping from API and sync Redis on rate limit · 2656320d
      erio authored
      1. Frontend: replace hardcoded antigravityDefaultMappings with async
         fetch from GET /admin/accounts/antigravity/default-model-mapping,
         eliminating the duplicate data source that caused frontend/backend
         mapping inconsistency.
      
      2. Backend: convert handleSmartRetry and antigravityRetryLoop from
         standalone functions to AntigravityGatewayService methods, enabling
         Redis cache sync (updateAccountModelRateLimitInCache) after both
         rate-limit write paths — long-delay branch and retry-exhausted branch.
      2656320d
    • erio's avatar
      fix(antigravity): support upstream accounts and custom model_mapping in scheduling · de092728
      erio authored
      - GetAccessToken: add upstream branch to read api_key from credentials
      - shouldTriggerAntigravitySmartRetry: relax check from IsOAuth to Platform-based
      - isModelSupportedByAccount/WithContext: replace IsAntigravityModelSupported
        whitelist with mapAntigravityModel for unified scheduling/forwarding logic
      - mapAntigravityModel: fix edge case where wildcard target equals request model
      - Update tests for new behavior and add custom model_mapping test cases
      de092728
    • 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): reduce 429 fallback cooldown from 5min to 30s · 8917afab
      erio authored
      The default fallback cooldown when rate limit reset time cannot be
      parsed was 5 minutes, which is too aggressive and causes accounts
      to be unnecessarily locked out. Reduce to 30 seconds for faster
      recovery. Config override still works (unit remains minutes).
      8917afab
    • shaw's avatar
      5299f3dc
  4. 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
  5. 03 Feb, 2026 5 commits
    • song's avatar
      fix: update tests for group fallback · 7cb5444d
      song authored
      7cb5444d
    • JIA-ss's avatar
      fix(api): 修复 thinking 块被意外修改导致的 400 错误 · ad90bb46
      JIA-ss authored
      
      
      问题描述:
      使用扩展思考功能时,偶现以下错误:
      "thinking or redacted_thinking blocks in the latest assistant message cannot be modified"
      
      根因分析:
      当代理服务修改请求体中的某些字段时(如 metadata.user_id、model),
      使用 map[string]any 解析整个 JSON 后重新序列化,导致:
      1. 字段顺序改变(Go map 序列化按字母排序)
      2. 数字格式变化(如 1.0 → 1)
      3. Unicode 转义变化
      
      Claude API 对 thinking 块进行字节级验证,任何变化都会触发错误。
      
      修复内容:
      1. identity_service.go - RewriteUserID/RewriteUserIDWithMasking
         使用 json.RawMessage 保留其他字段的原始字节
      
      2. gateway_service.go - replaceModelInBody
         使用 json.RawMessage 保留其他字段的原始字节
      
      3. gateway_service.go - normalizeClaudeOAuthRequestBody
         保留 messages 的原始字节,跳过包含 thinking 块的消息修改
      
      4. gateway_service.go - isThinkingBlockSignatureError
         添加 "cannot be modified" 错误检测,触发自动重试
      
      5. antigravity_gateway_service.go - isSignatureRelatedError
         添加 "cannot be modified" 错误检测
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      ad90bb46
    • liuxiongfeng's avatar
      feat(antigravity): 默认开启按配额域限流,避免整个账号被锁定 · 56949a58
      liuxiongfeng authored
      将 GATEWAY_ANTIGRAVITY_429_SCOPE_LIMIT 的默认值从关闭改为开启。
      当 Gemini 模型触发 429 限流时,只会限制对应的配额域(gemini_text),
      而 Claude 和 gemini_image 仍可继续使用,提高账号利用率。
      56949a58
    • liuxiongfeng's avatar
      feat(antigravity): map all gemini-2.5 to gemini-3 series · 7d256879
      liuxiongfeng authored
      Antigravity 上游不再支持 gemini-2.5 系列,统一映射到 gemini-3:
      - gemini-2.5-flash → gemini-3-flash
      - gemini-2.5-flash-lite → gemini-3-flash
      - gemini-2.5-flash-thinking → gemini-3-flash
      - gemini-2.5-flash-image → gemini-3-pro-image
      - gemini-2.5-pro → gemini-3-pro-high
      - gemini-2.5-pro-preview → gemini-3-pro-high
      - gemini-2.5-pro-exp → gemini-3-pro-high
      7d256879
    • liuxiongfeng's avatar
      feat(antigravity): map gemini-2.5-pro to gemini-3-pro-high · beb63cb1
      liuxiongfeng authored
      Add prefix mapping rules for gemini-2.5-pro variants:
      - gemini-2.5-pro -> gemini-3-pro-high
      - gemini-2.5-pro-preview -> gemini-3-pro-high
      - gemini-2.5-pro-exp -> gemini-3-pro-high
      beb63cb1
  6. 02 Feb, 2026 2 commits
  7. 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
  8. 28 Jan, 2026 1 commit
  9. 27 Jan, 2026 2 commits
  10. 23 Jan, 2026 1 commit
  11. 22 Jan, 2026 2 commits
    • 0xff26b9a8's avatar
      style: gofmt antigravity_gateway_service.go · 4f0c2b79
      0xff26b9a8 authored
      4f0c2b79
    • 0xff26b9a8's avatar
      fix(antigravity): 修复非流式 Claude To Antigravity 响应内容为空的问题 · e756064c
      0xff26b9a8 authored
      - 修复 TransformGeminiToClaude 的 JSON 解析逻辑,当 V1InternalResponse
        解析成功但 candidates 为空时,尝试直接解析为 GeminiResponse 格式
      - 修复 handleClaudeStreamToNonStreaming 收集流式响应的逻辑,累积所有
        chunks 的内容而不是只保留最后一个(最后一个 chunk 通常 text 为空)
      - 新增 mergeCollectedPartsToResponse 函数,合并所有类型的 parts
        (text、thinking、functionCall、inlineData),保持原始顺序
      - 连续的普通 text parts 合并为一个,thinking/functionCall/inlineData 保持原样
      e756064c
  12. 21 Jan, 2026 2 commits
    • song's avatar
      feat(antigravity): 支持按模型类型配置重试次数 · 207e0950
      song authored
      新增环境变量:
      - GATEWAY_ANTIGRAVITY_MAX_RETRIES_CLAUDE
      - GATEWAY_ANTIGRAVITY_MAX_RETRIES_GEMINI_TEXT
      - GATEWAY_ANTIGRAVITY_MAX_RETRIES_GEMINI_IMAGE
      
      未设置时回退到平台级 GATEWAY_ANTIGRAVITY_MAX_RETRIES
      207e0950
    • 0xff26b9a8's avatar
      refactor(antigravity): 提取并同步 Schema 清理逻辑至 schema_cleaner.go · 71f8b9e4
      0xff26b9a8 authored
      主要变更:
      1. 重构代码结构:
         - 将 CleanJSONSchema 及其相关辅助函数从 request_transformer.go 提取到独立的 schema_cleaner.go 文件中,实现逻辑解耦。
      
      2. 逻辑优化与修正:
         - 参考 Antigravity-Manager (json_schema.rs) 的实现逻辑,修正了 Schema 清洗策略。
      71f8b9e4
  13. 20 Jan, 2026 3 commits