Skip to content

Conversation

@truongsinh
Copy link

This PR fixes an issue where selecting the gemini-3-pro-preview model (Gemini CLI) would still consume Antigravity quota because of a hardcoded override in getHeaderStyleFromUrl.

Changes

  1. src/plugin/transform/model-resolver.ts: Updated preferGeminiCli logic to explicitly include gemini-3-pro-preview (when not using the antigravity- prefix).
  2. src/plugin.ts: Removed the logic that forced quotaPreference back to "antigravity" even when "gemini-cli" was resolved.

Impact

Users can now correctly route gemini-3-pro-preview requests to the Gemini CLI quota pool by selecting that model, instead of being forced into the Antigravity pool.

This change removes the hardcoded override that forced all models to use the 'antigravity' header style, allowing models explicitly configured for 'gemini-cli' quota (like gemini-3-pro-preview) to actually use it.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

These changes modify how Gemini CLI quota preference is handled across two files. The first change in getHeaderStyleFromUrl removes special-case conversion that was mapping gemini-cli quota to antigravity, allowing "gemini-cli" to be returned as a distinct header style when appropriate. The second change in model-resolver.ts broadens the condition for preferring Gemini CLI quota to include cases where the requested model is "gemini-3-pro-preview", in addition to the existing cli_first option check.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the main change: allowing gemini-3-pro-preview to use gemini-cli quota instead of antigravity quota.
Description check ✅ Passed The description is clearly related to the changeset, explaining the issue being fixed and detailing the specific changes made to two files.

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

Copy link
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)

152-175: ⚠️ Potential issue | 🟡 Minor

Stale doc comment contradicts new behavior.

Line 154 documents "gemini-3-pro-preview" → { quotaPreference: "antigravity" }, but the code change on line 174 now routes it to "gemini-cli". Update the example to reflect the new behavior.

📝 Proposed fix
- * - "gemini-3-pro-preview" → { quotaPreference: "antigravity" }
+ * - "gemini-3-pro-preview" → { quotaPreference: "gemini-cli" }
📜 Review details

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 28f46c2 and 2d9daf6.

📒 Files selected for processing (2)
  • src/plugin.ts
  • src/plugin/transform/model-resolver.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/plugin/transform/model-resolver.ts (2)
src/plugin/transform/index.ts (1)
  • isClaudeModel (35-35)
src/plugin/transform/claude.ts (1)
  • isClaudeModel (27-29)
🔇 Additional comments (1)
src/plugin.ts (1)

2738-2748: LGTM!

The removal of the override that forced "gemini-cli" back to "antigravity" is the correct fix. The ?? "antigravity" fallback is a safe defensive default since quotaPreference is always set in resolveModelWithTier.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 9, 2026

Greptile Overview

Greptile Summary

This PR updates Gemini quota routing so gemini-3-pro-preview can use the Gemini CLI quota pool instead of being forced onto Antigravity quota.

  • src/plugin.ts removes a hardcoded override in getHeaderStyleFromUrl that mapped quotaPreference === "gemini-cli" back to an Antigravity header style.
  • src/plugin/transform/model-resolver.ts expands the preferGeminiCli condition to include gemini-3-pro-preview.

Main concern: resolveModelWithTier() now routes gemini-3-pro-preview to Gemini CLI even when cli_first is not enabled, which appears to contradict the function’s documented default behavior and may change routing semantics for users who did not explicitly opt into CLI-first.

Confidence Score: 3/5

  • This PR is moderately safe to merge, but it changes default quota routing for a specific model and should be clarified/fixed before merging.
  • The getHeaderStyleFromUrl fix is straightforward, but the resolver change makes gemini-3-pro-preview prefer Gemini CLI even when cli_first is false, which can unintentionally reroute traffic and contradict existing documented behavior.
  • src/plugin/transform/model-resolver.ts

Important Files Changed

Filename Overview
src/plugin/transform/model-resolver.ts Updates quota routing logic to prefer Gemini CLI for gemini-3-pro-preview; this changes default quota behavior for that model without requiring cli_first.
src/plugin.ts Removes hardcoded mapping that forced resolved gemini-cli quotaPreference back to antigravity in getHeaderStyleFromUrl.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Plugin as src/plugin.ts
  participant Resolver as src/plugin/transform/model-resolver.ts

  Client->>Plugin: Request URL /models/{model}...
  Plugin->>Plugin: getModelFamilyFromUrl(url)
  Plugin->>Plugin: extractModelFromUrlWithSuffix(url)
  Plugin->>Resolver: resolveModelWithTier(modelWithSuffix)
  Resolver-->>Plugin: {quotaPreference, explicitQuota, ...}
  Plugin-->>Client: HeaderStyle = quotaPreference ?? "antigravity"

  alt headerStyle == "gemini-cli"
    Note over Client,Plugin: Requests routed to Gemini CLI quota pool
  else headerStyle == "antigravity"
    Note over Client,Plugin: Requests routed to Antigravity quota pool
  end
Loading

Copy link
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.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 9, 2026

Additional Comments (1)

src/plugin/transform/model-resolver.ts
Preview model forces CLI

preferGeminiCli is now true whenever modelWithoutQuota === "gemini-3-pro-preview", regardless of options.cli_first. That makes resolveModelWithTier("gemini-3-pro-preview") return quotaPreference: "gemini-cli" even when the user didn’t opt into CLI-first routing, which changes the documented default behavior (“All models default to Antigravity quota unless cli_first is enabled”). If the intent is only to fix the “headerStyle override” bug, this should likely be handled in the URL/header-style resolution path rather than changing the default quota routing for this model.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/plugin/transform/model-resolver.ts
Line: 160:162

Comment:
**Preview model forces CLI**

`preferGeminiCli` is now true whenever `modelWithoutQuota === "gemini-3-pro-preview"`, regardless of `options.cli_first`. That makes `resolveModelWithTier("gemini-3-pro-preview")` return `quotaPreference: "gemini-cli"` even when the user didn’t opt into CLI-first routing, which changes the documented default behavior (“All models default to Antigravity quota unless cli_first is enabled”). If the intent is only to fix the “headerStyle override” bug, this should likely be handled in the URL/header-style resolution path rather than changing the default quota routing for this model.

How can I resolve this? If you propose a fix, please make it concise.

PhucTruong-ctrl added a commit to PhucTruong-ctrl/opencode-antigravity-auth that referenced this pull request Feb 9, 2026
gemini-3-pro-preview is a CLI-specific model that should always route
to gemini-cli quota pool, not antigravity.

Based on PR NoeFabris#408 by truongsinh.
@NoeFabris
Copy link
Owner

Hey @truongsinh, that is not a bug, you need to set cli_first: true in antigravity.json if you want to use the cli quota first.

@NoeFabris NoeFabris closed this Feb 9, 2026
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.

2 participants