Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Antigravity 1.5.16 Google sign-ins stay in profile storage #41982

OpenberkpolatCE(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/41982/headopened View on GitHub

berkpolatCE(GitHub profile, opens in a new tab)commented

Problem

Starting with Antigravity CLI 1.5.16, composite_token_storage.go no longer falls back to file-based token storage solely because SSH_CONNECTION is set when a system keyring (such as macOS Keychain) is available, and it ignores AGY_ACP_FORCE_FILE_STORAGE. Instead, 1.5.16 checks AGY_CLI_FORCE_FILE_TOKEN_STORAGE.

Because antigravityEnvironment did not set AGY_CLI_FORCE_FILE_TOKEN_STORAGE, personal Google (oauth-personal) sign-ins (agy acp --login) and sessions on 1.5.16 silently read and wrote the shared OS keyring instead of <profile>/antigravity-acp/antigravity-oauth-token. That broke per-instance account isolation and caused makeAntigravityUsageProbe (which skips the shared keyring for oauth-personal) to report "Sign in with Google to see Antigravity limits.".

Change

  • In apps/server/src/provider/antigravityAuthSupport.ts:
    • Add AGY_CLI_FORCE_FILE_TOKEN_STORAGE to removedEnvironmentKeys so ambient values (including case-insensitive Windows aliases) cannot override "1" for oauth-personal or leak into other auth methods.
    • Set AGY_CLI_FORCE_FILE_TOKEN_STORAGE: "1" in antigravityEnvironment for oauth-personal, keeping SSH_CONNECTION (needed by 1.5.12–1.5.15 for file storage and by 1.5.16 for headless No browser is available here detection) and AGY_ACP_FORCE_FILE_STORAGE: "1".
    • Leave oauth-business (Gemini Enterprise) unchanged so existing Enterprise keyring sign-ins and antigravityUsageLimits.ts's keyring fallback keep working.
  • In apps/server/src/provider/antigravityAuthSupport.test.ts:
    • Assert that ambient AGY_CLI_FORCE_FILE_TOKEN_STORAGE (and its lowercase alias) is stripped and set to "1" for oauth-personal, and stripped (undefined) for gemini-api-key, agent-platform, and oauth-business.

Note: oauth-personal users who already signed in on 1.5.16 before this fix have their token only in the shared OS keyring and will need to sign in once after upgrading so antigravity-oauth-token is written into the profile (any previous shared keyring entry is left untouched).

Scope

Fixes #41973

Verification

  1. Before (main @ 4afdfefde0, macOS arm64 with live macOS Keychain, managed Antigravity CLI 1.5.16):
    • Spawning antigravity acp with SSH_CONNECTION="127.0.0.1 0 127.0.0.1 0" and AGY_ACP_FORCE_FILE_STORAGE=1 (no AGY_CLI_FORCE_FILE_TOKEN_STORAGE) against a profile containing a synthetic antigravity-oauth-token ignored the profile file and loaded the macOS Keychain account instead; antigravity acp --login did not log file-based token storage.
    • vp test run apps/server/src/provider/antigravityAuthSupport.test.ts failed the 2 updated assertions (AGY_CLI_FORCE_FILE_TOKEN_STORAGE=0 and lowercase alias leaked through; ambient AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 leaked into non-personal methods).
  2. After fix:
    • Live checks against managed Antigravity CLI 1.5.16 via prepareAntigravityProfile + buildAntigravityAcpSpawnInput with real HOME (macOS Keychain active):
      • oauth-personal with a synthetic profile antigravity-oauth-token and ambient AGY_CLI_FORCE_FILE_TOKEN_STORAGE=0: logged composite_token_storage.go:207] Using file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set and authenticated as the profile token (e2e-profile@example.com), not the macOS Keychain account.
      • oauth-personal with an empty profile: logged file-based token storage and returned JSON-RPC error -32603 (No browser is available here...), without reading macOS Keychain.
      • oauth-personal acp --login (matching AntigravityDriver.codeLogin env): logged file-based token storage and printed the Google OAuth URL.
      • oauth-business with ambient AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1: stripped (undefined).
    • 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).
    • vp run check:changed → format, lint, knip, graphql, typecheck (3 packages), and tests (2 files) all pass.
    • Did not test Linux or Windows runtime hosts directly; Windows case-insensitive stripping is covered by unit tests.

