Skip to content

fix(gemini): honor provider routing on native generation - #9066

Open
luvs01 wants to merge 3 commits into
lidge-jun:devfrom
luvs01:codex/gemini-native-provider-egress
Open

luvs01 wants to merge 3 commits into
lidge-jun:devfrom
luvs01:codex/gemini-native-provider-egress

Conversation

@luvs01

@luvs01 luvs01 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Apply the Antigravity provider’s proxy and noProxy settings when native Gemini generation sends a request. Resolve the route for the final URL on every send, including the retry after OAuth refresh. The default transport inherits the process settings when the provider has no override. Token exchange and refresh themselves retain the process-wide route.

Verification

  • At e436084a2 with dev 3ec89d266 merged, Windows x64 and Bun 1.4.4 passed all six selected routing cases in tests/server/gemini-native.test.ts (34 assertions). They cover process NO_PROXY conflicts before dispatch, opaque executors, and four routes across OAuth refresh. Typecheck passed for 2,701 files. structure:check, privacy:scan, and git diff --check passed. The local run focused on the changed route while other Windows validations shared the test host. Broader coverage is left to PR CI.

Earlier validation at 2deaa9369

  • Windows, Bun 1.4.4. The six focused test files passed all 101 tests. The new cases use a mocked transport for inherited, explicit proxy, direct, and host-specific routes across a refresh. A separate case checks that an incompatible custom transport receives no request.
  • bun check --no-script --noEmit passed for 2,691 files. The structure and privacy checks passed. The docs build produced 820 pages and the internal link check passed.
  • Independently reviewed the dispatch, redirect, cancellation, retry, and request-slot handling. Local validation focused on the changed transport and its adjacent contracts. The full local suite and live Google account traffic were outside this run.

Checklist

  • Scope is limited to the native Gemini generation transport and its regression coverage.
  • Updated the native data-plane contract and operator reference.
  • Reviewed route inheritance, OAuth retry boundaries, and client-facing errors. Maintainer review is requested.

Summary by CodeRabbit

  • New Features
    • Native Gemini requests now honor the Antigravity provider’s configured outbound proxy and noProxy settings, including retries after credential refresh.
  • Bug Fixes
    • Conflicting proxy settings or invalid egress configuration now return a 503 response with configuration guidance before a generation request is sent.
  • Documentation
    • Clarified that native generation uses the provider’s outbound proxy settings, while OAuth token exchange and refresh use the process-wide route.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Native Gemini generation now uses the Antigravity provider’s proxy settings for outbound sends. The handler selects an outbound executor, applies proxy and noProxy policy, and returns a 503 error for invalid egress configuration. Tests cover initial sends and retries after credential refresh.

Changes: Native Gemini proxy routing

Layer / File(s) Summary
Configure and validate native Gemini egress
src/server/gemini-native.ts, structure/data-planes/gemini-native.md, tests/server/gemini-native.test.ts, docs-site/src/content/docs/reference/proxy-formats.md
The handler applies provider proxy settings and noProxy policy to each physical send through the selected outbound executor. Invalid egress configuration returns a 503 error before dispatch. Tests cover inherited, explicit, direct, and provider-noProxy routing on initial sends and retries. The documentation distinguishes native-generation routing from OAuth token exchange and refresh routing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant NativeGemini as handleGeminiNative
  participant Egress as providerEgressSendInit
  participant Fetch as nativeOutboundFetch
  participant Antigravity as Antigravity endpoint
  NativeGemini->>Egress: Build request options from provider settings and URL
  Egress-->>NativeGemini: Return egress request options
  NativeGemini->>Fetch: Send POST with egress options
  Fetch->>Antigravity: Dispatch request through selected route
  Antigravity-->>Fetch: Return response
  Fetch-->>NativeGemini: Return response
Loading

Possibly related PRs

Suggested reviewers: liang-psych

Merge Risk: Minimal · up to e4360

Native Gemini generation now follows the Antigravity provider's proxy and noProxy settings, and invalid egress configuration returns a clear 503 before any request is sent. No merge-blocking risk was identified. The change is easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(gemini): honor provider routing on native generation" matches the main change. The PR applies the Antigravity provider's proxy and noProxy settings to native Gemini generation, includin…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(gemini): honor provider routing on native generation" matches the main change. The PR applies the Antigravity provider's proxy and noProxy settings to native Gemini generation, including the retry after OAuth refresh. The title names the core behavior. It does not mention the 503 guard for conflicting proxy and NO_PROXY settings, which is a secondary part of the change. The title is specific and concise.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2deaa93 and e436084.

Files selected for processing: 3

  • src/server/gemini-native.ts
  • structure/data-planes/gemini-native.md
  • tests/server/gemini-native.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 23, 2026
@luvs01
luvs01 marked this pull request as ready for review November 23, 2026 03:03

This branch has not been deployed

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant