feat(antigravity): add Antigravity CLI account switching and switch-and-run support - #2335
Draft
yaobii-lab wants to merge 1 commit into
Draft
yaobii-lab wants to merge 1 commit into
yaobii-lab wants to merge 1 commit into
Conversation
- Add antigravity_cli runtime target alongside antigravity (legacy) and antigravity_ide - Share existing Antigravity Account[] storage without duplicate databases - Implement transactional account switching with rollback protection (prepare -> snapshot -> write -> verify -> commit) - Implement cross-process switch lock (flock / LockFileEx) to prevent concurrent switching races - Decouple switch transaction from CLI process launch - Add cockpit-cli support for list, current, switch, and switch-and-run (cockpit-cli run agy --account <acc> -- <args>) - Add UI controls for Antigravity CLI runtime in AccountsPage and Dashboard - Add integration tests covering switch persistence, launch failure decoupling, rollback, multi-runtime isolation, and cross-process concurrency
Comment on lines
+148
to
+150
| " Current Acct: {} ({})", | ||
| email.green(), | ||
| status.current_account_id.as_deref().unwrap_or("") |
| let target = match target { | ||
| Some(a) => a, | ||
| None => { | ||
| println!("{} Antigravity account not found: {}", "Error:".red(), account); |
Comment on lines
+198
to
+201
| "{} Successfully switched Antigravity CLI account to {} ({})", | ||
| "Success:".green(), | ||
| switched.email, | ||
| switched.id |
Comment on lines
+247
to
+250
| "{} Antigravity CLI launched with account {} ({})", | ||
| "Success:".green(), | ||
| res.email, | ||
| res.account_id |
| println!("[Test 1] agy last auth log: {:?}", last_auth_line); | ||
| assert!( | ||
| last_auth_line.as_ref().map(|l| l.contains(account_b_email)).unwrap_or(false), | ||
| "Expected agy to authenticate as Account B ({})", account_b_email |
Comment on lines
+265
to
+267
| "Keychain credential must match the final bound account (ID: {}, err: {:?})", | ||
| final_bound_id, | ||
| verify_res.err() |
Comment on lines
+327
to
+329
| "Cross-process invariant failed! Credential in Keychain must match provider current account: final_bound_id={}, verify_err={:?}", | ||
| final_bound_id, | ||
| verify_res.err() |
This branch has not been deployed
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.
Summary
This PR adds support for the Antigravity CLI (
agy) runtime target alongside existingantigravity(legacy) andantigravity_ide(IDE) runtimes in Cockpit Tools. It introduces transactional account switching with rollback protection, cross-process concurrency locking, UI integration in Accounts and Dashboard, and full CLI support viacockpit-clifor account listing, inspection, switching, and single-command switch-and-run.Architecture & SSoT Alignment
Account[]database without duplicating account stores or creating parallel OAuth systems.antigravity,antigravity_ide,antigravity_cli) independently maintains its current active account binding.Multi-Runtime Model
antigravity(Legacy branch)antigravity_ide(IDE branch)antigravity_cli(CLI branch foragy)provider_current_state.rsunder the keyantigravity_cli.antigravity_clidoes not alter or disrupt the active accounts bound toantigravityorantigravity_ide.Transaction & Rollback Design
Account switching uses a deterministic 5-step transaction:
gemini:antigravity).If verification or any intermediate step fails, the transaction automatically restores the snapshot and returns a fail-closed error (
CREDENTIAL_VERIFY_FAILED).Cross-Process Locking
CrossProcessSwitchLock) implemented viaflock(LOCK_EX | LOCK_NBwith polling timeout) on Unix platforms andLockFileExon Windows.credential active account == provider current account.Switch-and-Run Decoupled Design
CLI_LAUNCH_FAILED), avoiding unintended rollback of an authenticated credential.cockpit-cliprovides single-command switch-and-run:Platform Status
agyinteraction, and cross-process tests verifiedsecret-tool) implemented, fail-closed on missing daemonVerification Evidence
antigravity_cli_integration_test.rs):test_cli_account_switch_persistence_and_native_recognition: PASStest_switch_and_run_decoupled_launch_failure: PASStest_rollback_on_verify_failure: PASStest_multi_runtime_target_state_isolation: PASStest_concurrent_ab_switches_serialized: PASStest_cross_process_concurrent_switch: PASSsrc/utils/antigravityRuntimeTarget.test.ts: 5/5 tests PASSnpm run typecheck: PASS (0 errors)cockpit-cli accounts agycockpit-cli current agycockpit-cli switch agy <account>cockpit-cli run agy --account <account> -- <args>Security & Privacy Statement