Skip to content

fix(antigravity): list agy accounts without reading its keychain login - #51276

Merged
AmoabaKelvin merged 5 commits into
mainfrom
fix/antigravity-accounts-without-keychain-prompt
Nov 28, 2026
Merged

AmoabaKelvin merged 5 commits into
mainfrom
fix/antigravity-accounts-without-keychain-prompt

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Opening Settings → Accounts → Antigravity used to read agy's saved Google login out of the macOS keychain. When macOS wanted to ask "allow Orca to use this item?" or "unlock the keychain", Orca gave up after 3 seconds, so people who were signed in saw "Couldn't load agy accounts". Now the list only looks at the keychain item's label and date, which never asks, and reads the login itself only when you click something that needs it.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​677 $\color{#cf222e}{\Huge{\mathbf{−}}}$​131 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​546

What Changed

Before: every time the Antigravity section loaded (and every orca accounts listing, every chat start, every terminal agy launch with a saved account selected) Orca ran security find-generic-password -s gemini -a antigravity -w with a 3 s timeout. Any keychain dialog (access or unlock) timed out, and Deny, Cancel and no-GUI all became "The Antigravity macOS credential store could not be read."

After (macOS keychain):

  • List reads only the item's attributes (no -w, no dialog). It names the account from Orca's last read of the login while the item is unchanged: the attributes are hashed into a fingerprint, and mdat changes whenever agy rewrites the login. The name is kept in Orca's encrypted account vault so it survives a restart. If agy rewrote the login since, the row says agy is signed in with a Show account button, and no saved account is marked active.
  • Explicit actions (Show account, Save, Select, Remove, Add account) read the login and wait up to 60 s for the dialog to be answered. Errors now say what happened: "Orca was denied access to agy's login in the keychain. Allow it when asked to show or switch accounts." (Deny/Cancel) or "The keychain didn't answer. Unlock it and try again." (timeout, locked with no dialog).
  • Terminal agy launches with a selected account skip the read while the cached login is the selected one. Otherwise they read once (60 s). A refused read isn't asked again until agy's login changes.
  • Chat starts decide from the cache without queueing. When the cache is stale, they put the selected account back with every keychain read and write limited to 3 s, as reads were before. They skip while another account action may be waiting on a dialog. Once a brief attempt fails, chats stop asking until a read that can wait for the dialog succeeds. A chat start never waits on a dialog.
  • orca accounts uses the same List, and Select and Remove wait 90 s.

The keychain fingerprint only vouches for a read that began after the item's one-second mdat, so a second write in the same second can't be mistaken for the login Orca read.

Linux keyring, Windows Credential Manager, WSL and the token-file store are unchanged: their reads never raise a dialog, so they keep reading the login directly.

Why

The list's job is to show what agy holds, and it was reading the secret to do it on every open, where a dialog can appear and can't be answered in time. #24691 assumed reading agy's keychain item was silent. That holds only while the item's access list trusts /usr/bin/security and the keychain is unlocked. #39006 already added a prompt-free attribute read for chat sign-in checks, but the account list never used it. #48305 made these rows the main Antigravity block, so far more people now hit the error.

Alternatives considered:

Linked Issue

No GitHub issue. Reported against v1.4.280 on macOS.

Visual Proof

Before: a signed-in user whose keychain read needs a dialog.

before-list-error.dark.png

After: agy is signed in and the login changed since Orca last read it (two saved accounts, one selected).

after-signed-in-unread.dark.png
after-signed-in-unread.light.png

After: Show account, then Deny in the keychain dialog.

after-denied.dark.png

After: even the attribute read got no answer.

after-no-answer.dark.png

Component fixtures (pnpm fixtures:shot settings/accounts/providers/AntigravityAgyAccountRows).

Testing

  • Throwaway keychain in /tmp (security create-keychain, test item, deleted after): the attribute read is the same on repeated calls, mdat and the hash change on add-generic-password -U, and a missing item exits 44. The real gemini item was never read.

  • native-account-store.test.ts: on a keychain-style backend, List never reads the login; the name survives a restart through the encrypted vault while the item is unchanged; a rewrite makes it unread; a launch reads once and List names it again; a chat's failed brief read stops chat reads; a launch's refused read isn't repeated under the same revision. Fails on main, where List reads the login.

  • native-macos-credentials.test.ts: the revision read never passes -w or -g, parses mdat (UTC, whole seconds), and changes with it. Exit-code mapping (51/128 denied, timeout/36 no answer) was checked with an injected process runner and not committed.

  • Focused tests for antigravity-accounts.test.ts, antigravity-chat-route.test.ts and the agy-home launch tests pass. pnpm check:changed passes.

  • macOS only, from code and unit tests. Orca wasn't launched and agy's real login was never read.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Performance

