t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Antigravity usage probe prefers a stale acp_token.json over the profile's current CLI token, merging two accounts into one

Open liubing0806 opened this issue 1 week ago • 1 comments

Before submitting

  • [x] I searched open and closed issues and checked the related reports listed below.
  • [x] I included reproduction steps and evidence from the installed application.

Related: #18317 (same symptom, closed), #34327 (added the antigravity-oauth-token fallback).

Area

apps/server — Antigravity usage probe (antigravityUsageLimits.ts, makeAntigravityUsageProbe); Usage → Limits

Steps to reproduce

  1. Configure two Antigravity provider instances (antigravity and antigravity_2), both oauth-personal.
  2. Have <stateDir>/providers/antigravity/<hash(antigravity)>/antigravity-acp/acp_token.json left over from an earlier sign-in with Google account B (created 2026-11-18 and never updated since).
  3. Sign instance antigravity in with Google account A and antigravity_2 with account B. Each profile's antigravity-oauth-token now holds a different account (different id_token_email), and both are refreshed normally during turns.
  4. Open Usage → Limits.

Expected behavior

Each instance's limits are read with the same credential the runtime uses for that instance, and Usage → Limits shows two Antigravity accounts.

Actual behavior

makeAntigravityUsageProbe prefers acp_token.json whenever it exists and reads antigravity-oauth-token only when it is absent. For instance antigravity it therefore refreshes the stale acp_token.json (account B) instead of the current CLI token (account A).

Both cached results get the same credentialFingerprint (sha256("google-account\0" + userinfo.id) of account B) and identical windows down to resetsAt. The client merges rows by driver:credential:<fingerprint>, so only one Antigravity account appears, and it shows account B's quota for both instances. Turns themselves run on the correct accounts; only the limits are wrong.

After renaming the stale acp_token.json, the next probe returned a different fingerprint and different windows for instance antigravity, and Usage → Limits showed both accounts.

Suggested fix: prefer the credential the managed runtime actually uses (antigravity-oauth-token for the current agy CLI), or ignore acp_token.json when its account differs from the CLI token / is older than it. Alternatively, remove or migrate acp_token.json once the CLI token is present.

Impact

Usage → Limits shows the wrong account's quota for one instance and hides the other account. Users may pick the wrong account based on the shown remaining quota.

Version or commit

T3 Code 0.1.11 (server and client); managed Antigravity runtime 1.5.14

Environment

Linux x64 (Arch, kernel 6.18)

Logs or stack traces

cache antigravity.json   usageLimits.credentialFingerprint = 111887cc…  (before workaround)
cache antigravity_2.json usageLimits.credentialFingerprint = 111887cc…
windows identical: gemini-5h 4.09% resetsAt 2026-11-23T12:50:14Z, 3p-weekly 39.10% resetsAt 2026-11-26T08:31:10Z, ...

after renaming acp_token.json in the `antigravity` profile:
cache antigravity.json   usageLimits.credentialFingerprint = 707f8042…
cache antigravity_2.json usageLimits.credentialFingerprint = 111887cc…

Screenshots, recordings, or supporting files

No response

Workaround

Rename <stateDir>/providers/antigravity/<instanceHash>/antigravity-acp/acp_token.json in the affected profile, then refresh limits.

liubing0806 avatar Nov 23 '26 09:11 liubing0806

This is the same problem as #34381, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

juliusmarminge avatar Nov 23 '26 09:11 juliusmarminge