Skip to content

fix(antigravity): show Gemini session and weekly limits - #12444

Closed
lukasbxy wants to merge 3 commits into
pingdotgg:mainfrom
lukasbxy:feat/antigravity-usage-limits
Closed

lukasbxy wants to merge 3 commits into
pingdotgg:mainfrom
lukasbxy:feat/antigravity-usage-limits

Conversation

@lukasbxy

@lukasbxy lukasbxy commented Sep 18, 2026 •

Copy link
Copy Markdown

What Changed

Usage → Limits now shows Antigravity Gemini session and weekly remaining quota from the Google login stored for that instance. Claude and GPT buckets from the same login are omitted. API-key and Vertex connections still report as unsupported.

Mobile /usage-limits and the pooled Limits screen get an Antigravity label so that snapshot is readable there too.

Why

Antigravity could already be signed in, but Limits never asked it for quota, so the provider never appeared. That is #10919.

The health check cannot spawn ACP just to read remaining quota. This reads acp_token.json, refreshes the Google token, and calls daily-cloudcode-pa.googleapis.com retrieveUserQuotaSummary. The cloudcode-pa host answers the same RPC with remainingFraction: 1 on every bucket, so remaining has to come from the daily host.

#10903 is a larger Antigravity quota probe with extra endpoints and UI sorting. This PR only fills the existing Limits cards.

Fixes #10919

UI Changes

Before, top of Limits. Codex, Claude, Cursor. No Antigravity.

Before: Limits tab, top of the list

Before, end of Limits. Cursor, then OpenCode.

Before: Limits tab, end of the list

After. OpenCode, then Antigravity with Gemini session and weekly remaining.

After: Limits tab with Antigravity Gemini limits

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Summary by CodeRabbit

  • New Features

    • Added Antigravity usage-limit reporting for supported Google OAuth connections.
    • Usage displays Gemini session and weekly allowances, including refreshed limits when a session starts.
    • Unsupported connection types and unavailable quota information are handled without displaying misleading limits.
    • Added the friendly “Antigravity” label wherever provider names appear.
  • Documentation

    • Documented Antigravity quota coverage and exclusions, including Claude, GPT, API-key, and Vertex limits.

lukasbxy and others added 2 commits September 18, 2026 12:35
Limits skipped Antigravity even when a Google login was present. Probe
the daily Cloud Code quota summary and map Gemini windows onto the
existing Limits cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
Limits stayed on the pre-login unsupported snapshot until the next
health check, and an expired stored access token skipped refresh and
failed the quota read. Re-probe on session start, and retry Cloud Code
once after a 401.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 18, 2026
Comment thread apps/server/src/provider/Layers/AntigravityProvider.ts
@macroscopeapp

macroscopeapp Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a substantial Antigravity quota capability with OAuth token handling, external Cloud Code requests, provider lifecycle changes, and new user-facing limits. An unresolved medium-severity stale-session state concern further warrants human review.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f4b5861d-28ae-4980-9f7f-a8751f74f6e7

📥 Commits

Reviewing files that changed from the base of the PR and between fefd971 and 5fede3e.

📒 Files selected for processing (2)
  • apps/server/src/provider/Layers/AntigravityProvider.test.ts
  • apps/server/src/provider/Layers/AntigravityProvider.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Antigravity now reads Google quota data without launching the ACP agent, maps Gemini session and weekly limits, publishes them through provider snapshots, and clears them on sign-out. Mobile usage views use the “Antigravity” label, and documentation describes supported and excluded quota sources.

Changes

Antigravity usage limits

Layer / File(s) Summary
Quota probing and mapping
apps/server/src/provider/Layers/antigravityUsageLimits.ts, apps/server/src/provider/Layers/antigravityUsageLimits.test.ts
Antigravity reads Google OAuth tokens, queries Cloud Code quotas, maps Gemini session and weekly windows, and handles refresh, unsupported, and failed probes.
Provider integration and lifecycle state
apps/server/src/provider/Layers/AntigravityProvider.ts, apps/server/src/provider/Drivers/AntigravityDriver.ts, apps/server/src/provider/antigravityAuthSupport.ts, apps/server/src/provider/Layers/AntigravityProvider.test.ts, apps/server/src/provider/Drivers/AntigravityDriver.test.ts
The provider retrieves usage limits during health checks and session startup, publishes them in snapshots, clears them on sign-out, and supplies the required services.
Dashboard labels and documentation
apps/mobile/src/features/threads/ComposerUsageLimits.tsx, apps/mobile/src/features/usage/UsageLimitsPooled.tsx, docs/user/usage.md
Mobile views label Antigravity correctly. Documentation describes Gemini session and weekly limits and excluded quota sources.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant ProviderLifecycle
  participant AntigravityProvider
  participant UsageLimitsReader
  participant CloudCode
  ProviderLifecycle->>AntigravityProvider: initialize or start session
  AntigravityProvider->>UsageLimitsReader: readAntigravityUsageLimits
  UsageLimitsReader->>CloudCode: request quota summary
  CloudCode-->>UsageLimitsReader: Gemini quota data
  UsageLimitsReader-->>AntigravityProvider: usage windows
  AntigravityProvider-->>ProviderLifecycle: snapshot with usage limits
Loading

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 5fede

Antigravity quota reporting is integrated with lifecycle cleanup and session-race protection, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: displaying Antigravity Gemini session and weekly usage limits.
Description check ✅ Passed The description includes complete What Changed, Why, UI Changes, and Checklist sections. It explains the implementation, scope, linked issue, and UI impact, with before-and-after screenshots. The unch…
Linked Issues check ✅ Passed Issue #10919 requires Antigravity usage and limit consumption in the Usage dashboard. The PR reads the stored Google OAuth token, refreshes credentials when required, queries Cloud Code `retrieveUserQ…
Out of Scope Changes check ✅ Passed The changed files support issue #10919. They implement Antigravity quota retrieval, provider integration, authentication-path resolution, UI labels, documentation, and automated tests. Excluding Claud…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

onSessionStarted waited on quota before writing, then applied the result
whenever the current account was still signed in. Match the health-check
revision guard so an older callback cannot overwrite a newer session.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lukasbxy

Copy link
Copy Markdown
Author

@macroscope-app review

@macroscopeapp

macroscopeapp Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Sorry, I'm unable to act on this request because you do not have permissions within this repository.

@lukasbxy

Copy link
Copy Markdown
Author

Closing to open a new PR so Macroscope can run a first-pass review on the current HEAD. The branch is unchanged.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: Antigravity usage and limits not showing up in the Usage dashboard

1 participant