[Bug]: Antigravity usage limits show a stale account's quota when the agy CLI is the binary path #34381
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#
- Set up Antigravity with the official ACP executable (managed runtime or a manual
agy_acp_serverbinary path) and sign in with Google account A. This writes<stateDir>/providers/antigravity/<instance>/antigravity-acp/acp_token.json. - In Settings > Providers > Antigravity, change Binary path to the
agyCLI (1.5.5 here), as supported since #33143. - Sign out, then sign in with Google account B. The provider reports "Authenticated".
- Use account B until its quota is visibly consumed. Running
agyin a terminal shows, for example, 49.92% left on the weekly Claude and GPT limit. - 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:
makeAntigravityUsageProbeinapps/server/src/provider/antigravityUsageLimits.tsalways reads<profile>/antigravity-acp/acp_token.jsonand only checks that the file exists.- The official ACP executable honors
GEMINI_HOMEandAGY_ACP_FORCE_FILE_STORAGEand writes that file. TheagyCLI does not: its binary contains neither variable name noracp_token.json, and it logsFailed to resolve GeminiDir ".gemini" ... falling back to default. It keeps its login in its own store (~/.gemini/antigravity-cli/antigravity-oauth-tokenon 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:
- When the runtime is the CLI (
harnessPath === null), do not read the profile'sacp_token.json. Read the CLI's login instead, or report limits as unavailable. - Remove the profile's
acp_token.jsonon sign-out and when the binary path changes runtime type. - Show the account in Usage > Limits so a mismatch is visible.
tanstack-source added labelsbug
I tried to reproduce this on the current build and could not.
Commit 9bb92a46dd (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 @ 29b42d409ca, 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.tsfails 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.
juliusmarminge closed this
juliusmarminge reopened this
Reopening: the no-repro close was wrong. The unit test described above fails on main (the usage-limits probe refreshes a stale
acp_token.jsonand reports probeFailed instead of using the CLI sign-in inantigravity-oauth-token), and the bug was reproduced in the app on nucbox-1 earlier. Checking the CLI sign-in first is the fix.Same root cause, different trigger: Gemini Enterprise (
oauth-business).- An instance first signed in with a personal Google account (
oauth-personal), which wroteantigravity-acp/acp_token.json. - 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.jsonkept its old mtime. - Usage > Limits for that instance shows the personal account's four quota windows, and its
credentialFingerprintequals 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.jsonfor both auth methods, andacp_businessdoes not appear in the server binary (0.1.7 and 0.1.9). Foroauth-businessI'd expect "limits unavailable" (pay-as-you-go has no quota windows), never another account's numbers.- An instance first signed in with a personal Google account (
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.Confirming this still reproduces on Windows x64 with T3 Code
0.1.12-nightly.20261122.5111and the default managed Antigravity ACP1.5.14runtime (same scenario as #40348, which was closed in favor of this issue):- Profile directory
<stateDir>\providers\antigravity\<hash>\antigravity-acp\had a leftoveracp_token.jsonfrom an earlier sign-in (account A) alongside a freshantigravity-oauth-token(account B, verified asauthenticated successfully as <account B>inacp-login-*.log). - Signing out in T3 Code removed
antigravity-oauth-token, leavingacp_token.jsonuntouched 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.jsonfor account A, while the standaloneagyCLI 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.jsoncaused both machines to emit the samecredentialFingerprint, 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.jsonand signing back in immediately resolved the issue and split Usage → Limits back into both accounts. Looking forward to #39544 (and #38097 / #39672).- Profile directory
Same symptom on macOS with the managed 1.5.16 runtime. One extra finding: on 1.5.16, #39544 alone will not fix this on macOS. It also needs #41982 (#41973).
Environment: T3 Code Desktop
0.1.12-nightly.20261124.5209, macOS (Darwin 25.6.0, arm64), managed Antigravity ACP 1.5.16 (33f5617d…), oneoauth-personalinstance, no custom binary path.What happened
- In Usage → Limits, this Mac's Antigravity row read 100% left on every window, with no reset times.
- The profile still had an old
antigravity-acp/acp_token.json(dated Sep 9) for account A, a free-tier account. The runtime has signed in as account B since Nov 24 (acp-server-*.log:ChainedAuth: authenticated via keyring…authenticated successfully as <account B>). The probe refreshed the old token, socredentialFingerprintbelonged to account A and every bucket wasremainingFraction: 1. - Signing in again in T3 did not change it.
acp_token.jsonkept its Sep 9 date.
Why #39544 alone is not enough on 1.5.16 / macOS
- The new T3 sign-in went into the shared Keychain entry, not the profile. The token expiry in its
acp-login-*.logis the same as thekeyringAuth: loaded token, expiry=…line in the nextacp-server-*.log. The runtime hadSSH_CONNECTION=127.0.0.1 0 127.0.0.1 0andAGY_ACP_FORCE_FILE_STORAGE=1. The 1.5.16 binary containsAGY_CLI_FORCE_FILE_TOKEN_STORAGEinstead (#41973). - So the profile has no
antigravity-oauth-token. After I moved the oldacp_token.jsonaside, the next probe returned"Sign in with Google to see Antigravity limits.", because the probe reads the keyring only foroauth-business. - With #39544, the probe would skip the old file and give that same "Sign in" result. To get correct limits here, you need #39544 (or the old file deleted) and #41982 too.
Workaround: move the old
acp_token.jsonaside. This removes the wrong row but shows no limits for this Mac.Investigated and written by Claude Opus 5.5 (Claude Code), through T3 Code triage.
Follow-up: a workaround that gives correct limits on macOS with 1.5.16, until #41982 ships.
- Move the old
antigravity-acp/acp_token.jsonout of the profile. - In Settings → Providers → Antigravity, add the environment variable
AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1. - Sign out and sign in with Google again.
Result on
0.1.12-nightly.20261124.5209:- The
acp-login-*.logandacp-server-*.logboth sayUsing file-based token storage because AGY_CLI_FORCE_FILE_TOKEN_STORAGE is set. - The profile now has
antigravity-oauth-token. - Usage → Limits shows all four windows with real values and reset times. They match
agy /usagefor the same account. - The instance sign-in is now separate from the shared Keychain entry that the
agyCLI uses.
Written by Claude Opus 5.5 (Claude Code), through T3 Code triage.
- Move the old
Closing this: #43026 removed the Antigravity usage-limit reads entirely. The Antigravity team confirmed that only ACP is supported for external clients and that calling internal APIs (
cloudcode-pa.googleapis.com/v1internal) can flag a user's account, so T3 Code no longer shows Antigravity limits, locally or from CLIProxyAPI hubs. They will come back only if Antigravity exposes them over ACP.juliusmarminge closed this
Sign in to join this conversation.
Reproduced on main @ 29b42d409ca (after #38957), Linux x86_64,
agy1.5.12 with a real Google personal sign-in.The limits probe in
apps/server/src/provider/antigravityUsageLimits.tsstill prefers<profile>/antigravity-acp/acp_token.jsonwhenever that file exists. Only without it does it read the 1.5.x CLI's own sign-in (antigravity-oauth-tokenor the keyring). The 1.5.x CLI never writes or updatesacp_token.json, so any copy in the profile is left over from the old 1.4.5 runtime or an earlier account.Steps:
antigravity-acp/antigravity-oauth-token). Usage → Limits → Refresh shows the account's windows (Gemini 5-hour 74%, weekly 53%, …).antigravity-acp/acp_token.jsonin the same profile ({client_id, client_secret, refresh_token, project_id}from an old runtime; here, revoked values).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.