feat: 反重力(Antigravity)增强、Failover 重构及新模型支持#627
Merged
Wei-Shaw merged 25 commits intoWei-Shaw:mainfrom Feb 25, 2026
Merged
Conversation
The usage progress bar only matched claude-sonnet-4-5 and claude-opus-4-5-thinking. After upgrading to 4.6, the backend returns claude-sonnet-4-6/claude-opus-4-6-thinking which didn't match, causing the Claude usage bar to not display. - Add claude-sonnet-4-6 and claude-opus-4-6-thinking to the match list - Rename label from "C4.5" to "Claude" for future-proofing
Before this change, when a client disconnected mid-request, the error message was "Upstream request failed after retries", which is misleading and pollutes error logs. Now we check context.Err() to return a more accurate "Client disconnected" message for both Claude and Gemini forward paths.
Extract applyInterceptWarmup utility to unify all credential building call sites: - Fix upstream account creation missing intercept_warmup_requests write - Fix apikey edit mode missing else-branch to clear the setting - Add backend unit test for IsInterceptWarmupEnabled - Add frontend unit test for credentialsBuilder
Add a dedicated CheckMixedChannel endpoint that allows the frontend to pre-validate mixed channel risk before submitting create/update requests. This improves UX by showing warnings earlier in the flow instead of only after form submission. Backend changes: - Add CheckMixedChannelRequest struct and CheckMixedChannel handler - Register POST /check-mixed-channel route - Expose CheckMixedChannelRisk as public method on AdminService - Simplify Create/Update 409 responses (remove details/require_confirmation) - Add comprehensive handler tests and stub methods Frontend changes: - Add checkMixedChannelRisk API function and TypeScript types - Refactor CreateAccountModal to precheck before step transition and submission - Refactor EditAccountModal to precheck before update submission - Replace pendingPayload pattern with action-based dialog flow
- Extract duplicated failover logic from gateway_handler.go (3 places) and gemini_v1beta_handler.go into shared failover_loop.go - Introduce FailoverState with HandleFailoverError and HandleSelectionExhausted - Move helper functions (needForceCacheBilling, sleepWithContext) into failover_loop.go - Add comprehensive unit tests (32+ test cases) - Delete redundant gateway_handler_single_account_retry_test.go
…rate limiting - Use mapped model (billingModel) instead of original request model for billing - Use resolveFinalAntigravityModelKey for 429 rate limit model key, ensuring rate limit records match the actual upstream model - Add regression tests for both fixes
Remove the special case that bypassed model-supported checks for Gemini API Key accounts, allowing model_mapping to filter requests properly. Add tests for multiplatform model filtering behavior.
Add comprehensive tests for warmup request interception behavior covering Antigravity accounts with various credential configurations.
Add Gemini model presets to BulkEditAccountModal for bulk model mapping. Fix AccountStatusIndicator model rate limit grid layout using proper grid container.
- Add claude-sonnet-4-6 to default Antigravity model mapping - Add antigravity_extra_retries default value in config - Add cache-dependency-path to CI setup-go for faster builds - Simplify vitest config to avoid vite plugin compatibility issues
Add claude-sonnet-4-6 to identity injection modelInfoMap and Antigravity model selector. Add gemini-3.1-pro-high/low to Antigravity model list and Sonnet 4.6 preset mapping.
Update the default ANTIGRAVITY_USER_AGENT_VERSION from 1.84.2 to 1.18.4 to match the current Antigravity-Manager desktop client.
Add migration 058 to update existing Antigravity accounts with claude-sonnet-4-6 in model_mapping. Add migration 059 to add gemini-3.1-pro-high/low/preview mappings.
Add missing gemini-3.1-pro-preview -> gemini-3.1-pro-high mapping to DefaultAntigravityModelMapping for consistency with migration 059.
Add a built-in default for ANTIGRAVITY_OAUTH_CLIENT_SECRET so the service works out of the box without requiring environment variable configuration. The env var can still override the default.
- Fix oauth_test.go and client_test.go to use defaultClientSecret variable instead of env var (init() already sets the default) - Align migration 058 gemini-3-pro-high/low/preview mappings with constants.go (map to 3.1 versions)
The ClientSecret constant was left as an empty string after getClientSecret() was refactored to use defaultClientSecret. Remove the dead constant and update the test accordingly.
- Remove Gemini platform exclusion from model restriction UI in Create/Edit account modals (Gemini now supports model_mapping) - Remove outdated Gemini model passthrough info cards - Add model_mapping field to GeminiCredentials type - Extend warmup request interception toggle to Antigravity platform - Remove redundant try/catch in API key account creation - Remove noisy gateway.request_completed debug log - Reorganize Gemini model mapping sections in constants.go
- Change layout from fixed 3-column grid to vertical-first responsive columns (1 col for ≤4 items, 2 cols for ≤8, 3 cols for 9+) - Add short aliases for all known model scope keys (e.g. COpus46, CSon46, G3PH, G3F) to reduce badge width - Display countdown timer directly on each badge (supports h/m/s) - Retain legacy scope aliases for backward compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
反重力(Antigravity)新模型支持
claude-sonnet-4-6模型映射、定价、请求转换器支持gemini-3.1-pro-high/low/preview模型映射gemini-3-pro-high/low不再默认映射到 3.1)反重力 Failover 重构
FailoverState(failover_loop.go)反重力计费与限流修正
claude-opus-4-6→claude-opus-4-6-thinking)反重力 OAuth 与配置改进
gateway.antigravity_extra_retries配置项反重力混合通道预检查
POST /accounts/check-mixed-channel独立预检查接口反重力 Warmup 拦截修复与扩展
intercept_warmup_requests配置无法保存的 bug(创建时漏写、编辑时缺少清除分支)前端 UI 优化
COpus46、CSon46)和倒计时显示其他
IsModelSupported检查opus-4.6和gemini-3.1-pro回退定价测试计划
golangci-lint run通过(v2.7,0 issues)govulncheck ./...通过(无漏洞)gosec通过pnpm audit通过(例外项已验证)go build ./...通过go vet ./...通过