Fewer keychain subprocesses on every hot path. List, chat starts and launches whose cached login matches each run one attribute read instead of a secret read. An explicit read adds two attribute reads (before and after). The vault is written only when the cached login changes, never from a chat start. Chat starts no longer wait in the account queue behind a read that may be waiting on a dialog. Nothing polls and nothing grows: one in-memory last read per account service.

Risk

The riskiest part is the cache: if it named the wrong account, a terminal launch could skip putting the selected account back. It only vouches when the keychain item's attributes are unchanged since a read that began after the item's last modification second. Any agy refresh changes them, and then Orca reads again on the next launch.

Older clients talking to a newer host get currentAccount with no email for an unread login. They show "agy didn't report an email · not saved", and Save reads the login, so nothing breaks. The vault field is optional: older builds drop it and Orca reads again when asked. A plain revert is safe.

Level: Medium

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Antigravity account handling now supports quiet keychain revision reads, verified login identity caching, and launch preparation that can avoid prompting. A new RPC and settings action allow the current login to be read when its identity is unread. The account client and CLI use the configured timeouts for account actions.

Merge Risk: Low · up to 35f1c · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(antigravity): list agy accounts without reading its keychain login" matches the main change. On macOS, the account List now reads only keychain attributes and does not read the secret, …
Description check Passed The description follows the repository template closely. It has ELI5, What Changed (before and after, plus mechanism), Why (with alternatives considered), Linked Issue, Visual Proof with before and af…
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.
Full details: Title check

Explanation

The title "fix(antigravity): list agy accounts without reading its keychain login" matches the main change. On macOS, the account List now reads only keychain attributes and does not read the secret, so it no longer triggers keychain dialogs. The title is specific and accurate, though it does not mention the cached-name or explicit-action behavior, which is expected for a short title.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed (before and after, plus mechanism), Why (with alternatives considered), Linked Issue, Visual Proof with before and after images, Testing with a checklist, Performance, Risk with level and rollback notes, AI Disclosure, and Checklist. The Linked Issue section says there is no GitHub issue, and the template requires one for outside contributors. The Performance section is filled in. The AI Disclosure section is empty. The Agent skill boundary is checked. The Review and Notes sections are partly filled. The lint, typecheck, test, and build checklist item is unchecked, and the author notes CI or local runs will cover it. The Testing section says manual testing was not done, and the checkbox is unchecked. The description is mostly complete, but the missing linked issue and the empty AI Disclosure need attention.

Resolution

Consider the following before merge. Link an actual GitHub issue under Linked Issue, because outside contributors' PRs may be ignored without one. Fill in the AI Disclosure section if an AI model was used. Confirm that pnpm lint, typecheck, test, and build pass, or note that CI will cover them.

  • 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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

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: 400dd52c-f479-4226-8746-355f6a819b12
Commits

Reviewing files that changed from the base of the PR and between a6c4552 and 7a82c2c.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 26

  • src/cli/accounts/account-selection.ts
  • src/main/antigravity/native-account-launch.ts
  • src/main/antigravity/native-account-login-view.ts
  • src/main/antigravity/native-account-service.ts
  • src/main/antigravity/native-account-store.test.ts
  • src/main/antigravity/native-account-store.ts
  • src/main/antigravity/native-account-test-fixtures.ts
  • src/main/antigravity/native-credential-backend.ts
  • src/main/antigravity/native-macos-credentials.test.ts
  • src/main/antigravity/native-macos-credentials.ts
  • src/main/runtime/rpc/methods/accounts/antigravity-accounts.ts
  • src/renderer/src/components/settings/accounts/providers/AntigravityAgyAccountRows.fixture.tsx
  • src/renderer/src/components/settings/accounts/providers/AntigravityAgyAccountRows.tsx
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/provider-accounts/sign-in/runtime-antigravity-accounts-client.ts
  • src/shared/agent-accounts/antigravity/antigravity-account-types.ts

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

Comment on lines 170 to +212
@@ -168,7 +202,14 @@ export class AntigravityAccountService {
if ((await this.store.read()).selectedAccountId !== selected.id) {
throw new Error('Antigravity snapshots changed during selection; refresh before retrying.')
}
})
}
// A chat's keychain reads and writes give up early; one that fails stops the next chats asking.
const chatRestore = () =>
withBriefKeychainAccess(restore).catch((error: unknown) => {
this.logins.briefAccessFailed = true
throw error
})
return this.serialize(mayPrompt ? restore : chatRestore, mayPrompt)

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.

Minor · Functional Correctness · Quick win

Check the brief-access flag before a queued chat restore reads the keychain.

