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.)

    11. Still needed on agy 1.5.21 (T3-managed runtime, macOS arm64). I ran agy acp --gemini-dir --app-data-dir antigravity-acp with the environment antigravityEnvironment builds today (SSH_CONNECTION + AGY_ACP_FORCE_FILE_STORAGE=1). authenticate with oauth-personal succeeds on the empty profile, as the account in the shared keychain entry (ChainedAuth: authenticated via keyring). With AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 added, the log shows Using file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set, and authenticate correctly reports the profile as not signed in. In practice: I have three oauth-personal instances on one machine. Since 1.5.20, every one of them has authenticated as whichever account signed in last. One instance ran a full day of turns on another account and quota, with nothing in the UI to show it.

    12. Quick triage note: the bot's cannot-prove blockers from Nov 23 are now stale.

      • Personal sign-in + usage limits: Usage limits were removed on Nov 25, and five users independently verified macOS/Linux isolation up through agy 1.5.21.
      • Gemini Enterprise: Untouched aside from stripping the new env var for oauth-business (unit-tested).

      Looks ready for a human merge.

    13. Confirming the root cause still holds on T3 Code Nightly 0.1.14-nightly.20261203.5637 (macOS arm64) with agy 1.5.22, the build where limits come back through agy usage --json.

      • Before: acp-server-*.log showed ChainedAuth: authenticated via keyring, no antigravity-oauth-token in the profile, and Usage → Limits showed "Sign in with Google to see Antigravity limits." Running agy usage --json by hand returned SUCCESS.
      • After adding AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 as a provider env var, then signing out and back in, the profile wrote antigravity-oauth-token and Usage → Limits showed all four Antigravity buckets.

      So setting this variable, which is what this PR does, fixes it on 1.5.22. I tested the env-var workaround, not this branch.

    14. Heads-up before merging: after #47750 landed on main, this PR currently merges cleanly without conflicts, but it does not yet set AGY_CLI_FORCE_FILE_TOKEN_STORAGE: "1" in antigravityUsageEnvironment (apps/server/src/provider/antigravityAuthSupport.ts).

      Because this PR adds "AGY_CLI_FORCE_FILE_TOKEN_STORAGE" to removedEnvironmentKeys while only setting it in antigravityEnvironment:

      1. antigravityUsageEnvironment (used by makeAntigravityUsageProbe to run agy usage --json under <profile>/usage-home) still only sets SSH_CONNECTION and AGY_ACP_FORCE_FILE_STORAGE: "1", and will now strip any user-configured AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 workaround too.
      2. In managed Antigravity 1.5.22 on macOS (darwin-arm64), usage goes through the same codeassistclient.NewCompositeTokenStorage (store.cliTokenStorage -> auth.NewCLITokenStorage):
        • codeassistclient.forceFileFromEnv only checks AGY_CLI_FORCE_FILE_TOKEN_STORAGE (ignores AGY_ACP_FORCE_FILE_STORAGE).
        • codeassistclient.sshDetector.Detect special-cases darwin by calling probeDarwinKeychainUnlocked (/usr/bin/security show-keychain-info) and returning !unlocked, which is false on an unlocked macOS desktop session.
      3. As a result, merging this PR as-is will still leave agy usage --json on macOS reading the shared Login Keychain (gemini / antigravity) instead of <profile>/usage-home/.gemini/antigravity-cli/antigravity-oauth-token:
        • For a profile signed in with file storage (no matching Keychain entry), agy usage --json will exit with Please sign in to view account usage., which antigravityUsageLimits.ts maps right back to "Sign in with Google to see Antigravity limits." — and the manual provider env-var workaround will no longer pass through.
        • If another account exists in macOS Keychain, agy usage --json will report that Keychain account's limits instead of the isolated profile's.

      (The manual AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 provider env-var workaround works on main today only because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is not in removedEnvironmentKeys yet, so it passes through to both antigravityEnvironment and antigravityUsageEnvironment.)

      Adding AGY_CLI_FORCE_FILE_TOKEN_STORAGE: "1" to antigravityUsageEnvironment alongside antigravityEnvironment (plus a unit test in antigravityAuthSupport.test.ts) before merging should close the gap completely for #41973 and #47750.

    15. It doesn't feel very appropriate to degrade the security for every user by default solely to support multi-accounts users.

      Those multi-account users are likely using this to dodge the terms of service and usage limits making this even more morally grey.

      This should probably be optional..

    16. Using multiple accounts doesn't appear to be against the ToS as long as they are yours.  There's plenty of legitimate reasons to do it.  Other vendors have tweeted the same for their products.There are problems if I get the GOOGLE AI PRO subscription on my secondary Google account?ai.google.devOn Dec 3, 2026, at 7:45 AM, Jean Francois Pambrun @.***> wrote:jpambrun left a comment (pingdotgg/t3code#41982) It doesn't feel very appropriate to degrade the security for every user by default solely to support multi-accounts users. Those multi-account users are likely using this to dodge the terms of service and usage limits making this even more morally grey. This should probably be optional..

      —Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! You are receiving this because you commented.Message ID: @.***>

    17. KiritoXDone(GitHub profile, opens in a new tab) approved these changes

      I support the change to use the selected instance’s credential file for personal Google sign-in. I reproduced the problem on macOS arm64 with T3 Code Nightly 0.1.14-nightly.20261203.5664 and agy 1.5.23. A fresh sign-in succeeded through Keychain, but the instance had no antigravity-oauth-token and T3 reported zero quota windows.

      I set AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1 on that provider instance and signed in again. The instance token file appeared, and the running T3 server reported all four windows: 5-hour and weekly for both Gemini and Claude/GPT. This was a test of the workaround on the published Nightly. I reviewed the diff at 02f8fd0 separately.

      One detail matters when bringing this onto current main: please also set the flag in antigravityUsageEnvironment for the personal account’s agy usage --json process and cover that path in a regression test. The shared environment filter in this patch would otherwise strip the flag from that process, including a value set by the user. That would let the quota lookup select a different credential store from the one used for sign-in.

Sign in to join this conversation.