Repository navigation
Conversation
…shes agy >= 1.4.7 stores `id_token_email` instead of the signed `id_token`, and Google's refresh responses carry no new `id_token`. Without a local `sub`, the matcher fell back to comparing whole credential strings, so every silent access-token refresh made the selected account look different and `prepareForLaunch` refused new agy launches. When the native credential has no `id_token` identity, ask Google's tokeninfo endpoint for the stable `sub` of the access token agy already holds. The token goes only in the HTTPS POST body (no URL, no logs), redirects are refused, answers are cached by token hash, and any failure keeps the previous fail-closed behaviour. Credentials that still carry an `id_token` never touch the network. Fixes stablyai#31579
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2

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:
d85909ce-74a5-46ac-b81a-f8a937bc3c3a
Files selected for processing: 5-
src/main/antigravity/native-account-host.tssrc/main/antigravity/native-account-service.test.tssrc/main/antigravity/native-account-service.tssrc/main/antigravity/native-identity-resolver.test.tssrc/main/antigravity/native-identity-resolver.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
| throw new Error('Select another Antigravity account before removing this account.') | ||
| } | ||
| const readback = await this.backend.read() | ||
| const readback = await this.readNative() |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
sed -n '70,165p' src/main/antigravity/native-account-service.tsRepository: stablyai/orca
Length of output: 4110
Script executed:
set -o pipefail printf '%s\n' '--- service definitions ---' sed -n '1,85p' src/main/antigravity/native-account-service.ts sed -n '150,230p' src/main/antigravity/native-account-service.ts printf '%s\n' '--- related types and implementations ---' rg -n -F --glob '*.ts' -e 'interface AntigravityAccountStore' -e 'type AntigravityAccountStore' -e 'class Antigravity' -e 'updateSnapshot' -e 'function matches' -e 'const matches' src/main/antigravity src/main/runtime/rpc/methods/antigravity-accounts.ts || test "$?" -eq 1 printf '%s\n' '--- tests around removal and reconciliation ---' rg -n -F --glob '*native-account-service.test.ts' -e 'removeAccount' -e 'reconcile' -e 'selectedAccountId' -e 'resolver' src/main/antigravity sed -n '1,240p' src/main/antigravity/native-account-service.test.ts
Repository: stablyai/orca
Length of output: 18756
Script executed:
set -o pipefail printf '%s\n' '--- account store ---' sed -n '1,220p' src/main/antigravity/native-account-store.ts printf '%s\n' '--- test fixture ---' sed -n '1,260p' src/main/antigravity/native-account-test-fixtures.ts printf '%s\n' '--- base-to-head diff for service ---' git diff --unified=30 fda92862c4c250e1c2b1373dbe46969887949848 af8dc81930a579f2e969e5f843fad40f2812abb1 -- src/main/antigravity/native-account-service.ts
Repository: stablyai/orca
Length of output: 14053
Block removal when the current identity is unresolved.
After a silent token rotation, readNative() can return the current credential without identity when resolution returns null. matches() then compares the rotated contents with the saved contents and can fail. If the current account is not selected, both removal guards can fail, so removeAccount() deletes that account's saved snapshot.
Reject removal when the native credential is present but has unresolved identity.
Suggested fix
-
- if (vault.selectedAccountId === id || (current && matches(account, current))) { + if ( + vault.selectedAccountId === id || + (current && (!current.identity || matches(account, current))) + ) { throw new Error('Select another Antigravity account before removing this account.') } @@ - if (latest.selectedAccountId === id || (readback && matches(latestAccount, readback))) { + if ( + latest.selectedAccountId === id || + (readback && (!readback.identity || matches(latestAccount, readback))) + ) { throw new Error('Select another Antigravity account before removing this account.') }
| if (cache.size >= MAX_CACHE_ENTRIES) { | ||
| cache.clear() | ||
| } | ||
| cache.set(key, identity) |
There was a problem hiding this comment.
Do not cache transient lookup failures indefinitely.
If tokeninfo times out or returns a server error, identity remains null, and this line caches it. Later reads of the same access token return null without retrying. As a result, prepareForLaunch() can keep rejecting the selected account after the service recovers, until the token changes or the cache is cleared. Cache confirmed identities only, or give failed lookups a short expiry. Google also warns that tokeninfo requests can encounter intermittent errors. (developers.google.com)
|
Thanks @biojuho! The fix landed in #33656 (merged, with your co-author credit). We matched the refreshed credential by refresh token instead of a tokeninfo lookup: saving an id_token-less snapshot made the vault's read check reject every Accounts read, and tokeninfo fails once the access token expires. Closing in favor of #33656. |
…oken (#33656) After agy silently refreshes its Google token (the new credential has no id_token), Orca still matches the saved Antigravity account by auth method + refresh token instead of refusing the launch with "native Antigravity account changed"; the vault accepts such refreshed snapshots while still rejecting one whose id_token names a different account. Fixes #31579 Supersedes #33204 Co-authored-by: biojuho <258838639+biojuho@users.noreply.github.com> Co-authored-by: Manan <100475418+thefrikidude@users.noreply.github.com>
ELI5
When
agyquietly renews its login token (about once an hour), Orca thought the signed-in Antigravity account had changed and refused to start newagysessions until you re-selected the account. This keeps the selection working across those renewals by asking Google which account the token belongs to.What Changed
matches()identifies the native account by thesubin the storedid_token.agy>= 1.4.7 no longer stores the signedid_token(it keepsid_token_emailand the token only), and Google's refresh responses carry no newid_token. With no localsub,matches()falls back to comparing the whole credential string, which changes on every refresh, soprepareForLaunch()throws "The native Antigravity account changed…" and the account cannot be re-saved either (identityKnown: false).AntigravityAccountServiceaccepts an optional identity resolver. Each native read without anid_tokenidentity is resolved through Google's tokeninfo endpoint to the stablesubof the access token agy already holds, so selection, active-account display, snapshot refresh and the launch check keep working. The host service wirescreateGoogleTokeninfoIdentityResolver().id_tokenbehave exactly as before and never touch the network.Observed Keychain shape on macOS with
agy1.4.7 (values redacted):{"auth_method":"consumer","id_token_email":"…","token":{"access_token":"…","refresh_token":"…","token_type":"Bearer","expiry":"…","expires_in":…}}.Why
The existing design deliberately refuses to derive identity from rotating secrets or an unverified email (see does not fabricate a stable identity from rotating secrets or an email). Asking Google, the issuer, for the token's
subkeeps that rule: the identity is still Google'ssub, not a refresh token or email. Alternatives considered: matching byrefresh_token(rotation is not guaranteed stable, and the existing fixtures treat it as rotating) and matching byid_token_email(unverified label, same account could be re-labelled).Safety: the token is sent only in the HTTPS POST body to
https://oauth2.googleapis.com/tokeninfo(never in the URL or logs), redirects are refused (redirect: 'error'), the request times out after 5 s, answers are cached in memory by a SHA-256 of the token (a refresh changes the key, so at most one call per token), and any failure leavesidentity: null, i.e. the previous fail-closed behaviour. A different Googlesubstill refuses the launch.Linked Issue
Fixes #31579
Visual Proof
N/A — no UI change. The visible effect is that "The native Antigravity account changed. Select the account again in Accounts before launching agy." no longer appears after a silent token refresh of the same account.
Testing
Automated tests added/updated
I manually tested these changes locally (not in a built app; see below)
native-account-service.test.ts: new block for [Bug]: Selected Antigravity account is lost after a silent token refresh; new launches fail with "The native Antigravity account changed" (macOS) #31579 — the selected account stays launchable after a refresh drops theid_token; still refuses when Google cannot confirm the account or names a differentsub; never calls the resolver for credentials that carry anid_token. The first test fails onmainand passes with this change.native-identity-resolver.test.ts: live-answer parsing (sub, expiry,email_verified), POST-body-only token transport,redirect: 'error', per-token caching, no network forid_tokencredentials, null on 400 / network error / malformed JSON / malformed token.Ran with vitest 5.0.5 in a sparse checkout (macOS, Apple Silicon):
native-account-service,native-identity-resolver,native-credential-codec— 36 passed.oxlint0 warnings,oxfmt --checkclean,tsc --strictshows no errors in the changed files. I could not run the fullpnpm lint/typecheck/test/build(sparse checkout without the workspace packages); relying on CI for those.Real-world check of the premise: on Orca 1.4.238 with
agy1.4.7, the macOS Keychain item holdsid_token_emailand noid_token, and Google tokeninfo for the stored access token returns the expectedsub/email/email_verifiedfor the native AGY OAuth client.AI Disclosure
Prepared with an AI coding agent (Antigravity, Claude Opus 5.5) under my review: investigation of the shipped bundle and local credential shape, the patch and the tests.
Review
Agent skill upstream boundary
Notes
Security: token only to Google over HTTPS POST body, no logging, no redirects, fail-closed. Cross-platform: platform-independent; runs only for host-runtime account management (WSL/SSH paths unchanged). Remote SSH / Mobile: unaffected. Backwards compatibility:
id_tokencredentials take the old path; the resolver parameter is optional. Performance: at most one tokeninfo call per access token (about hourly), cached in memory.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — targeted local checks only, CI will cover the rest