Built with Gemini 4 Neon in T3 Code (Antigravity harness); independently reviewed by Claude Fable 5.2 and GPT-6.2-Sol.

    1. Pushed02f8fd0

    2. The automated pipeline stopped on this pull request and will not merge it:

      the fix is written and reviewed, but proving it needs something no worker has:

      • Permanent blocker: Antigravity Google account sign-in and the usage-limits panel are explicitly unavailable in the worker environment. Proving personal sign-ins use the selected profile token instead of the shared macOS Keychain requires those capabilities on both commits.
      • Permanent blocker: Gemini Enterprise sign-in is explicitly unavailable, so preservation of enterprise keyring behavior could not be verified.

      It stays open for a person to finish or close.

    3. juliusmarminge added labelstakeover:blocked

    4. juliusmarminge removed labelstakeover:in-progress

    5. Tested this branch locally on macOS (arm64) with managed Antigravity 1.5.16 (oauth-personal) against an isolated --home-dir:

      • Before (0.1.11 / without AGY_CLI_FORCE_FILE_TOKEN_STORAGE): 1.5.16 fell back to macOS Keychain (ChainedAuth: authenticated via keyring), never wrote antigravity-oauth-token, and Usage → Limits returned "Sign in with Google to see Antigravity limits."
      • After (#41982): both acp-login and acp-server log Using file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set, <profile>/antigravity-acp/antigravity-oauth-token (0600) is written on sign-in, and Usage → Limits immediately populates all 4 quota windows (Gemini · 5-hour, Gemini · Weekly, Claude & GPT (shared) · 5-hour, Claude & GPT (shared) · Weekly).
      • Unit tests (antigravityAuthSupport.test.ts, antigravityUsageLimits.test.ts): 51 passed, 1 skipped.
    6. Tested the env change from this PR on macOS arm64 with T3 Code Nightly 0.1.12-nightly.20261124.5209, oauth-personal, and an external Homebrew agy 1.5.16 (antigravity-cli cask, found on PATH, no managed runtime, no binaryPath).

      I didn't build the branch. The PR's only runtime change for oauth-personal is AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1, and the current Nightly passes that variable through, so I set it with launchctl setenv AGY_CLI_FORCE_FILE_TOKEN_STORAGE 1, restarted T3, then signed out and back in.

      A/B with the same binary, a fresh empty profile per run (agy acp --gemini-dir <tmp> --app-data-dir antigravity-acp), T3's current env (SSH_CONNECTION=127.0.0.1 0 127.0.0.1 0, AGY_ACP_FORCE_FILE_STORAGE=1), then ACP initialize and authenticate("oauth-personal"):

      without the variablewith AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1
      storage logno file-storage lineUsing file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set
      authChainedAuth: authenticated via keyring, signed in as my Google accountNo browser is available here (this is a remote (SSH) session…)

      Without the variable, an empty profile signs in with whatever account is in the shared Keychain entry (gemini/antigravity).

      My real T3 profile, before:

      • No acp_token.json or antigravity-oauth-token in <profile>/antigravity-acp/.
      • ACP log: ChainedAuth: authenticated via keyring, no file-storage line.
      • Usage → Limits: "Sign in with Google to see Antigravity limits."

      After:

      • antigravity-oauth-token written with mode 0600.
      • ACP log: Using file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set.
      • The Keychain item's mdat stayed at the time of the earlier session, before the new sign-in.
      • Usage → Limits shows all 4 windows: Gemini · 5-hour, Gemini · Weekly, Claude & GPT (shared) · 5-hour, Claude & GPT (shared) · Weekly.

      With file storage, 1.5.16 still logs ChainedAuth: authenticated via keyring. The keyringAuth token expiry in that log matches the expiry in the profile's token file.

      I didn't test Gemini Enterprise (oauth-business).

    7. 0xCUB3(GitHub profile, opens in a new tab) approved these changes

    8. BelKed(GitHub profile, opens in a new tab) approved these changes

      thank you for this! :) i can confirm manually setting AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 makes the limits show up as they should

      BeforeAfter
    9. Tested this fix on agy 1.5.17 across macOS arm64 and Linux arm64 (16 KiB pages).

      • Google OAuth stays in profile file storage (antigravity-oauth-token) on both hosts instead of writing to the OS keyring, and sessions survive across restarts.
      • On macOS, AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 only affects Google CLI auth. Hosted plugin OAuth tokens stored under Keychain service antigravity.plugins (tested with the Notion plugin) still read and authenticate normally.
    10. Adding an independent multi-profile verification on macOS arm64 with T3 Code's managed Antigravity CLI 1.5.16 (~/.t3/tools/antigravity-acp/darwin-arm64/.../antigravity), since this fix still matters for per-instance account isolation even after #43026 removed usage-limits polling:

      1. A/B isolation check against two fresh, empty --gemini-dir profiles (profileA and profileB) using T3's env (SSH_CONNECTION="127.0.0.1 0 127.0.0.1 0", AGY_ACP_FORCE_FILE_STORAGE=1), sending ACP initialize then authenticate("oauth-personal"):
        • Without AGY_CLI_FORCE_FILE_TOKEN_STORAGE: both empty profiles silently authenticated via the shared macOS Keychain ({"result":{"_meta":{"antigravity":{"tier":{"name":"Google AI Pro","id":"g1-pro-tier",...}}}}}), causing multiple configured Antigravity instances to collapse onto the same shared Keychain account/quota.
        • With AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1: both empty profiles stayed isolated from Keychain and returned JSON-RPC error -32603 (No browser is available here (this is a remote (SSH) session...)), requiring per-profile token storage.
      2. PR branch unit tests (02f8fd0c52): vp test run apps/server/src/provider/antigravityAuthSupport.test.ts passed (31/31) on macOS arm64.

      (Did not test Gemini Enterprise / oauth-business.)

Sign in to join this conversation.