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

feat: Gemini 3.5 Flash support and openid OAuth scope#586

Closed
amartidandqdq wants to merge 1 commit into
NoeFabris:mainfrom
amartidandqdq:feat/gemini-35-flash-openid
Closed

feat: Gemini 3.5 Flash support and openid OAuth scope#586
amartidandqdq wants to merge 1 commit into
NoeFabris:mainfrom
amartidandqdq:feat/gemini-35-flash-openid

Conversation

@amartidandqdq

Copy link
Copy Markdown

Fixes #578, #572, #573. Based on PR #575 by @Daltonganger. Adds antigravity-gemini-3.5-flash-low model definition, isGemini35FlashModel() resolver, and openid scope. Fixed endpoint fallback order to daily-cloudcode-pa first (matches official agy CLI).

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR adds Gemini 3.5 Flash model support and implements transparent legacy model ID aliasing to migrate users from Gemini 3 to Gemini 3.1 models. The model catalog gains two new Gemini 3.5 Flash entries while removing the outdated Gemini 3 Pro definition. The model resolver distinguishes Gemini 3 from 3.5 variants via improved regex patterns, normalizes legacy model identifiers before routing decisions, and forces Gemini 3.5 Flash to resolve with -low tier behavior. OAuth configuration gains openid scope and Antigravity endpoints are reconfigured with simplified fallback ordering. Comprehensive tests verify legacy alias transformations and quota fallback behavior across both Antigravity and Gemini-CLI styles.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • NoeFabris/opencode-antigravity-auth#578: This PR directly addresses the reported Gemini 3.5 Flash 404 error by adding gemini-3.5-flash model definitions and implementing proper resolver logic to handle Gemini 3.5 Flash with forced -low tier behavior.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding Gemini 3.5 Flash support and the openid OAuth scope, which are the primary objectives of the PR.
Description check ✅ Passed The description relates directly to the changeset by citing specific issue numbers, referencing the base PR, and describing the key changes made (model definitions, resolver, scope, and endpoint fixes).
Linked Issues check ✅ Passed The PR addresses issue #578 by adding antigravity-gemini-3.5-flash-low model definition and fixing the endpoint fallback order to use daily-cloudcode-pa first, which resolves the 404 error from the wrong endpoint.
Out of Scope Changes check ✅ Passed All code changes are directly related to the stated objectives: model definitions for Gemini 3.5 Flash, model resolver enhancements, legacy model alias handling, and endpoint/scope updates.

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

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds antigravity-gemini-3.5-flash-low model support, migrates the primary endpoint from the deprecated sandbox URL to daily-cloudcode-pa.googleapis.com, adds the openid OAuth scope, and introduces a LEGACY_MODEL_ALIASES map so stale config entries (e.g. antigravity-gemini-3-pro, claude-opus-4-5) are transparently remapped to their current equivalents.

  • New GEMINI_35_FLASH_REGEX and GEMINI_3_NOT_35_REGEX guards correctly exclude Gemini 3.5 from Gemini-3 thinking-tier logic in resolveModelWithTier and resolveModelForHeaderStyle, but resolveModelWithVariant was not updated and retains the old includes(\"gemini-3\") check.
  • Legacy alias normalization (normalizeLegacyModel) is applied consistently in resolveModelWithTier and resolveModelForHeaderStyle; new tests cover all aliased model paths.
  • The endpoint fallback list shrinks from three entries (sandbox-daily → autopush → prod) to two (non-sandbox-daily → prod), matching the official CLI; the old sandbox constants remain exported but are not marked @deprecated.

Confidence Score: 3/5

Safe to merge only after fixing the stale Gemini-3 check in resolveModelWithVariant; all other changes are well-scoped.

The new 3.5-Flash exclusion guards are applied in resolveModelWithTier and resolveModelForHeaderStyle, but resolveModelWithVariant still uses the old includes("gemini-3") check. Any call that supplies a thinkingBudget for a Gemini 3.5 model will receive a spurious thinkingLevel on the returned object, which the 3.5 API rejects. No test exercises this path, so the bug would ship silently.

src/plugin/transform/model-resolver.ts — the resolveModelWithVariant function needs the same GEMINI_3_NOT_35_REGEX guard applied to its isGemini3 check.

Important Files Changed

Filename Overview
src/plugin/transform/model-resolver.ts Added GEMINI_35_FLASH_REGEX/GEMINI_3_NOT_35_REGEX and legacy alias normalization; resolveModelWithVariant was not updated to use the new regex (still uses includes("gemini-3")), which will misclassify Gemini 3.5 models as Gemini 3 when a thinkingBudget variant config is supplied.
src/constants.ts Added openid scope, introduced ANTIGRAVITY_ENDPOINT_DAILY_NONSANDBOX, simplified fallback chain to two entries (non-sandbox daily → prod); old sandbox exports remain without @deprecated markers.
src/plugin/config/models.ts Removed stale antigravity-gemini-3-pro definition, added antigravity-gemini-3.5-flash-low, renamed gemini-3-pro-preview to gemini-3.5-flash; changes look correct and consistent.
src/plugin/config/models.test.ts Updated model list assertions and added a stale-model guard test; test additions match the new model definitions accurately.
src/plugin/transform/model-resolver.test.ts Good new coverage for legacy alias resolution; missing a test for resolveModelWithVariant with a thinkingBudget on a Gemini 3.5 model, leaving the P1 bug untested.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming model ID] --> B[normalizeLegacyModel]
    B -->|match in LEGACY_MODEL_ALIASES| C[Canonical model ID]
    B -->|no match| C

    C --> D{Has antigravity- prefix?}
    D -->|yes| E{Gemini 3.x family?}
    D -->|no| F[resolveModelWithTier — gemini-cli / default path]

    E -->|GEMINI_3_PRO_REGEX| G[Append -low if no tier]
    E -->|GEMINI_3_FLASH_REGEX| H[Strip tier, keep bare name]
    E -->|GEMINI_35_FLASH_REGEX| I[Force -low suffix]
    E -->|other| J[Pass through]

    G --> K[actualModel]
    H --> K
    I --> K
    J --> K
    F --> K

    K --> L{Variant config thinkingBudget?}
    L -->|yes + GEMINI_3_NOT_35_REGEX needed| M[Map budget to thinkingLevel]
    L -->|yes + OLD includes check| N[Gemini 3.5 incorrectly gets thinkingLevel]
    L -->|no| O[Return ResolvedModel]
    M --> O
    N --> O
