fix: resolve gemini-3.1-pro 404 by using bare model name instead of tier suffix (#510)#516
fix: resolve gemini-3.1-pro 404 by using bare model name instead of tier suffix (#510)#516ndycode wants to merge 3 commits intoNoeFabris:mainfrom
Conversation
…ier suffix (#510) The model resolver was appending '-low' tier suffix to gemini-3.1-pro, producing 'gemini-3.1-pro-low' which the Antigravity API doesn't recognize (404). Only gemini-3-pro (3.0) supports tier suffixes in the model name. gemini-3.1-pro uses bare model name + thinkingLevel parameter (same pattern as Flash models). - Added isGemini3BaseProModel() helper to distinguish gemini-3-pro (tier suffix) from gemini-3.1+-pro (bare name) - Fixed resolveModelWithTier() to not append -low for 3.1+ Pro models - Fixed resolveModelForHeaderStyle() antigravity path for 3.1+ Pro - Fixed resolveModelWithVariant() to not re-append tier suffix for 3.1+ Pro - Updated tests with corrected assertions and added regression tests for 3.0 behavior
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughUpdates introduce an internal regex and helper Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Changes OverviewThis PR fixes Issue #510 where
The implementation maintains backward compatibility for gemini-3-pro (3.0) while using the bare model name + thinkingLevel parameter for gemini-3.1+ models, which is the correct behavior per the Antigravity API. Code Quality AnalysisThe implementation correctly distinguishes between:
The regex Reviewed by: kilo-code-bot |
|
Linking the open issue that this PR fixes for tracking:
|
Greptile SummaryFixed 404 errors for
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 0761294 |
| it("antigravity-gemini-3.1-pro uses bare model name (no -low suffix)", () => { | ||
| const result = resolveModelWithTier("antigravity-gemini-3.1-pro"); | ||
| expect(result.actualModel).toBe("gemini-3.1-pro-low"); | ||
| expect(result.actualModel).toBe("gemini-3.1-pro"); | ||
| expect(result.thinkingLevel).toBe("low"); | ||
| }); |
There was a problem hiding this comment.
Duplicate test case
This test asserts the exact same inputs and overlapping outputs as the "antigravity-gemini-3.1-pro resolves to bare gemini-3.1-pro" test added below in the "Issue #510" describe block (lines 122–128). Both call resolveModelWithTier("antigravity-gemini-3.1-pro") and assert actualModel = "gemini-3.1-pro" and thinkingLevel = "low". The Issue #510 test is the more complete one (also checks quotaPreference and explicitQuota). Consider removing this first copy to avoid confusion about which test is canonical.
| it("antigravity-gemini-3.1-pro uses bare model name (no -low suffix)", () => { | |
| const result = resolveModelWithTier("antigravity-gemini-3.1-pro"); | |
| expect(result.actualModel).toBe("gemini-3.1-pro-low"); | |
| expect(result.actualModel).toBe("gemini-3.1-pro"); | |
| expect(result.thinkingLevel).toBe("low"); | |
| }); | |
| }); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/plugin/transform/model-resolver.test.ts
Line: 114-118
Comment:
**Duplicate test case**
This test asserts the exact same inputs and overlapping outputs as the `"antigravity-gemini-3.1-pro resolves to bare gemini-3.1-pro"` test added below in the "Issue #510" describe block (lines 122–128). Both call `resolveModelWithTier("antigravity-gemini-3.1-pro")` and assert `actualModel = "gemini-3.1-pro"` and `thinkingLevel = "low"`. The Issue #510 test is the more complete one (also checks `quotaPreference` and `explicitQuota`). Consider removing this first copy to avoid confusion about which test is canonical.
```suggestion
});
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Dropped the earlier duplicate so the Issue #510 block is the canonical coverage now. Thanks for flagging it!
Additional Comments (2)
This still matches Prompt To Fix With AIThis is a comment left during a code review.
Path: src/plugin/transform/model-resolver.ts
Line: 62-66
Comment:
**Regex is a prefix match — could over-match future model names**
`GEMINI_3_BASE_PRO_REGEX = /^gemini-3-pro/i` matches anything starting with `gemini-3-pro`, including `gemini-3-pro-turbo`, `gemini-3-pro-experimental`, etc. While this works perfectly for every current model name, adding a word-boundary anchor after `pro` would make the intent explicit and guard against hypothetical future names inadvertently being treated as the 3.0 base model:
```suggestion
const GEMINI_3_BASE_PRO_REGEX = /^gemini-3-pro(?:-|$)/i;
```
This still matches `gemini-3-pro`, `gemini-3-pro-low`, `gemini-3-pro-high`, `gemini-3-pro-image`, and `gemini-3-pro-preview`, while making it clear that only models whose suffix starts with a hyphen (or ends at the string boundary) are considered the 3.0 base Pro family.
How can I resolve this? If you propose a fix, please make it concise.
The block comment above the Prompt To Fix With AIThis is a comment left during a code review.
Path: src/plugin/transform/model-resolver.ts
Line: 186-192
Comment:
**Comment omits new gemini-3.1+ bare-name behavior**
The block comment above the `antigravityModel` logic was written before this fix and only documents the Flash bare-name behavior. It no longer reflects the full picture after this PR. Updating it will help future developers understand why `gemini-3.1-pro` is intentionally left unsuffixed:
```suggestion
// Antigravity API model name strategy:
// gemini-3-pro (3.0) → requires tier suffix in model name (gemini-3-pro-low/high)
// defaults to -low when no tier is specified
// gemini-3.1+-pro → uses bare model name + thinkingLevel parameter
// tier suffix is stripped from the name (handled below)
// gemini-3-flash → uses bare model name + thinkingLevel parameter
```
How can I resolve this? If you propose a fix, please make it concise. |
|
@ndycode thx for this, wanna merge? |
@NoeFabris go review my pr thanks |
Hey @ndycode, have you tested it? |
|
any update about this? |
|
any update about this?my gemini 3.1 pro、opus 4.6 and sonnet 4.5 seems like get the same issue |
Summary
Fixes #510 —
antigravity-gemini-3.1-proreturns 404 "Requested entity was not found" for all users.Root Cause
The model resolver appended
-lowtier suffix togemini-3.1-pro, producinggemini-3.1-pro-low— a model name the Antigravity API doesn't recognize. Onlygemini-3-pro(3.0) supports tier suffixes in the model name.gemini-3.1-prouses the bare model name +thinkingLevelparameter (same pattern as Flash models).Bug chain:
antigravity-gemini-3.1-proresolveModelWithTier()stripsantigravity-prefix →gemini-3.1-proisGemini3ProModel()returnstrue(regex matches both 3.0 and 3.1)skipAlias = true→ appends-low→gemini-3.1-pro-lowChanges
isGemini3BaseProModel()helper to distinguishgemini-3-pro(supports tier suffix in model name) fromgemini-3.1+-pro(bare name + thinkingLevel)resolveModelWithTier()— no longer appends-lowfor 3.1+ Pro modelsresolveModelForHeaderStyle()— antigravity path no longer appends-lowfor 3.1+ ProresolveModelWithVariant()— no longer re-appends tier suffix for 3.1+ Promodel-resolver.test.tsandrequest.test.tsgemini-3-pro-low/highstill works)Testing
npm run typecheck✅npm run build✅Model Resolution Before/After
antigravity-gemini-3.1-progemini-3.1-pro-low❌ 404gemini-3.1-pro✅antigravity-gemini-3.1-pro-highgemini-3.1-pro-high❌ 404gemini-3.1-pro✅ (thinkingLevel=high)antigravity-gemini-3-progemini-3-pro-low✅gemini-3-pro-low✅ (unchanged)antigravity-gemini-3-pro-highgemini-3-pro-high✅gemini-3-pro-high✅ (unchanged)Files Changed
src/plugin/transform/model-resolver.ts— Core fix (3 code paths + new helper)src/plugin/transform/model-resolver.test.ts— Fixed assertions + 7 new test casessrc/plugin/request.test.ts— Fixed 2 stale assertions