Repository navigation
Conversation
…other agy refreshes over it agy keeps one shared native login (the macOS keychain item, or the Linux keyring), and every running agy writes its own login back to it on each hourly token refresh. After switching accounts, any agy still running on the previous account flips the shared login back within the hour, and the next launch failed with "The native Antigravity account changed" even though nobody changed accounts. When the shared login has drifted to another saved account, the launch now switches it back to the selected one through the same verified write that selection uses. reconcile has just saved the drifted login into its own snapshot, so nothing is lost. A login Orca has not saved, or a signed-out agy, still refuses the launch as before.
…ing a newer selection Restore only when exactly one saved account holds the drifted login, and abort instead of rewriting selectedAccountId when another Orca process changed the selection mid-restore.
…e selected agy account Both logins are already saved by then, so the restore only switches the native login and checks the selection; writing the whole vault back could replace a selection another Orca process saved meanwhile.
…ty-bug # Conflicts: # src/main/antigravity/native-account-service.ts
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
10 of 11 tasks
Owner
Author
|
Superseded by stablyai#50206. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
agy keeps one login per machine, and every agy that is running writes its own login back into that slot about once an hour when it refreshes its token. If you switch accounts in Orca while older agy sessions are still running on the previous account, one of them soon puts the old login back. Orca then refused every new agy launch with "The native Antigravity account changed", even though nobody changed anything. Now Orca puts the account you selected back before the launch, as long as the login it finds is one of your saved accounts.
What Changed
Before:
AntigravityAccountService.prepareForLaunchrefused the launch whenever the native login wasn't the selected account. That included the case where it was simply another saved account, written back by a background agy refresh.After: if the native login belongs to exactly one saved account other than the selected one, the launch switches the native login back to the selected account and proceeds.
reconcilehas just saved the drifted login into its own snapshot, so nothing is lost. It uses the same verified native write and readback as explicit selection, now shared asswitchNative. The launch still refuses, as before, when the native login is:A launch-time restore never writes the vault: by then both logins are already saved, so there's nothing to publish. Afterwards it re-reads the vault and refuses the launch if another Orca process changed the selection in the meantime, so a selection made elsewhere is never overwritten.
Why
Evidence from the reporting machine (macOS, Orca 1.4.268, agy 1.5.18):
browser.go:268] token refreshedroughly every 55 minutes.gemini/antigravitykeychain item's modification time matches one of those refresh lines to the second.selectAccount, so the flips come from agy itself.The selected account is Orca's source of truth: the error already told users to "Select the account again", and doing that only rewrote the same snapshot. Restoring it at launch does automatically what the user was told to do by hand, and only when that is lossless.
Alternatives considered:
forgetAgyLogin): not done. A background refresh already moved chats onto the drifted login before this change without any invalidation. Restarting them on every launch-time restore would make them re-read a slot that background refreshes keep flipping. That adds churn across many chats and guarantees nothing, and the selection itself doesn't change.Linked Issue
Fixes stablyai#50100
Related: stablyai#48739 (same mechanism on Windows; Windows launches are not gated by this preflight, see Risk)
Visual Proof
N/A: no UI change. The change is in the launch preflight, and the before/after is the launch either failing with the error or starting. It is covered by the test below, which fails with the exact field error when the fix is reverted.
Testing
New case in
src/main/antigravity/native-account-store.test.ts: save A and B, select A, simulate an agy on B refreshing (no id_token, same grant) over the native slot, thenprepareForLaunch. Asserts the native slot holds A again, B's refreshed login is kept in B's snapshot, and the selection is unchanged. With the service change reverted, it fails withThe native Antigravity account changed….Existing cases still cover the refusals: unsaved login, a rotated grant Google can't confirm, a different subject, and removal after an outside sign-in.
Concurrency check (a throwaway test, not committed, because it hooks internal call order): another Orca process saves a different selection right after the restore's last vault read. On this branch that selection survives. On the intermediate commit that still wrote the vault, it was reverted, which is the reviewer's P2 below.
pnpm check:changed: 26/26 checks pass (format, oxlint, typecheck, affected unit tests, ratchets).Not tested against a live agy on purpose: switching the real keychain on the reporting machine would disturb its running sessions.
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
None, because the restore only runs on a launch whose native login has drifted. It is one keychain write plus a readback, the same work as an explicit selection. Launches whose login already matches return before any extra read or write.
Risk
Level: Medium
agylogin by hand, or Accounts → Add account while a selection exists) no longer blocks launches. The next launch switches back to the selected account; selecting the other account in Accounts switches for real. Unsaved logins and sign-outs still block, as before.reconcilehas already saved and whose access token lives on in that process's memory.prepareAntigravityAccountForLaunchreturns early on win32), WSL or SSH/remote launches.AI Disclosure
Root-cause analysis and code written by Claude (Opus 5.5) in Claude Code, guided by the contributor. An independent read-only review was done by OpenAI Codex as a separate Orca worker; findings and resolution below.
Review
Independent reviews, read-only, by models other than the one that wrote the code:
Round 1 — OpenAI Codex (separate Orca worker), on
2fa29f34ab1: request changes.forgetAgyLogin(catalog forget and idle-chat restart).Round 2 — Codex, on
c43520f3b8e:3726f3e9482: a restore no longer writes the vault at all. The interleaving was checked with a throwaway deterministic test, which fails onc43520f3b8eand passes on HEAD.Round 3 — Claude Sonnet 5.5 (fresh session, read-only), on
3726f3e9482: approve.selectAccountbehaves the same as on main:switchNativeis the old inline code, and the publication order is unchanged.Compatibility summary:
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)