Loading

Comments Outside Diff (1)

  1. src/plugin/transform/model-resolver.ts, line 432 (link)

    P1 resolveModelWithVariant still uses the old includes("gemini-3") check (not GEMINI_3_NOT_35_REGEX) to detect Gemini 3 models. Any call with a thinkingBudget variant config for a gemini-3.5-flash model will enter the Gemini 3 branch and return a spurious thinkingLevel field, which the Gemini 3.5 API does not accept — leading to a rejected or misrouted request.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/plugin/transform/model-resolver.ts
    Line: 432
    
    Comment:
    `resolveModelWithVariant` still uses the old `includes("gemini-3")` check (not `GEMINI_3_NOT_35_REGEX`) to detect Gemini 3 models. Any call with a `thinkingBudget` variant config for a `gemini-3.5-flash` model will enter the Gemini 3 branch and return a spurious `thinkingLevel` field, which the Gemini 3.5 API does not accept — leading to a rejected or misrouted request.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
src/plugin/transform/model-resolver.ts:432
`resolveModelWithVariant` still uses the old `includes("gemini-3")` check (not `GEMINI_3_NOT_35_REGEX`) to detect Gemini 3 models. Any call with a `thinkingBudget` variant config for a `gemini-3.5-flash` model will enter the Gemini 3 branch and return a spurious `thinkingLevel` field, which the Gemini 3.5 API does not accept — leading to a rejected or misrouted request.

```suggestion
  const isGemini3 = GEMINI_3_NOT_35_REGEX.test(base.actualModel);
```

### Issue 2 of 2
src/constants.ts:34-35
**Deprecated sandbox exports lack `@deprecated` JSDoc**

`ANTIGRAVITY_ENDPOINT_DAILY` and `ANTIGRAVITY_ENDPOINT_AUTOPUSH` are now excluded from all fallback chains, and the comment explicitly says the sandbox endpoint has been deprecated. Without a `@deprecated` tag, tooling and future contributors won't get any signal that these exports should not be used in new code — especially since `ANTIGRAVITY_ENDPOINT_DAILY` has the same "daily" naming as the new `ANTIGRAVITY_ENDPOINT_DAILY_NONSANDBOX`, making them easy to confuse.

Reviews (1): Last reviewed commit: "feat: add Gemini 3.5 Flash support and o..." | Re-trigger Greptile

Comment thread src/constants.ts
Comment on lines 34 to 35
export const ANTIGRAVITY_ENDPOINT_DAILY = "https://daily-cloudcode-pa.sandbox.googleapis.com";
export const ANTIGRAVITY_ENDPOINT_AUTOPUSH = "https://autopush-cloudcode-pa.sandbox.googleapis.com";

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.

P2 Deprecated sandbox exports lack @deprecated JSDoc

ANTIGRAVITY_ENDPOINT_DAILY and ANTIGRAVITY_ENDPOINT_AUTOPUSH are now excluded from all fallback chains, and the comment explicitly says the sandbox endpoint has been deprecated. Without a @deprecated tag, tooling and future contributors won't get any signal that these exports should not be used in new code — especially since ANTIGRAVITY_ENDPOINT_DAILY has the same "daily" naming as the new ANTIGRAVITY_ENDPOINT_DAILY_NONSANDBOX, making them easy to confuse.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/constants.ts
Line: 34-35

Comment:
**Deprecated sandbox exports lack `@deprecated` JSDoc**

`ANTIGRAVITY_ENDPOINT_DAILY` and `ANTIGRAVITY_ENDPOINT_AUTOPUSH` are now excluded from all fallback chains, and the comment explicitly says the sandbox endpoint has been deprecated. Without a `@deprecated` tag, tooling and future contributors won't get any signal that these exports should not be used in new code — especially since `ANTIGRAVITY_ENDPOINT_DAILY` has the same "daily" naming as the new `ANTIGRAVITY_ENDPOINT_DAILY_NONSANDBOX`, making them easy to confuse.

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdf5f247f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +363 to +366
const isGemini3 = GEMINI_3_NOT_35_REGEX.test(lower);

if (!isGemini3) {
return resolveModelWithTier(requestedModel);
return resolveModelWithTier(normalizedModel);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle Gemini 3.5 Flash in Antigravity routing

When a user selects the newly exposed gemini-3.5-flash model with the default cli_first: false, getHeaderStyleFromUrl() chooses Antigravity quota, then this check classifies 3.5 as non-Gemini-3 and returns resolveModelWithTier() without the Antigravity transform. Since the -low suffix is only appended inside the explicit antigravity- path, the request is sent as gemini-3.5-flash even though the new comment says only the -low quota row is live; this breaks the default path for the new model unless users pick the prefixed antigravity-gemini-3.5-flash-low ID or enable CLI-first.

Useful? React with 👍 / 👎.

@amartidandqdq
amartidandqdq deleted the feat/gemini-35-flash-openid branch June 14, 2026 09:29
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.

Gemini 3.5 Flash doesn't work

1 participant