Skip to content

Fixes stale Antigravity model routing for current models.#569

Open
kill74 wants to merge 1 commit into
NoeFabris:mainfrom
kill74:codex/fix-antigravity-current-models
Open

Fixes stale Antigravity model routing for current models.#569
kill74 wants to merge 1 commit into
NoeFabris:mainfrom
kill74:codex/fix-antigravity-current-models

Conversation

@kill74
Copy link
Copy Markdown

@kill74 kill74 commented May 7, 2026

Fixes stale Antigravity model routing for current models.

Changes:

  • Maps legacy Gemini 3 Pro model IDs to Gemini 3.1 Pro.
  • Maps legacy Claude 4.5 model IDs to current Claude 4.6 models.
  • Updates generated OpenCode model config to expose current Antigravity models.
  • Removes stale Gemini 3 Pro / Claude 4.5 entries from generated config.
  • Adds regression tests for legacy model resolution and config updates.

Validation:

  • npm test passes: 1004 tests passed.
  • npm run typecheck passes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Walkthrough

This pull request deprecates older Gemini 3 Pro model definitions and replaces them with Gemini 3.1 Pro variants. The change removes two model entries (antigravity-gemini-3-pro and gemini-3-pro-preview) from the model registry and introduces legacy aliasing logic to map old model identifiers to their Gemini 3.1 equivalents. Updated test assertions reflect the new model set and validate alias resolution behavior. Documentation examples are updated to reference the new models. Backward compatibility is maintained through model normalization during resolution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Detailed notes

Key logic changes in src/plugin/transform/model-resolver.ts:

  • Introduced LEGACY_MODEL_ALIASES mapping to translate old Gemini 3 Pro and Claude 4-5 variants to their Gemini 3.1 Pro and 4.6 equivalents
  • Added normalizeLegacyModel() function that extracts thinking tier suffixes, applies alias mapping, and reattaches suffixes when supported
  • Modified resolveModelWithTier to call normalizeLegacyModel() before quota-prefix detection and tier extraction
  • Updated resolveModelForHeaderStyle to normalize legacy models prior to quota-style transformations
  • Changed Gemini 3 Pro thinking behavior to default to "low" tier when no explicit tier exists

Test coverage expansion:

  • src/plugin/transform/model-resolver.test.ts adds comprehensive test suites for legacy model alias resolution, validating that old identifiers correctly resolve to new ones while preserving thinking levels, tiers, budgets, and quota preferences
  • Tests confirm both antigravity and gemini-cli header-style transformations work correctly with legacy model names
  • New assertions verify that stale/unavailable model IDs are not exposed in the model definitions

Configuration updates:

  • Model definitions in src/plugin/config/models.ts are simplified by removing deprecated variants
  • Test expectations across the codebase adjusted to validate the new model set
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main change: fixing stale model routing to expose current Antigravity models instead of deprecated versions.
Description check ✅ Passed The description is directly related to the changeset, providing clear details about legacy model ID mappings, config updates, stale entry removals, and test additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 win

Stale MODEL_ALIASES entries for "gemini-3-pro-low" and "gemini-3-pro-high" now point to a removed legacy model.

MODEL_ALIASES is exported, so external consumers can look up these keys directly. After this PR introduces LEGACY_MODEL_ALIASES with "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 imports MODEL_ALIASES and looks these up directly will receive a stale, no-longer-valid model string. normalizeLegacyModel (which is not exported) gates these away inside resolveModelWithTier, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 740e315 and 411261f.

📒 Files selected for processing (7)
  • README.md
  • src/plugin/config/models.test.ts
  • src/plugin/config/models.ts
  • src/plugin/config/updater.test.ts
  • src/plugin/request.test.ts
  • src/plugin/transform/model-resolver.test.ts
  • src/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". The supportsThinkingTiers guard before reattaching the tier prevents erroneously suffixing non-thinking targets (e.g. the claude-opus-4-5 → claude-opus-4-6-thinking alias with no tier present). Double-application is safe because normalized names are not present as keys in LEGACY_MODEL_ALIASES.


185-293: resolveModelWithTier post-normalization flow — LGTM.

The normalizeLegacyModel call at line 186 happens before the quota-prefix strip and the skipAlias / antigravityModel logic, so all legacy IDs are transparently upgraded before any routing decision. The tier-appending guard (isGemini3Pro && !tier && !isImageModel) correctly applies only when skipAlias is true (i.e. isAntigravity prefix present), matching the existing Antigravity API requirement for tier-suffixed Pro models.


336-384: resolveModelForHeaderStyle legacy normalization path — LGTM.

normalizeLegacyModel is 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. The hasPreviewSuffix regex /-preview($|-)/i correctly 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 normalizeLegacyModelresolveModelWithTier pipeline 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: resolveModelForHeaderStyle legacy 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 the normalizeLegacyModel-first path inside resolveModelForHeaderStyle and complement the existing non-legacy tests at lines 313–355.

src/plugin/request.test.ts (1)

1039-1097: New legacy-routing assertions in prepareAntigravityRequest — LGTM.

Both new tests correctly mirror the resolveModelForHeaderStyle behavior verified in model-resolver.test.ts: gemini-3-pro-previewgemini-3.1-pro-low for antigravity and gemini-3-pro-lowgemini-3.1-pro-preview for gemini-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 / toBeUndefined pairing 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] with toBeUndefined() (rather than the getModel helper that throws) is the correct approach for absence assertions. The Claude 4.5 coverage via Object.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-pro and the Gemini CLI table correctly uses gemini-3.1-pro-preview / gemini-3.1-pro-preview-customtools, matching the updated OPENCODE_MODEL_DEFINITIONS and the routing logic in resolveModelForHeaderStyle. The oh-my-opencode example snippets at lines 409 and 547 are updated consistently.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant