Skip to content

[Bug]: Antigravity usage limits show a stale account's quota when the agy CLI is the binary path #34381

Open

Description

@mths-mcfs

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Set up Antigravity with the official ACP executable (managed runtime or a manual agy_acp_server binary path) and sign in with Google account A. This writes <stateDir>/providers/antigravity/<instance>/antigravity-acp/acp_token.json.
  2. In Settings > Providers > Antigravity, change Binary path to the agy CLI (1.5.5 here), as supported since fix(antigravity): agy CLI threads open in Full access and Auto-accept edits #33143.
  3. Sign out, then sign in with Google account B. The provider reports "Authenticated".
  4. Use account B until its quota is visibly consumed. Running agy in a terminal shows, for example, 49.92% left on the weekly Claude and GPT limit.
  5. Open Usage > Limits.

Expected behavior

Usage > Limits shows the quota of the account the provider is signed in to (account B), or reports that limits are unavailable for this runtime. It should never show another account's numbers.

Actual behavior

Usage > Limits shows account A's quota. In my case account A is unused, so all four windows read 100% left, while the agy CLI reports 49.92% left on the weekly Claude and GPT limit for account B. Nothing in the view says which account the numbers belong to.

Signing out and back in from T3 Code does not fix it: acp_token.json keeps its old modification time and its old account through both.

Cause, as far as I could trace it:

  • makeAntigravityUsageProbe in apps/server/src/provider/antigravityUsageLimits.ts always reads <profile>/antigravity-acp/acp_token.json and only checks that the file exists.
  • The official ACP executable honors GEMINI_HOME and AGY_ACP_FORCE_FILE_STORAGE and writes that file. The agy CLI does not: its binary contains neither variable name nor acp_token.json, and it logs Failed to resolve GeminiDir ".gemini" ... falling back to default. It keeps its login in its own store (~/.gemini/antigravity-cli/antigravity-oauth-token on a headless host; no token file on a desktop host, where I assume it uses the OS keyring).
  • So with the CLI as the runtime, nothing updates or removes the profile token. The file left by the ACP executable still refreshes successfully at Google, and the probe returns a valid answer for the wrong account.

Reproduced on two machines with the same result, so it does not depend on the OS.

Impact

Major degradation or frequent failure

Version or commit

0.1.9-nightly.20261111 (server runtime 0.1.9-nightly.20261111.4515)

Environment

Linux x64, two hosts: a desktop (Arch-based, T3 Code Nightly AppImage) and a headless server environment. Antigravity agy CLI 1.5.5 as the binary path, sign-in method "Google account". The stale token on each host came from agy_acp_server (managed runtime on one, manual binary path on the other).

Logs or stack traces

# Profile token is untouched by sign-out and sign-in done on 11/11
$ ls -la <stateDir>/providers/antigravity/<instance>/antigravity-acp/acp_token.json
-rw------- 1 user user 510 Nov  8 20:54 acp_token.json

# Same request the probe makes, with the profile token (account A, unused)
POST https://daily-cloudcode-pa.googleapis.com/v1internal:retrieveUserQuotaSummary
gemini-weekly 1.0   gemini-5h 1.0   3p-weekly 1.0   3p-5h 1.0
# resetTime is exactly now + 7 days / now + 5 hours on every bucket

# Same request with the token the agy CLI stored at sign-in (account B)
gemini-weekly 0.994   gemini-5h 1.0   3p-weekly 0.4992   3p-5h 1.0

# Strings present in each binary (grep -a -c -F)
                              agy_acp_server.par   agy 1.5.5
GEMINI_HOME                   60                   0
AGY_ACP_FORCE_FILE_STORAGE    4                    0
acp_token.json                4                    0

# agy acp log during a T3 Code sign-in
launcher.go:249] Failed to resolve GeminiDir ".gemini": .gemini must be an absolute path: path is not absolute, falling back to default

Screenshots, recordings, or supporting files

Not attached, because the CLI view shows the account email. I have both screenshots (Usage > Limits at 100% left on all four Antigravity windows, and the agy CLI "Models & Quota" view at 49.92% weekly for Claude and GPT) and can post redacted copies.

Workaround

Switching Binary path back to the official ACP executable and signing in again should restore correct limits, since that runtime writes the file the probe reads. I have not tested this.

What I did instead, to keep the CLI: replaced the refresh_token in the profile's acp_token.json with the one from the CLI's own login. The probe then returns the right account's quota. This lasts until the account changes.

Possible fixes:

  1. When the runtime is the CLI (harnessPath === null), do not read the profile's acp_token.json. Read the CLI's login instead, or report limits as unavailable.
  2. Remove the profile's acp_token.json on sign-out and when the binary path changes runtime type.
  3. Show the account in Usage > Limits so a mismatch is visible.

