You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(antigravity): detect a host's API key and gcloud login, and offer them in Chat - #44965
If you already have a Gemini API key or a gcloud login, Antigravity Chat now finds it and offers it as a one-click button. You no longer have to know that Settings has a "Sign in with" dropdown. A small chip under the composer always shows how the chat signs in, and lets you change it.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$256
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$256
Prod
29
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1743
$\color{#cf222e}{\Huge{\mathbf{−}}}$206
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1537
What Changed
Detection RPCaccounts.antigravityChatAuthDetect (accounts-admin, no params), gated by a new capability accounts.antigravity-chat-auth-detect.v1. Older SSH/WSL hosts show no detections. It returns only flags and labels, never a secret:
the saved method;
whether Orca's managed server has a saved Google sign-in, for both personal and Enterprise;
adc: {available, project}, from GOOGLE_APPLICATION_CREDENTIALS or gcloud's default file (%APPDATA%\gcloud on Windows, ~/.config/gcloud elsewhere, or CLOUDSDK_CONFIG). The project comes from the existing resolver, which reads files and never runs gcloud;
liveChats, the number of running chats a switch would restart.
Signed-out strip becomes a chooser. Detected options come first, each a one-click switch with a hint: "Use your Gemini API key" ("Found GEMINI_API_KEY in your environment" or "Saved in Orca"), then "Use gcloud (project)". Below them are "Sign in with Google" (starts the flow right there) and "More options…". When nothing is detected, it shows "Sign in with Google" and a clear "Use an API key or gcloud instead" link to Settings.
Failure recovery. A failed sign-in with no subscription or an ineligible account now says so plainly in the strip. Antigravity transcript rows for Google auth failures (PERMISSION_DENIED, UNAUTHENTICATED, a 401/403 next to "unauthorized" or "forbidden", or an invalid API key), quota errors (RESOURCE_EXHAUSTED, "Usage limit reached") or not signed in now offer the detected alternative. Example: "This Google account has no Antigravity subscription. Use the Gemini API key found in your environment instead?" A bare 401, 403 or 429 from a tool's own request does not trigger the offer.
Method chip in the composer footer ("Gemini API key ▾", "Google Agent Platform · project ▾", …). Its menu marks the active method, tags detected ones "Detected", and sends methods that need input (Enterprise, or a key or gcloud that isn't set up) to Settings.
A switch re-reads the host first. If chats are running, or the re-read fails, it asks before applying, because antigravityChatAuthApply stops them. Starting Google sign-in from the chooser asks the same way, since the sign-in flow also stops running chats.
STA-15489: after a restart, a saved Google token (file exists and parses as JSON) seeds the host's chat auth as signed in, so Settings and the chat no longer ask to sign in again until a chat runs. It never starts the server, never overrides the server's own answer, and waits while a sign-in flow is running.
One-click switches keep a saved project and location (never Enterprise's), and detection names the same project the switch will use.
Why
A teammate reported "our agy chat is still broken, might be our GCP setup or broken for subs". People with an API key or gcloud set up don't realize Chat can use those instead of a Google subscription sign-in. #43939 added those methods, but they sat in a Settings dropdown. This puts them in front of people at the moment they're blocked.
Perf
No polling. The renderer reads on mount, on window focus, and once per new sign-in revision on the host. One shared per-host store dedupes reads and keeps the last good answer when a read fails.
On the host, detection is a few stat and small file reads, plus the shell environment chat launches already use. That one is cached and refreshed in the background at most every 10s.
Context values are memoized, and an unchanged detection keeps its reference, so surfaces don't re-render.
Tests
antigravity-chat-auth-detect.test.ts:
detection: key from the environment vs saved, ADC via gcloud vs GOOGLE_APPLICATION_CREDENTIALS, nothing found, both Google tokens, a config mid-save, the project a switch keeps, and that the key never appears in the result;
seeding: a valid token, a missing or malformed token, key and ADC methods, a newer server answer, a running flow.
antigravity-chat-auth-choices.test.ts: ranking of alternatives, menu items for current and older hosts, and failure classification, including that a tool's bare 401, 403 or 429 is ignored.
Visual Proof
Real dev Orca (this branch, rebased on main) with Orca's managed Antigravity server 1.5.0 installed from Settings. To hide ADC, Orca ran with HOME and CLOUDSDK_CONFIG pointed at empty folders, and without GEMINI_API_KEY.
Nothing detected. A send while signed out shows Google sign-in and "Use an API key or gcloud instead". The failed row stays plain, so only one Sign in shows: (screenshot removed: contained real product data)
One click on "Use gcloud", then a real reply over Agent Platform: (screenshot removed: contained real product data)
API key and gcloud both detected (GEMINI_API_KEY=dummy-not-a-real-key): (screenshot removed: contained real product data)
After a click on "Use your Gemini API key", Google rejects the dummy key. The turn fails, and the row offers the other detected method: (screenshot removed: contained real product data)
Method chip. The menu marks the active method and tags the detected ones: (screenshot removed: contained real product data)
Switching while a chat is running asks first: (screenshot removed: contained real product data)
After the switch to gcloud and a reply, the old rejected-key row no longer offers that key again: (screenshot removed: contained real product data)
STA-15489. Settings before the token is planted: (screenshot removed: contained real product data)
After a restart with a token file planted at <userData>/antigravity-chat/antigravity-acp/acp_token.json, and no server started, Settings shows Signed in: (screenshot removed: contained real product data)
Fixed during end-to-end testing (after rebasing on main)
The chooser now also appears when a model listing finds the server signed out, before the first send fails. Before, only a chat's own connection reported the signed-out state. This path was not reproduced live: a fresh chat lists models only on demand, so the chooser was seen after a send.
A rejected API key's row stopped offering the same key after the chat switched to another method.
Rebase: Google sign-in from the chooser passes main's new sign-in intent (Let Antigravity Chat Change account start a fresh sign-in #37998). The provider moved inline because main's NativeChatSurface now owns link clicks. The usage-limit offer moved into NativeChatUsageLimitRow to stay under the notice row's line limit.
Remaining gaps
A real Google sign-in and a working Gemini API key reply were not exercised. No subscription or valid key was available, so STA-15489 was checked with a planted token file.
SSH/WSL hosts, older or newer, were not exercised live. Capability gating is covered only by unit tests.
An offer can still show on an older failure row from the current method, such as a quota error.
…r them in Chat
Antigravity chats now find a Gemini API key, gcloud ADC and a saved Google
sign-in on the chat's host, rank them in the signed-out strip as one-click
switches, offer them when sign-in or a turn fails for want of a subscription
or with 401/403/quota, and show the method in use as a footer chip.
A saved Google token now reads as signed in after a restart (STA-15489).
Re-read detection before a switch so the restart confirm sees chats that
started since mount, refresh it on every sign-in revision, report each Google
method's saved sign-in, keep a saved project and location across switches,
start only Google sign-in when the method is unknown, and match only Google's
auth words for the refused offer.
…ion cheap
Google sign-in from the chooser goes through the same live-chat confirm as a
switch, and a failed detection read keeps the last answer and asks instead of
applying. Detection re-reads once per sign-in revision and reads the cached
shell environment, never a new login shell. The saved-sign-in seed waits for a
running flow.
…t gcloud keeps
A failed forced re-read can't rule out chats started since mount, so the
switch asks. A one-click gcloud switch keeps a saved project (never
Enterprise's), and detection names that same project. Detection reads the
same shell capture chats launch from, so a profile-exported key is seen
right after start.
…nds it signed out
The listing session is often the first to reach a signed-out managed server,
but only a chat's own connection answered the host's sign-in state, so the
chooser waited for a failed send. The listing now answers it too.
Once a chat moved off the API key that Google rejected, that failure row kept
offering to switch back to the same key. A rejected-key failure is now history
on any other method, as Google-only failures already were.
The change adds runtime detection for saved Google sign-in, Gemini API keys, and gcloud credentials, and exposes the results through an RPC. Native chat caches detection per host and adds controls to view and switch authentication methods. Authentication changes can require confirmation when chats are active or detection fails. Unresolved notices and usage-limit rows can display recovery actions. The change also updates signed-out probe handling and adds tests, fixtures, and localization strings.
Merge Risk: Low · up to b99d8
This adds detection and one-click selection of API-key and gcloud credentials in Antigravity Chat. A few edge cases remain: a stale model-list failure can briefly show the account as signed out, a chat started at the moment of a switch can be stopped without the confirmation prompt, and some recovery offers or Settings routes appear in the wrong situations. These are narrow, recoverable issues that are worth fixing before or soon after merge.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Out of Scope Changes check
Most changes connect to #44911. They cover key and ADC detection, the chooser, the chip, failure recovery for key and quota errors, and the related tests and i18n strings. Some changes do not map to #…
Provide the STA-15489 issue, or confirm that it is a directly linked issue, so its requirements can be compared with the token-seeding changes. Alternatively, confirm that the token-seeding changes belong in a separate PR. Provide the gener…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: Orca now detects a host's Gemini API key and gcloud login and offers them in Antigravity Chat. The raw summary confirms this focus through the detection RPC, the choos…
Description check
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Closes #44911), Visual Proof with many screenshots, Testing with test file names and a manual-testin…
Linked Issues check
[#44911] The issue asks that a user with a valid Gemini API key can start a native Chat, send a prompt, and get a reply without Google sign-in. The PR supplies the path that reaches this method. Per t…
Full details: Title check
Explanation
The title names the main change: Orca now detects a host's Gemini API key and gcloud login and offers them in Antigravity Chat. The raw summary confirms this focus through the detection RPC, the chooser, the composer chip, and the failure-recovery offers. The title is specific and uses the conventional feat(scope) form. Its length of 83 characters is acceptable.
Full details: Description check
Explanation
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Closes #44911), Visual Proof with many screenshots, Testing with test file names and a manual-testing note, Perf, and Remaining gaps. Several template sections are only partly filled in. The Risk section has no Level value and no backout plan. The Testing checkboxes are not ticked, and the checklist is not marked. The AI Disclosure section is blank, and the Review and Agent skill upstream boundary sections are absent. Overall the description is mostly complete, so the check passes, but the Risk section and the missing disclosure need attention.
Full details: Linked Issues check
Explanation
[#44911] The issue asks that a user with a valid Gemini API key can start a native Chat, send a prompt, and get a reply without Google sign-in. The PR supplies the path that reaches this method. Per the PR description, the Gemini API-key method already exists from #43939 in a Settings dropdown. This PR adds: (1) accounts.antigravityChatAuthDetect, which reports apiKey: {available, source: 'saved' | 'environment'} without returning the secret; (2) a signed-out chooser with a one-click 'Use your Gemini API key' option; (3) a composer chip that switches the method; and (4) failure-row offers that switch to the key method. The visual proof shows the key path sends the request to Google. Image 5 and the 'invalid key recovery' step show Google rejecting the dummy key, so the key reaches the backend. A reply with a valid key was not exercised live, as the PR states. Code paths for the request itself were not changed in the summary, so the valid-key reply depends on the pre-existing #43939 behavior. No automated test in the summary covers a valid-key reply end to end. The coding objective of exposing and selecting the key method is implemented. The unverified live reply is a residual risk, not a demonstrated gap.
Full details: Out of Scope Changes check
Explanation
Most changes connect to #44911. They cover key and ADC detection, the chooser, the chip, failure recovery for key and quota errors, and the related tests and i18n strings. Some changes do not map to #44911's requirements. These are: (a) saved Google token seeding in antigravity-chat-saved-sign-in.ts, seedAntigravityChatAuth, and the ANTIGRAVITY_OAUTH_TOKEN_FILES move in antigravity-sign-in-server.ts; (b) the Google sign-in confirmation and restart behavior tied to running chats; and (c) the subscription and ineligible sign-in messages in antigravity-sign-in-sentences.ts. The PR states that item (a) fixes STA-15489. STA-15489 is not in the linked issue set, so its requirements cannot be checked here. Item (a) has no clear link to a Gemini API key. Items (b) and (c) may follow from the chooser UI, but this was not confirmed. Also, src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by the !**/*.generated.* rule. Its contents were not inspected, so the RPC catalog registration for the new method cannot be confirmed from the available evidence.
Resolution
Provide the STA-15489 issue, or confirm that it is a directly linked issue, so its requirements can be compared with the token-seeding changes. Alternatively, confirm that the token-seeding changes belong in a separate PR. Provide the generated RPC catalog evidence by another path, or confirm that the generated catalog includes accounts.antigravityChatAuthDetect with the capability gate.
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.
193-193: Minor · Stability & Availability · Poor tradeoff
Recheck live chats inside the launch gate before stopping them.
The count that decide() reads can be stale when the apply runs. applyAntigravityChatAuthMethod awaits a config read and a config write before accounts.antigravityChatAuthApply reaches applyAntigravityChatAuthConfig. A chat that starts during those awaits is loaded when ANTIGRAVITY_LAUNCH_GATE.run(stopLiveChats, …) runs. stopStructuredAgentChats then closes it without the confirmation the dialog shows.
The host must count running Antigravity chats inside the launch gate, before it stops them. If chats are running and the request is not already confirmed, the host must return a confirmation-required result and stop nothing. A confirmed request must still stop running chats.
The impact is narrow. The window spans a few RPC round trips, and a new chat must start within it. In that case, one reply in progress stops, and the conversation remains.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5b4648d4-692e-4ace-99aa-2380583222ff
Commits
Reviewing files that changed from the base of the PR and between d3a843d and b99d84a.
Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Stability & Availability · Quick win
Guard the signed-out answer against newer sign-in state.
signedOutAsUnavailable calls answerSignIn(false) for any -32000 failure from a listing run. answerAntigravityChatAuth then sets the shared auth state to signedOut with no revision or operation check. A listing that started before a sign-in, and fails after that sign-in publishes signedIn, can therefore overwrite the newer state. The chooser then shows the account as signed out even though the sign-in succeeded.
Only record the signed-out answer when it is still the newest sign-in state. Skip it when the listing operation has been superseded, or when a newer sign-in answer has already been recorded. The guard must run before answerAntigravityChatAuth writes.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Restrict managed authentication switches to managed chats.
For backend === 'agy', this action still writes Orca's managed authentication configuration. The supplied recovery component can render this action without checking backend. The action can report success, but the affected agy chat retains its own login.
Do not offer managed credential recovery for an agy target. Provide guidance for the host's agy authentication instead.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Keep a Settings action available during sign-in.
If sign-in waits in the browser and view.openFailed is false, this condition hides the Settings action. The other conditions also hide the chooser and fallback action. On an older host with null detection, the auth chip is absent too.
The user then loses the in-chat route to the cancellation controls in Settings. Show this action whenever signingIn is true, or provide a direct Cancel action. Keep the existing recovery route when browser opening fails.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Hide authentication recovery on historical usage-limit rows.
When a later turn makes active false, UsageLimitCard removes the row's recovery controls. This new child still classifies the stored failure as usageLimit and offers any detected alternative. An old, resolved limit can therefore keep suggesting a host-wide authentication change.
Render NativeChatNoticeAuthRecovery only when props.active is true. This preserves the offer for the current usage-limit stop.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Refresh when the first known revision arrives.
A mount read can capture method A before another client saves method B. If the first sign-in snapshot then contains B's revision, this branch records the revision without scheduling another read. The pending read can subsequently publish A.
Queue a forced read for the first known revision too, or establish that the pending read started after that revision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
If you already have a Gemini API key or a gcloud login, Antigravity Chat now finds it and offers it as a one-click button. You no longer have to know that Settings has a "Sign in with" dropdown. A small chip under the composer always shows how the chat signs in, and lets you change it.
What Changed
accounts.antigravityChatAuthDetect(accounts-admin, no params), gated by a new capabilityaccounts.antigravity-chat-auth-detect.v1. Older SSH/WSL hosts show no detections. It returns only flags and labels, never a secret:apiKey: {available, source: 'saved' | 'environment'};adc: {available, project}, fromGOOGLE_APPLICATION_CREDENTIALSor gcloud's default file (%APPDATA%\gcloudon Windows,~/.config/gcloudelsewhere, orCLOUDSDK_CONFIG). The project comes from the existing resolver, which reads files and never runs gcloud;liveChats, the number of running chats a switch would restart.antigravityChatAuthApplystops them. Starting Google sign-in from the chooser asks the same way, since the sign-in flow also stops running chats.agy, the chip reads "agy sign-in" and still offers the API key and gcloud for new chats. This works under either backend rule (today's, or fix(antigravity): run new chats on a signed-in agy so chat, quota and the picked account agree #44943's); nothing here depends on fix(antigravity): run new chats on a signed-in agy so chat, quota and the picked account agree #44943.Why
A teammate reported "our agy chat is still broken, might be our GCP setup or broken for subs". People with an API key or gcloud set up don't realize Chat can use those instead of a Google subscription sign-in. #43939 added those methods, but they sat in a Settings dropdown. This puts them in front of people at the moment they're blocked.
Perf
statand small file reads, plus the shell environment chat launches already use. That one is cached and refreshed in the background at most every 10s.Tests
antigravity-chat-auth-detect.test.ts:GOOGLE_APPLICATION_CREDENTIALS, nothing found, both Google tokens, a config mid-save, the project a switch keeps, and that the key never appears in the result;antigravity-chat-auth-choices.test.ts: ranking of alternatives, menu items for current and older hosts, and failure classification, including that a tool's bare 401, 403 or 429 is ignored.Visual Proof
Real dev Orca (this branch, rebased on main) with Orca's managed Antigravity server 1.5.0 installed from Settings. To hide ADC, Orca ran with
HOMEandCLOUDSDK_CONFIGpointed at empty folders, and withoutGEMINI_API_KEY.Nothing detected. A send while signed out shows Google sign-in and "Use an API key or gcloud instead". The failed row stays plain, so only one Sign in shows:
(screenshot removed: contained real product data)
gcloud ADC detected (real
application_default_credentials.json):(screenshot removed: contained real product data)
One click on "Use gcloud", then a real reply over Agent Platform:
(screenshot removed: contained real product data)
API key and gcloud both detected (
GEMINI_API_KEY=dummy-not-a-real-key):(screenshot removed: contained real product data)
After a click on "Use your Gemini API key", Google rejects the dummy key. The turn fails, and the row offers the other detected method:
(screenshot removed: contained real product data)
Method chip. The menu marks the active method and tags the detected ones:
(screenshot removed: contained real product data)
Switching while a chat is running asks first:
(screenshot removed: contained real product data)
After the switch to gcloud and a reply, the old rejected-key row no longer offers that key again:
(screenshot removed: contained real product data)
STA-15489. Settings before the token is planted:
(screenshot removed: contained real product data)
After a restart with a token file planted at
<userData>/antigravity-chat/antigravity-acp/acp_token.json, and no server started, Settings shows Signed in:(screenshot removed: contained real product data)
Linked Issue
Closes #44911. Follows #43939. Fixes STA-15489.
Fixed during end-to-end testing (after rebasing on main)
NativeChatSurfacenow owns link clicks. The usage-limit offer moved intoNativeChatUsageLimitRowto stay under the notice row's line limit.Remaining gaps