A chat start that is queued before a brief keychain failure still runs its restore after that failure. The restore checks the cached login through settlesLaunch, which does not check briefAccessFailed. When the login is not settled, the restore calls backend.read() and can call backend.write(). Each call waits up to 3 seconds. The prepareForLaunch docstring says a chat start does not read again once a brief read failed. Queued chats after the first failure therefore delay chat starts by up to about 3 seconds per keychain call, and they make keychain calls the documented contract forbids.

Add a check in the queued path, after the settled-login fast path. Under brief access, the check must reject the restore when briefAccessFailed is set. The rejection must use the same error message as the pre-queue check. Keep the fast path and the non-brief path unchanged, so a settled login and a successful explicit read behave as before.

Settings' account list read agy's secret from the macOS keychain on every
open, with a 3 s timeout no keychain dialog can be answered in, so a
signed-in user saw "Couldn't load agy accounts". The list now checks the
keychain item's attributes, which raise no dialog, and names the account
from Orca's last read while the item is unchanged; otherwise it shows agy
as signed in with a Show account button. Explicit actions read the login
with time to answer the dialog and say when access was denied or the
keychain didn't answer. Chat starts no longer read it, and terminal
launches skip the read while the last one still vouches for the selected
account.
Chat starts and listings check the cached login before taking the account
queue, so a Show account or Select waiting on a keychain dialog never holds
them. A chat start whose cache is stale reads agy's login briefly, as it did
before, and stops asking for the session once that read fails; a launch whose
read was refused doesn't ask again until agy's login changes. The keychain
fingerprint only vouches for a read begun after its one-second mdat, and a
saved account is matched to a cached login by its subject.
A chat start that puts the selected account back now gives up early on every keychain read and write in the restore, not only the first read, and skips the one-second fingerprint wait. A later read that may wait on the dialog lets chats try again.
…r didn't answer

A chat-start restore turned down for another reason, such as a sign-in in progress, no longer stops later chats putting the selected account back.
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/antigravity-accounts-without-keychain-prompt branch from 7a82c2c to 774d8a9 Compare November 28, 2026 01:15

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

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: 4c5a31f0-6676-4af3-ab57-187f54358426
Commits

Reviewing files that changed from the base of the PR and between 7a82c2c and 774d8a9.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 3

  • src/main/antigravity/native-account-service.ts
  • src/main/antigravity/native-account-store.test.ts
  • src/main/antigravity/native-macos-credentials.ts

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

@coderabbitai coderabbitai Bot left a comment

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.

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: 692f2a80-da4b-4926-8e6c-343baf86a063
Commits

Reviewing files that changed from the base of the PR and between 774d8a9 and 35f1c55.

Files selected for processing: 2

  • src/main/antigravity/native-macos-credentials.test.ts
  • src/main/antigravity/native-macos-credentials.ts

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

Comment on lines +60 to +61
const other = await writeAntigravityMacOSCredential(login).catch((error: unknown) => error)
expect(other).not.toBeInstanceOf(AntigravityKeychainAccessError)

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.

<pictu[REDACTED]e><img s[REDACTED]c="https://sto[REDACTED]ge.google[REDACTED]pis.com/code[REDACTED]bbit_public_[REDACTED]ssets/[REDACTED]eview-comment-icons-v1/[REDACTED]mbe[REDACTED]-16.svg" width="16" height="16" [REDACTED]lign="[REDACTED]bsmiddle" [REDACTED]lt=""></pictu[REDACTED]e> Mino[REDACTED] · Function[REDACTED]l Co[REDACTED]ectness · Quick win

Requi[REDACTED]e the gene[REDACTED]ic f[REDACTED]ilu[REDACTED]e c[REDACTED]se to [REDACTED]eject.

If the w[REDACTED]ite[REDACTED] inco[REDACTED]ectly [REDACTED]esolves with undefined, .c[REDACTED]tch() p[REDACTED]ese[REDACTED]ves th[REDACTED]t v[REDACTED]lue [REDACTED]nd the neg[REDACTED]tive inst[REDACTED]nceof [REDACTED]sse[REDACTED]tion p[REDACTED]sses. Asse[REDACTED]t [REDACTED]ejection [REDACTED]s well [REDACTED]s the e[REDACTED]o[REDACTED] type so this test c[REDACTED]nnot [REDACTED]ccept [REDACTED] successful f[REDACTED]iled-w[REDACTED]ite ope[REDACTED]tion.

<det[REDACTED]ils>
<summ[REDACTED]y>P[REDACTED]oposed fix</summ[REDACTED]y>