Activity

  1. juliusmarminge commented on Nov 20, 2026

    @juliusmarminge
    Member

    Reproduced on main @ 29b42d4 (after #38957), Linux x86_64, agy 1.5.12 with a real Google personal sign-in.

    The limits probe in apps/server/src/provider/antigravityUsageLimits.ts still prefers <profile>/antigravity-acp/acp_token.json whenever that file exists. Only without it does it read the 1.5.x CLI's own sign-in (antigravity-oauth-token or the keyring). The 1.5.x CLI never writes or updates acp_token.json, so any copy in the profile is left over from the old 1.4.5 runtime or an earlier account.

    Steps:

    1. Antigravity instance on the native CLI, signed in with Google (profile holds a valid antigravity-acp/antigravity-oauth-token). Usage → Limits → Refresh shows the account's windows (Gemini 5-hour 74%, weekly 53%, …).
    2. Put a stale antigravity-acp/acp_token.json in the same profile ({client_id, client_secret, refresh_token, project_id} from an old runtime; here, revoked values).
    3. Refresh limits. The probe skips the valid CLI sign-in and posts the stale refresh token to https://oauth2.googleapis.com/token → 401 (twice in the trace). Usage → Limits shows no error and keeps the earlier figures, which never update. With a leftover token that is still valid for a different account, it shows that account's quota instead, as in the original report.

    This also fits a reply on the Antigravity feedback thread: "usage is constantly 100%, never updates in T3; it updates OK in the Antigravity app" (https://x.com/VSyrov7399/status/2123545415249473554).

    Fixed looks like: when the instance runs the native 1.5.x CLI, read the CLI's current sign-in, and ignore a leftover acp_token.json (or use it only for the 1.4.5 runtime that writes it). A failed probe should not keep silently showing old readings as current.

  2. juliusmarminge commented on Nov 20, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit 9bb92a4 (origin/main). I could not do the in-app reproduction here: it needs a Google account sign-in and the Antigravity Usage > Limits panel, and neither is on the VMs. The maintainer reproduced it in the app on main @ 29b42d4, after #38957 (comment on the issue). On current main I confirmed it with a unit test in apps/server/src/provider/antigravityUsageLimits.test.ts. The test gives the profile a valid native-CLI sign-in (antigravity-acp/antigravity-oauth-token) plus a leftover acp_token.json whose refresh Google answers with 401. vp test run src/provider/antigravityUsageLimits.test.ts fails on main: the probe posts the stale refresh token to https://oauth2.googleapis.com/token instead of using the CLI's current sign-in, then reports probeFailed. With the probe changed to check the CLI sign-in first, all 21 tests pass; I reverted that change.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  3. juliusmarminge commented on Nov 20, 2026

    @juliusmarminge
    Member

    Reopening: the no-repro close was wrong. The unit test described above fails on main (the usage-limits probe refreshes a stale acp_token.json and reports probeFailed instead of using the CLI sign-in in antigravity-oauth-token), and the bug was reproduced in the app on nucbox-1 earlier. Checking the CLI sign-in first is the fix.

  4. rymiwe commented on Nov 20, 2026

    @rymiwe

    Same root cause, different trigger: Gemini Enterprise (oauth-business).

    1. An instance first signed in with a personal Google account (oauth-personal), which wrote antigravity-acp/acp_token.json.
    2. Switched the instance to Gemini Enterprise and signed in with a Workspace account. The agent wrote a new antigravity-acp/acp_business_token.json. acp_token.json kept its old mtime.
    3. Usage > Limits for that instance shows the personal account's four quota windows, and its credentialFingerprint equals the one reported by a second machine signed in with that personal account. Model runs use the Workspace account (Gemini 4 Carbon is offered), so only the usage probe is on the wrong credential.

    The usage probe builds <profileDirectory>/antigravity-acp/acp_token.json for both auth methods, and acp_business does not appear in the server binary (0.1.7 and 0.1.9). For oauth-business I'd expect "limits unavailable" (pay-as-you-go has no quota windows), never another account's numbers.

  5. mths-mcfs commented on Nov 21, 2026

    @mths-mcfs
    Author

    Thanks for the repro and the notes, Julius. Before redoing #34389 I saw you had already opened #39544 for the credential order, so I left that part to you. #34389 now covers only the gap that CodeRabbit flagged on #39544: when the probe returns probeFailed, Antigravity shows the failure instead of keeping the previous reading as if it were current. It touches none of #39544's files and is ready for review. The sign-out case, where the previous account's limits stay up, is out of scope here; #39672 takes it on.

  6. Falkicon commented on Nov 22, 2026

    @Falkicon

    Confirming this still reproduces on Windows x64 with T3 Code 0.1.12-nightly.20261122.5111 and the default managed Antigravity ACP 1.5.14 runtime (same scenario as #40348, which was closed in favor of this issue):

    • Profile directory <stateDir>\providers\antigravity\<hash>\antigravity-acp\ had a leftover acp_token.json from an earlier sign-in (account A) alongside a fresh antigravity-oauth-token (account B, verified as authenticated successfully as <account B> in acp-login-*.log).
    • Signing out in T3 Code removed antigravity-oauth-token, leaving acp_token.json untouched on disk.
    • Re-signing in with account B (even in an Incognito browser window and after reinstalling/updating T3 Code) still caused Usage → Limits to refresh the stale acp_token.json for account A, while the standalone agy CLI showed account B's quota accurately.
    • Additional linked-environment symptom: When linked to a second machine (macOS) legitimately signed into account A, the stale acp_token.json caused both machines to emit the same credentialFingerprint, silently collapsing the two accounts into a single Antigravity limit display (and with no signed-in email shown in the UI, it was impossible to tell from the app why).

    Workaround confirmed: Removing the leftover acp_token.json and signing back in immediately resolved the issue and split Usage → Limits back into both accounts. Looking forward to #39544 (and #38097 / #39672).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions