fix(server): keep Antigravity 1.5.16 personal Google sign-ins in profile storage #42633
main fromrefs/pull/42633/head·opened View on GitHubProblem#
Starting with managed Antigravity CLI 1.5.16, personal Google (oauth-personal) sessions no longer switch to per-profile file storage solely because SSH_CONNECTION is set. The 1.5.16 binary also ignores AGY_ACP_FORCE_FILE_STORAGE and checks AGY_CLI_FORCE_FILE_TOKEN_STORAGE instead.
As a result, oauth-personal sign-ins and sessions on 1.5.16 fall back to the shared OS keyring (gemini / antigravity) instead of <profile>/antigravity-acp/antigravity-oauth-token. Multiple Antigravity instances overwrite each other's login state, and makeAntigravityUsageProbe (which skips the shared keyring for oauth-personal) reports "Sign in with Google to see Antigravity limits." for every instance.
Change#
- In
apps/server/src/provider/antigravityAuthSupport.ts:- Add
AGY_CLI_FORCE_FILE_TOKEN_STORAGEtoremovedEnvironmentKeysso ambient values (and case-insensitive aliases on Windows) cannot override"1"foroauth-personalor leak into other auth methods. - Set
AGY_CLI_FORCE_FILE_TOKEN_STORAGE: "1"inantigravityEnvironmentforoauth-personal, while keepingSSH_CONNECTION(needed by older1.5.xruntimes for file storage and by1.5.16for headless no-browser detection) andAGY_ACP_FORCE_FILE_STORAGE: "1". - Leave
oauth-business(Gemini Enterprise),gemini-api-key, andagent-platformunchanged so existing Enterprise keyring sign-ins keep working.
- Add
- In
apps/server/src/provider/antigravityAuthSupport.test.ts:- Assert that ambient
AGY_CLI_FORCE_FILE_TOKEN_STORAGE(and its lowercase alias) is stripped and forced to"1"foroauth-personal, and remainsundefinedforgemini-api-key,agent-platform, andoauth-business.
- Assert that ambient
Scope#
Fixes #41973.
Verification#
- Before fix (
upstream/main@20a3bed880, macOS arm64 with live macOS Keychain and managed Antigravity CLI1.5.16):vp test run apps/server/src/provider/antigravityAuthSupport.test.tsfailed both updated assertions (AGY_CLI_FORCE_FILE_TOKEN_STORAGE=0and lowercaseagy_cli_force_file_token_storage=falseleaked through; ambientAGY_CLI_FORCE_FILE_TOKEN_STORAGE=1leaked into non-personal auth methods).- Running managed
antigravity 1.5.16 acpagainst an empty profile with onlySSH_CONNECTIONandAGY_ACP_FORCE_FILE_STORAGE=1skipped file-based storage and silently authenticated from the shared macOS Keychain (ChainedAuth: authenticated via keyring).
- After fix:
- Live checks against managed Antigravity CLI
1.5.16using the patchedprepareAntigravityProfile+buildAntigravityAcpSpawnInputwith ambientAGY_CLI_FORCE_FILE_TOKEN_STORAGE=0and real macOS Keychain active:- Empty profile: logged
composite_token_storage.go:207] Using file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is setand returned JSON-RPC error-32603(No browser is available here...) without touching macOS Keychain. - Profile with a synthetic
antigravity-acp/antigravity-oauth-token(expiry: 2099-01-01T00:00:00Z,auth_method: "consumer"): logged file-based token storage and loaded the synthetic profile token (expiry=2099-01-01 00:00:00 +0000 UTC) instead of the macOS Keychain token. acp --loginwithAGY_CLI_FORCE_FILE_TOKEN_STORAGE=1: logged file-based token storage and printed the Google sign-in link prompt.
- Empty profile: logged
vp test run apps/server/src/provider/antigravityAuthSupport.test.ts apps/server/src/provider/Drivers/AntigravityDriver.test.ts apps/server/src/provider/antigravityUsageLimits.test.ts: 59 passed, 1 skipped (Windows-only keyring test).vp run check:changed:format,lint,knip(2/2),graphql (apps/server),typecheck(3 packages), andtest(2 files, 33 passed) all passed.- Not directly tested: Linux and Windows hosts at runtime (case-insensitive env key stripping is covered by unit tests).
- Live checks against managed Antigravity CLI
Built with Gemini 4 Neon in T3 Code (Antigravity harness).
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
juliusmarminge closed this
yuearc(GitHub profile, opens in a new tab) linked this to fix #41973
Sign in to join this conversation.
Thanks for this. #41982 makes the same change and is the one being kept.
#41982 already contains the same storage flag, environment cleanup, and regression coverage. It also has contributor verification that signing in writes the profile token and restores the quota windows, so it is the stronger submission to carry forward.
Your fix addresses the reported regression, but there is no additional behavior here that needs a separate pull request. Any further findings can be added to the existing one.
Closing as a duplicate.