Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

fix: resolve gemini-3.1-pro 404 by using bare model name instead of tier suffix (#510)#516

Closed
ndycode wants to merge 3 commits intoNoeFabris:mainfrom
ndycode:fix/issue-510-gemini-3.1-pro-404
Closed

fix: resolve gemini-3.1-pro 404 by using bare model name instead of tier suffix (#510)#516
ndycode wants to merge 3 commits intoNoeFabris:mainfrom
ndycode:fix/issue-510-gemini-3.1-pro-404

Conversation

@ndycode
Copy link
Copy Markdown
Contributor

@ndycode ndycode commented Feb 28, 2026

Summary

Fixes #510antigravity-gemini-3.1-pro returns 404 "Requested entity was not found" for all users.

Root Cause

The model resolver appended -low tier suffix to gemini-3.1-pro, producing gemini-3.1-pro-low — a model name the Antigravity API doesn't recognize. Only gemini-3-pro (3.0) supports tier suffixes in the model name. gemini-3.1-pro uses the bare model name + thinkingLevel parameter (same pattern as Flash models).

Bug chain:

  1. User requests antigravity-gemini-3.1-pro
  2. resolveModelWithTier() strips antigravity- prefix → gemini-3.1-pro
  3. isGemini3ProModel() returns true (regex matches both 3.0 and 3.1)
  4. skipAlias = true → appends -lowgemini-3.1-pro-low
  5. API returns 404

Changes

  • Added isGemini3BaseProModel() helper to distinguish gemini-3-pro (supports tier suffix in model name) from gemini-3.1+-pro (bare name + thinkingLevel)
  • Fixed resolveModelWithTier() — no longer appends -low for 3.1+ Pro models
  • Fixed resolveModelForHeaderStyle() — antigravity path no longer appends -low for 3.1+ Pro
  • Fixed resolveModelWithVariant() — no longer re-appends tier suffix for 3.1+ Pro
  • Updated tests with corrected assertions across model-resolver.test.ts and request.test.ts
  • Added regression tests confirming 3.0 Pro behavior unchanged (gemini-3-pro-low/high still works)

Testing

  • 920/920 tests pass (0 failures, 25 pre-existing skipped)
  • npm run typecheck
  • npm run build
  • New test cases verify 3.1 Pro bare name resolution across all 3 resolver functions
  • Regression tests confirm 3.0 Pro behavior is unchanged

Model Resolution Before/After

Input Before (broken) After (fixed)
antigravity-gemini-3.1-pro gemini-3.1-pro-low ❌ 404 gemini-3.1-pro
antigravity-gemini-3.1-pro-high gemini-3.1-pro-high ❌ 404 gemini-3.1-pro ✅ (thinkingLevel=high)
antigravity-gemini-3-pro gemini-3-pro-low gemini-3-pro-low ✅ (unchanged)
antigravity-gemini-3-pro-high gemini-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 cases
  • src/plugin/request.test.ts — Fixed 2 stale assertions

…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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration 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

📥 Commits

Reviewing files that changed from the base of the PR and between f9faa98 and 0761294.

📒 Files selected for processing (1)
  • .gitignore
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

Walkthrough

Updates introduce an internal regex and helper isGemini3BaseProModel() to distinguish gemini-3-pro (3.0) from gemini-3.1+-pro variants and adjust model resolution logic accordingly. Antigravity, header-style, and variant resolution paths now treat tier suffixes and thinkingLevel differently for 3.0 vs 3.1+ pro models. Tests were added and updated to reflect new mappings (e.g., gemini-3.1-pro-preview*gemini-3.1-pro, tier-stripping and thinkingLevel semantics for 3.1+), and .gitignore was extended. No public API signatures changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: using bare model name for gemini-3.1-pro instead of tier suffix to resolve 404 errors, and directly references the linked issue #510.
Description check ✅ Passed The description comprehensively explains the root cause, changes made, testing performed, and provides before/after examples directly related to the changeset.
Linked Issues check ✅ Passed All coding requirements from issue #510 are met: resolver distinguishes 3.0 Pro (tier suffix) from 3.1+ Pro (bare name), bug fix prevents 404, and comprehensive tests with regression coverage confirm the fix.
Out of Scope Changes check ✅ Passed All changes directly address the 404 bug: model resolver updates, test corrections, and .gitignore addition for development workflow. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Feb 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • src/plugin/request.test.ts - Updated test expectations
  • src/plugin/transform/model-resolver.test.ts - Updated tests with regression coverage
  • src/plugin/transform/model-resolver.ts - Core fix implementation

Changes Overview

This PR fixes Issue #510 where gemini-3.1-pro was incorrectly being transformed to gemini-3.1-pro-low for the Antigravity API, causing 404 errors. The fix:

  1. Added GEMINI_3_BASE_PRO_REGEX - Specifically matches gemini-3-pro (3.0 only, without minor version)
  2. Added isGemini3BaseProModel() helper - Distinguishes gemini-3-pro (3.0) from gemini-3.1+-pro (3.1+)
  3. Fixed resolveModelWithTier() - No longer appends -low for 3.1+ Pro models
  4. Fixed resolveModelForHeaderStyle() - Correctly handles 3.1+ Pro in antigravity path
  5. Fixed resolveModelWithVariant() - Doesn't re-append tier suffix for 3.1+ Pro

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 Analysis

The implementation correctly distinguishes between:

  • gemini-3-pro (3.0): Uses tier suffix in model name (gemini-3-pro-low, gemini-3-pro-high)
  • gemini-3.1+-pro (3.1+): Uses bare model name + thinkingLevel parameter

The regex /^gemini-3-pro/i correctly matches only gemini-3-pro (3.0) and NOT gemini-3.1-pro. All three affected functions are updated consistently with proper regression tests included.


Reviewed by: kilo-code-bot

@ndycode
Copy link
Copy Markdown
Contributor Author

ndycode commented Feb 28, 2026

Linking the open issue that this PR fixes for tracking:

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 28, 2026

Greptile Summary

Fixed 404 errors for antigravity-gemini-3.1-pro by implementing proper model name resolution that distinguishes between gemini-3-pro (3.0, uses tier suffix like -low/-high in model name) and gemini-3.1+-pro (uses bare model name with thinkingLevel parameter).

  • Added isGemini3BaseProModel() helper to identify 3.0 Pro vs 3.1+ Pro models
  • Fixed resolveModelWithTier() to only append -low for 3.0 Pro, and strip tier suffix for 3.1+ Pro
  • Fixed resolveModelForHeaderStyle() Antigravity path to use bare name for 3.1+ Pro
  • Fixed resolveModelWithVariant() to only modify model name for 3.0 Pro
  • Added 7 new test cases covering 3.1 Pro resolution patterns
  • Included regression tests confirming 3.0 Pro behavior unchanged
  • All 920 tests pass with no failures

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a well-tested bug fix with proper regression coverage
  • Score reflects comprehensive test coverage (920/920 passing, 7 new test cases, regression tests for 3.0 Pro), clean implementation with clear logic separation via new helper function, and successful typecheck/build. The fix correctly addresses the root cause by distinguishing 3.0 from 3.1+ Pro models.
  • No files require special attention - all changes are well-tested and isolated to the model resolution logic

Important Files Changed

Filename Overview
src/plugin/transform/model-resolver.ts Added isGemini3BaseProModel() helper and fixed three resolver functions to distinguish gemini-3-pro (3.0, uses tier suffix) from gemini-3.1+-pro (bare name + thinkingLevel)
src/plugin/transform/model-resolver.test.ts Added comprehensive test suite for Issue #510 covering 3.1 Pro resolution and regression tests confirming 3.0 Pro behavior unchanged
src/plugin/request.test.ts Updated two test assertions to expect bare gemini-3.1-pro instead of gemini-3.1-pro-low

Last reviewed commit: 0761294

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 114 to 118
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");
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Fix in Codex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the earlier duplicate so the Issue #510 block is the canonical coverage now. Thanks for flagging it!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 28, 2026

Additional Comments (2)

src/plugin/transform/model-resolver.ts
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:

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.

Prompt To Fix With AI
This 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.

Fix in Codex


src/plugin/transform/model-resolver.ts
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:

  // 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
Prompt To Fix With AI
This 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.

Fix in Codex

@pascalwhoop
Copy link
Copy Markdown

@ndycode thx for this, wanna merge?

@ndycode
Copy link
Copy Markdown
Contributor Author

ndycode commented Mar 4, 2026

@ndycode thx for this, wanna merge?

@NoeFabris go review my pr thanks

@NoeFabris
Copy link
Copy Markdown
Owner

NoeFabris commented Mar 4, 2026

@ndycode thx for this, wanna merge?

@NoeFabris go review my pr thanks

Hey @ndycode, have you tested it?
I don't think this is the fix, antigravity models use the suffix -low and -high cli model -preview, but the cli model is not yet available on free accounts.

@devjhoan
Copy link
Copy Markdown

any update about this?

@selfcontro
Copy link
Copy Markdown

any update about this?my gemini 3.1 pro、opus 4.6 and sonnet 4.5 seems like get the same issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Requested entity was not found 404

5 participants