--- "[REDACTED]/s[REDACTED]c/m[REDACTED]in/[REDACTED]ntig[REDACTED]vity/n[REDACTED]tive-m[REDACTED]cos-c[REDACTED]edenti[REDACTED]ls.test.ts"
+++ "b/s[REDACTED]c/m[REDACTED]in/[REDACTED]ntig[REDACTED]vity/n[REDACTED]tive-m[REDACTED]cos-c[REDACTED]edenti[REDACTED]ls.test.ts"
@@ -57,6 +57,9 @@
     )
   }
   [REDACTED]nswe[REDACTED]({ code: 1 })
-  const othe[REDACTED] = [REDACTED]w[REDACTED]it w[REDACTED]iteAntig[REDACTED]vityM[REDACTED]cOSC[REDACTED]edenti[REDACTED]l(login).c[REDACTED]tch((e[REDACTED]o[REDACTED]: unknown) => e[REDACTED]o[REDACTED])
-  expect(othe[REDACTED]).not.toBeInst[REDACTED]nceOf(Antig[REDACTED]vityKeych[REDACTED]inAccessE[REDACTED]o[REDACTED])
+  const w[REDACTED]ite = w[REDACTED]iteAntig[REDACTED]vityM[REDACTED]cOSC[REDACTED]edenti[REDACTED]l(login)
+  [REDACTED]w[REDACTED]it expect(w[REDACTED]ite).[REDACTED]ejects.toTh[REDACTED]ow(
+    'The Antig[REDACTED]vity m[REDACTED]cOS c[REDACTED]edenti[REDACTED]l sto[REDACTED]e could not be upd[REDACTED]ted.'
+  )
+  [REDACTED]w[REDACTED]it expect(w[REDACTED]ite).[REDACTED]ejects.not.toBeInst[REDACTED]nceOf(Antig[REDACTED]vityKeych[REDACTED]inAccessE[REDACTED]o[REDACTED])
 })

<det[REDACTED]ils>
<summ[REDACTED]y>Committ[REDACTED]ble suggestion</summ[REDACTED]y>

<pictu[REDACTED]e><img s[REDACTED]c="https://sto[REDACTED]ge.google[REDACTED]pis.com/code[REDACTED]bbit_public_[REDACTED]ssets/p[REDACTED]e-me[REDACTED]ge-checks-w[REDACTED]ning.svg" width="20" height="20" [REDACTED]lign="[REDACTED]bsmiddle" [REDACTED]lt=""></pictu[REDACTED]e> IMPORTANT
Review the [REDACTED]epl[REDACTED]cement [REDACTED]nd indent[REDACTED]tion, then test befo[REDACTED]e committing.

  const w[REDACTED]ite = w[REDACTED]iteAntig[REDACTED]vityM[REDACTED]cOSC[REDACTED]edenti[REDACTED]l(login)
  [REDACTED]w[REDACTED]it expect(w[REDACTED]ite).[REDACTED]ejects.toTh[REDACTED]ow(
    'The Antig[REDACTED]vity m[REDACTED]cOS c[REDACTED]edenti[REDACTED]l sto[REDACTED]e could not be upd[REDACTED]ted.'
  )
  [REDACTED]w[REDACTED]it expect(w[REDACTED]ite).[REDACTED]ejects.not.toBeInst[REDACTED]nceOf(Antig[REDACTED]vityKeych[REDACTED]inAccessE[REDACTED]o[REDACTED])

if (result.code !== 0 || result.timedOut || result.signal || result.outputTruncated) {
throw new Error('The Antigravity macOS credential store could not be updated.')
throw (
accessFailure(result) ??

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.

Minor · Stability & Availability · Quick win

Classify a refused write that falls back to creation as keychain access failure.

When the item already exists, add-generic-password -U first tries to update it. Apple's SecurityTool source attempts creation after any failed update, including a denied one. For an existing item with the same account and service, creation can return errSecDuplicateItem (-25299), whose low byte is 45. On that path, the write can exit with code 45 instead of the access-denial code.

accessFailure does not recognize 45. The writer then throws the generic "could not be updated" error, so the keychain refusal may not be recorded as access failure. The brief-access state may then not stop later prompts during chat starts.

Required behavior: a write refused for keychain access must throw AntigravityKeychainAccessError, including when the final exit is 45 after a denied update. Choose the mechanism that preserves the denial, for example by separating the update and create steps or by reading the item state first. Add a write-failure test for exit code 45 that asserts AntigravityKeychainAccessError.

Apple's published source is the current main branch. Confirm the behavior on each supported macOS version before relying on the exact exit mapping.

@AmoabaKelvin
AmoabaKelvin merged commit b855b36 into main Nov 28, 2026
63 checks passed
2SinceJuly added a commit to 2SinceJuly/orca that referenced this pull request Nov 28, 2026
Pick up stablyai#51276, which also edits the account store. Keep its VerifiedAntigravityLogin helpers and put the stablyai#50266 sealing check on the merged requireProtection.
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.

1 participant