GeezerVison is showing github.com — fix(server): Antigravity usage limits ignore leftover acp_token.json by Waishnav · Pull Request #42623 · pingdotgg/t3code
Conversation
Waishnav
commented
Nov 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
Antigravity usage limits can stay stuck at 100% left (falling back to Reported quota with a rolling 4h 59m reset) or show another Google account's limits whenever an upgraded profile still has a leftover antigravity-acp/acp_token.json alongside the 1.5.x agy CLI's antigravity-oauth-token.
makeAntigravityUsageProbe checked fs.exists(acp_token.json) first, so any profile carrying a pre-1.5 acp_token.json always refreshed and queried Google with that stale credential instead of the active CLI sign-in. When the stale account returned 403 PERMISSION_DENIED (VALIDATION_REQUIRED) on retrieveUserQuotaSummary, the probe silently fell back to fetchAvailableModels and reported 100% left across Gemini / Claude / GPT · Reported quota.
Change
- Removed the legacy
acp_token.json OAuth refresh path and its refreshed-token cache (clear) from makeAntigravityUsageProbe in apps/server/src/provider/antigravityUsageLimits.ts (T3 Code already refuses pre-1.5 Antigravity runtimes that wrote that file).
makeAntigravityUsageProbe now reads only antigravity-oauth-token (or the OS keyring for oauth-business when no file is present), ignoring any leftover acp_token.json.
- Removed the now-unused
clearUsage wiring in apps/server/src/provider/Drivers/AntigravityDriver.ts.
- Updated
apps/server/src/provider/antigravityUsageLimits.test.ts to test CLI sign-in probes directly, verify distinct Authorization headers across sign-in changes, and cover leftover acp_token.json alongside valid, expired, and absent CLI credentials.
Scope
Fixes #40015 and #34381. Supersedes the stalled #39544 with live-profile verification.
Verification
- Live profile check (Linux x64,
agy 1.5.16, oauth-personal): Against a real profile containing both a leftover acp_token.json (which returned 403 on retrieveUserQuotaSummary and fell back to 100% Reported quota) and a fresh antigravity-oauth-token, running the patched makeAntigravityUsageProbe returned all 4 summary windows from the active account (Gemini · 5-hour at 15.12% used, Gemini · Weekly at 5.35% used, Claude & GPT (shared) · 5-hour and Weekly at 0% used) with real reset timestamps while acp_token.json remained untouched on disk.
- Checks:
vp run check:changed passed (format, lint, knip 2/2, graphql, typecheck across 3 packages, and vp test across 3 files: 31 passed, 1 Windows-only keyring test skipped on Linux).
- Not verified here: Windows Credential Manager path (skipped on Linux) and macOS Keychain behavior with
agy 1.5.16 (tracked separately in [Bug]: Antigravity 1.5.16 breaks isolated file token storage & usage limits (expects AGY_CLI_FORCE_FILE_TOKEN_STORAGE instead of AGY_ACP_FORCE_FILE_STORAGE / SSH_CONNECTION) #41973 / fix(server): Antigravity 1.5.16 Google sign-ins stay in profile storage #41982).
Before (with acp_token.json shadowing antigravity-oauth-token)
After (this branch, with acp_token.json still present on disk)
Prepared with Gemini 4 Neon via Antigravity in T3 Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-25T05:09:44.454222Z |
c6d4293 |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The Antigravity usage probe now reads the CLI token file and uses a keyring fallback for business sign-ins. It sends quota requests with the saved access token, rejects missing or near-expiry credentials, and no longer caches credentials or exposes a clear operation.
Changes: Antigravity usage probe
| Layer / File(s) |
Summary |
CLI credential resolution apps/server/src/provider/antigravityUsageLimits.ts, apps/server/src/provider/antigravityUsageLimits.test.ts |
The probe reads credentials from the CLI token file and falls back to the keyring for business sign-ins. It checks token expiry and derives the account fingerprint from user information, with a token hash fallback. Tests cover missing, malformed, and expiring credentials. |
Authenticated quota requests apps/server/src/provider/antigravityUsageLimits.ts, apps/server/src/provider/antigravityUsageLimits.test.ts |
Quota requests use the saved access token and an empty request body. Tests verify authorization headers and the request body. |
Credential rereads and probe contract apps/server/src/provider/antigravityUsageLimits.ts, apps/server/src/provider/Drivers/AntigravityDriver.ts, apps/server/src/provider/antigravityUsageLimits.test.ts |
The probe no longer caches credentials or returns a clear operation. The driver no longer supplies clearUsage. Tests verify that changed credentials are used and that a missing CLI token file returns an unsupported result. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant Probe as makeAntigravityUsageProbe
participant CliFile as antigravity-oauth-token
participant Keyring
participant UserInfo as User-info endpoint
participant Quota as Quota endpoint
Probe->>CliFile: Read CLI credentials
CliFile-->>Probe: Return saved access token
opt oauth-business and CLI credentials unavailable
Probe->>Keyring: Read business access token
Keyring-->>Probe: Return access token
end
Probe->>UserInfo: Look up account with saved access token
UserInfo-->>Probe: Return account data
Probe->>Quota: Send quota request with access token and empty body
Quota-->>Probe: Return quota data
Loading
Possibly related issues
- Issue 34381: The probe no longer reads or refreshes credentials from
acp_token.json, which matches the issue’s reported stale-account cause. The issue’s account display suggestion is not covered.
- Issue 41973: The probe reads
antigravity-oauth-token and uses the keyring for business sign-ins. The issue’s personal-account keyring gap and SSH or environment-variable storage cases are not covered.
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · up to c6d42
-
The Antigravity usage probe now uses the active CLI sign-in credentials and ignores the stale legacy token file, which addresses the incorrect quota display. No concrete merge-blocking risk was found. Windows and macOS sign-in behavior has not been verified and is tracked in follow-up issues.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: the Antigravity usage probe no longer reads a leftover acp_token.json, which caused stale-account quota results. It uses the conventional commit form. The title is spe… |
| Linked Issues check |
 |
Objective [#40015]: show accurate 5-hour and weekly Antigravity usage, and detect Argon's separate quota for Pro/Plus accounts. At the reviewed head, summaryWindows in `apps/server/src/provider/anti… |
| Out of Scope Changes check |
 |
All changes relate to the credential-source fix for the stale-token bug in the linked issue. The diff removes the acp_token.json OAuth refresh path, the TokenFile and TokenResponse schemas, the … |
| Description check |
 |
The description is thorough and follows the repository template. It has a Problem section that explains the stale acp_token.json shadowing the active CLI credential, a Change section listing the remov… |
Full details: Title check
-
Explanation
The title names the main change: the Antigravity usage probe no longer reads a leftover acp_token.json, which caused stale-account quota results. It uses the conventional commit form. The title is specific and matches the summary, the description, and the objectives.
Full details: Linked Issues check
-
Explanation
Objective [#40015]: show accurate 5-hour and weekly Antigravity usage, and detect Argon's separate quota for Pro/Plus accounts. At the reviewed head, summaryWindows in apps/server/src/provider/antigravityUsageLimits.ts maps gemini-argon-* buckets to a separate family (Gemini Argon or the group display name). It also maps 5h and weekly windows to session and weekly kinds with window lengths. The diff against the merge base does not change this code, so the Argon handling already exists and this PR does not need to add it. The PR changes the credential source: makeAntigravityUsageProbe now reads antigravity-oauth-token (or the keyring for oauth-business) and ignores a stale acp_token.json. This removes the fallback to fetchAvailableModels that reported 100% left when the stale credential returned 403. The PR reports a live Linux check that returned four summary windows from the active account. That check does not show an Argon bucket, and the summary does not show a test that covers an Argon-only account. Argon detection therefore rests on existing code, not on new verification.
Full details: Out of Scope Changes check
-
Explanation
All changes relate to the credential-source fix for the stale-token bug in the linked issue. The diff removes the acp_token.json OAuth refresh path, the TokenFile and TokenResponse schemas, the refreshed-token cache, and the clear return value. It also removes the matching clearUsage wiring in AntigravityDriver.ts and changes the quota request body to {}, because the project ID came from the removed file. The test file changes cover the CLI token path that the fix depends on. No change falls outside the stated objective.
Full details: Description check
-
Explanation
The description is thorough and follows the repository template. It has a Problem section that explains the stale acp_token.json shadowing the active CLI credential, a Change section listing the removed refresh path and the updated tests, a Scope section linking #40015 and #34381 and citing the superseded #39544, and a Verification section with a live Linux profile check, the checks that were run, and the items not verified. Before and after screenshots are included for the UI-visible result. The template asks for the model and harness used, and the description says it was prepared with Gemini 4 Neon via Antigravity in T3 Code, so that line is present. The main gap is that the Scope section does not say why the change is a bug fix rather than a feature, though it is clearly a bug fix. The check passes.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between e2c3c42 and c6d4293.
Files selected for processing: 3
-
apps/server/src/provider/Drivers/AntigravityDriver.ts
apps/server/src/provider/antigravityUsageLimits.test.ts
apps/server/src/provider/antigravityUsageLimits.ts
Files with no reviewable changes: 1
-
- apps/server/src/provider/Drivers/AntigravityDriver.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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. The code this PR changes no longer exists. Limits will come back only if Antigravity exposes them over ACP. Thanks for the work on this!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|