Fixes stale Antigravity model routing for current models.#569
Conversation
WalkthroughThis pull request deprecates older Gemini 3 Pro model definitions and replaces them with Gemini 3.1 Pro variants. The change removes two model entries ( Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Detailed notesKey logic changes in
Test coverage expansion:
Configuration updates:
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/plugin/transform/model-resolver.ts (1)
43-44:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winStale
MODEL_ALIASESentries for"gemini-3-pro-low"and"gemini-3-pro-high"now point to a removed legacy model.
MODEL_ALIASESis exported, so external consumers can look up these keys directly. After this PR introducesLEGACY_MODEL_ALIASESwith"gemini-3-pro": "gemini-3.1-pro", the entries at lines 43–44 become inconsistent: they map"gemini-3-pro-low"/"gemini-3-pro-high"to"gemini-3-pro", which is itself now a legacy ID. Any caller that importsMODEL_ALIASESand looks these up directly will receive a stale, no-longer-valid model string.normalizeLegacyModel(which is not exported) gates these away insideresolveModelWithTier, but external consumers have no path to that normalization.🛠️ Proposed fix
- "gemini-3-pro-low": "gemini-3-pro", - "gemini-3-pro-high": "gemini-3-pro", + "gemini-3-pro-low": "gemini-3.1-pro", + "gemini-3-pro-high": "gemini-3.1-pro",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/plugin/transform/model-resolver.ts` around lines 43 - 44, MODEL_ALIASES currently maps "gemini-3-pro-low" and "gemini-3-pro-high" to the legacy id "gemini-3-pro", which is inconsistent now that LEGACY_MODEL_ALIASES maps "gemini-3-pro" → "gemini-3.1-pro"; update MODEL_ALIASES so those two keys resolve directly to the final model id (e.g., "gemini-3.1-pro") or remove them if not needed, ensuring external consumers of the exported MODEL_ALIASES get a non-legacy model string; check related code paths that use resolveModelWithTier and normalizeLegacyModel to confirm no double-normalization occurs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/plugin/transform/model-resolver.ts`:
- Around line 43-44: MODEL_ALIASES currently maps "gemini-3-pro-low" and
"gemini-3-pro-high" to the legacy id "gemini-3-pro", which is inconsistent now
that LEGACY_MODEL_ALIASES maps "gemini-3-pro" → "gemini-3.1-pro"; update
MODEL_ALIASES so those two keys resolve directly to the final model id (e.g.,
"gemini-3.1-pro") or remove them if not needed, ensuring external consumers of
the exported MODEL_ALIASES get a non-legacy model string; check related code
paths that use resolveModelWithTier and normalizeLegacyModel to confirm no
double-normalization occurs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 16401b19-c4fc-41df-abcf-efcb1455bd8d
📒 Files selected for processing (7)
README.mdsrc/plugin/config/models.test.tssrc/plugin/config/models.tssrc/plugin/config/updater.test.tssrc/plugin/request.test.tssrc/plugin/transform/model-resolver.test.tssrc/plugin/transform/model-resolver.ts
💤 Files with no reviewable changes (1)
- src/plugin/config/models.ts
📜 Review details
🔇 Additional comments (9)
src/plugin/transform/model-resolver.ts (3)
151-163:normalizeLegacyModel— LGTM.Tier-strip → alias-lookup (case-insensitive) → tier-reattach is correct for all exercised paths including
"gemini-3-pro-low","antigravity-gemini-3-pro-high","claude-opus-4-5-thinking-low", and"gemini-3-pro-preview". ThesupportsThinkingTiersguard before reattaching the tier prevents erroneously suffixing non-thinking targets (e.g. theclaude-opus-4-5 → claude-opus-4-6-thinkingalias with no tier present). Double-application is safe because normalized names are not present as keys inLEGACY_MODEL_ALIASES.
185-293:resolveModelWithTierpost-normalization flow — LGTM.The
normalizeLegacyModelcall at line 186 happens before the quota-prefix strip and theskipAlias/antigravityModellogic, so all legacy IDs are transparently upgraded before any routing decision. The tier-appending guard (isGemini3Pro && !tier && !isImageModel) correctly applies only whenskipAliasis true (i.e.isAntigravityprefix present), matching the existing Antigravity API requirement for tier-suffixed Pro models.
336-384:resolveModelForHeaderStylelegacy normalization path — LGTM.
normalizeLegacyModelis called first so both"gemini-3-pro-preview"and"gemini-3-pro-low"are upgraded to"gemini-3.1-pro-preview"/"gemini-3.1-pro-low"before the header-style transformation is applied. ThehasPreviewSuffixregex/-preview($|-)/icorrectly matches both"…-preview"(end) and"…-preview-customtools"(mid) so the preview suffix is not doubled.src/plugin/transform/model-resolver.test.ts (2)
63-98: New "legacy model aliases" tests — LGTM.All five assertions have been independently traced through the
normalizeLegacyModel→resolveModelWithTierpipeline and produce the expected outputs. Coverage includes base alias (no tier), tier-preserved alias (antigravity-gemini-3-pro-high → gemini-3.1-pro-high), and Claude 4.5→4.6 upgrades both with and without a tier suffix.
307-343:resolveModelForHeaderStylelegacy coverage — LGTM.The three new tests for legacy inputs (
gemini-3-pro-preview → antigravity,gemini-3-pro-low → gemini-cli,gemini-3-pro-preview → gemini-cli) correctly exercise thenormalizeLegacyModel-first path insideresolveModelForHeaderStyleand complement the existing non-legacy tests at lines 313–355.src/plugin/request.test.ts (1)
1039-1097: New legacy-routing assertions inprepareAntigravityRequest— LGTM.Both new tests correctly mirror the
resolveModelForHeaderStylebehavior verified inmodel-resolver.test.ts:gemini-3-pro-preview→gemini-3.1-pro-lowforantigravityandgemini-3-pro-low→gemini-3.1-pro-previewforgemini-cli. They are appropriately placed adjacent to the non-legacy Gemini 3.1 counterparts at lines 1051 and 1099.src/plugin/config/updater.test.ts (1)
65-71: Updated model key assertions — LGTM.The
toBeDefined/toBeUndefinedpairing at lines 69–71 is an effective regression guard: it validates both that"antigravity-gemini-3.1-pro"was added and that the stale"antigravity-gemini-3-pro"key was removed. The same update at line 239 covers the JSONC path.src/plugin/config/models.test.ts (1)
51-56: Stale-model exclusion test — LGTM.Directly accessing
OPENCODE_MODEL_DEFINITIONS[key]withtoBeUndefined()(rather than thegetModelhelper that throws) is the correct approach for absence assertions. The Claude 4.5 coverage viaObject.keys(...).some(name => name.includes(...))cleanly guards against any variant of those suffixes slipping back in.README.md (1)
115-129: README model tables — LGTM.The Antigravity quota table now shows
antigravity-gemini-3.1-proand the Gemini CLI table correctly usesgemini-3.1-pro-preview/gemini-3.1-pro-preview-customtools, matching the updatedOPENCODE_MODEL_DEFINITIONSand the routing logic inresolveModelForHeaderStyle. The oh-my-opencode example snippets at lines 409 and 547 are updated consistently.
Fixes stale Antigravity model routing for current models.
Changes:
Validation:
npm testpasses: 1004 tests passed.npm run typecheckpasses.