Skip to content

feat(antigravity): show detected native account - #21798

Merged
nwparker merged 1 commit into
nwparker/agy-account-removal-guardfrom
nwparker/agy-detected-account-row
Sep 21, 2026
Merged

nwparker merged 1 commit into
nwparker/agy-account-removal-guardfrom
nwparker/agy-detected-account-row

Conversation

@nwparker

@nwparker nwparker commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​69 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​69
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47

What changed

When agy is already signed in on this computer, Orca now shows the detected account in AI Provider Accounts before it is saved to Orca's account vault. The row is read-only and explains that clicking Add current agy account is required to enable switching and persistence.

The native service reports this identity without writing credentials. Saving it still requires the user's explicit action. The web preload stub and renderer types now carry the new field, and a renderer test covers the detected row.

Why this approach

The agy credential is already present in the native credential store, so Orca can identify the current account safely. Displaying it immediately removes the confusing empty state while keeping vault persistence opt-in.

Verification

  • 32 native Antigravity account/credential tests passed.
  • Renderer test: AntigravityAccountsSection.test.tsx passed.
  • pnpm tc:node passed.
  • pnpm tc:web passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings.
  • Hidden Electron/CDP validation attached to Orca: nwparker/agy-detected-account-row; window.api.antigravityAccounts.list() returned a redacted detected identity and the settings surface rendered successfully. No credentials or raw blobs were recorded.

Stacked on #21797.

@nwparker

Copy link
Copy Markdown
Contributor Author

Verification update:

  • 32 native Antigravity account/credential tests passed.
  • AntigravityAccountsSection.test.tsx passed.
  • pnpm tc:node and pnpm tc:web passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings.
  • Hidden Electron/CDP attached to Orca: nwparker/agy-detected-account-row; the real settings surface loaded and window.api.antigravityAccounts.list() returned a redacted detected identity. No credential material was recorded.
  • Required CI run 35514828878 passed all 8 test shards, static analysis, typecheck, Linux and Windows packages. Pullfrog is still pending as an external review check.

Scoped verdict: Approve for macOS native detection and the explicit-save UI, stacked on #21797. Windows/Linux native backends and remote account scopes remain unverified.

@pullfrog pullfrog 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.

ℹ️ Minor suggestions only — one design question inline, plus a test nit.

Reviewed changes

  • New detectedAccount field — AntigravityAccountState now carries the live native credential's { id, email, subject, authMethod } when that blob is not saved in the vault.
  • Inline active match in listAccounts — the service reads the credential directly and returns detectedAccount when current && !active, replacing the knownActiveAccount call; activeAccountId semantics are unchanged.
  • Renderer detected row — a read-only dashed row shows the detected identity and explains that adding is required to enable switching.
  • Web stub, i18n, tests — web preload returns detectedAccount: null; the antigravityDetected copy is added; new service and renderer tests cover the detected row.

I re-ran the changed tests plus tc:node, tc:web, and the four localization gates at 89c02f7 — all pass.

ℹ️ Nitpicks

  • src/main/antigravity/native-account-service.test.ts:46 — toMatchObject({ authMethod: 'consumer' }) would also pass with a wrong id/email/subject; asserting the full detected object (or at least email/subject) pins the shape. The renderer test also has no case asserting the row is absent when detectedAccount is null.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +70 to +78
detectedAccount:
current && !active
? {
id: accountId(current.contents),
email: current.identity?.email ?? null,
subject: current.identity?.subject ?? null,
authMethod: current.authMethod
}
: null

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.

detectedAccount is decided only by accountId(current.contents) failing to match a saved account, and accountId hashes the whole credential blob. That blob holds time-limited OAuth material (token.access_token, id_token), so if agy rewrites it on refresh, an account already saved in the vault will appear here as a second "detected" row and activeAccountId will reset to null. Is the keychain blob byte-stable across refreshes? If not, basing the "already saved" decision on the stable identity.subject/email (and/or deduping in addCurrentAccount) would avoid the duplicate.

Technical details
# Content-hash identity can misreport a saved account as detected

## Affected sites
- `src/main/antigravity/native-account-service.ts:63-65` — `active` matched by `account.id === accountId(current.contents)`.
- `src/main/antigravity/native-account-service.ts:70-78` — `detectedAccount` derived from `!active`.
- `src/main/antigravity/native-account-service.ts:99` — `addCurrentAccount` dedupes by content hash, so a changed blob appends a second record instead of updating the existing one.

## Required outcome
- A saved account whose native blob has changed should not be presented as both a vault row and a "detected" row.

## Suggested approach (optional)
- Base the "already saved" check on the identity the codec already extracts (`identity.subject`, falling back to `identity.email`), keeping the content hash for exact-credential switching/verification.
- Or confirm agy never rewrites the keychain blob after the initial sign-in and note that assumption next to `accountId`.

## Open questions for the human (optional)
- Does agy rewrite the `gemini`/`antigravity` keychain item when it refreshes the access/id token? All repo credential fixtures are synthetic, so this is not verifiable here.

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification (2026-09-20):

  • Native account/credential plus detected-row renderer tests: 66/66 passed.
  • pnpm tc:node and pnpm tc:web passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings across 198 changed files.
  • Installed agy 1.2.7 authenticated exact sentinel returned AGY_DETECTED_OK.
  • Full CI 35514828878 and Pullfrog are green across all test shards, typecheck, static analysis, macOS/Windows packages, and verify. Existing hidden Electron/CDP proof read a redacted detected identity on this branch.

Verdict: approve scoped to macOS native detection/UI. Explicit save remains required; Windows/Linux/remote account scopes remain unverified. No merge performed.

@nwparker

Copy link
Copy Markdown
Contributor Author

ELI5: when agy is already signed in on macOS, Orca can show which account it found instead of making the user guess. The identity is redacted in proof, and saving/switching remains explicit. This verdict covers native macOS detection/UI only.

@nwparker
nwparker merged commit 21ed602 into nwparker/agy-account-removal-guard Sep 21, 2026
30 checks passed
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