Skip to content

fix(desktop): restore Gemini quota in Antigravity usage - #10199

Open
youngtilopia wants to merge 1 commit into
ParadevAI:mainfrom
youngtilopia:codex/antigravity-gemini-quota
Open

youngtilopia wants to merge 1 commit into
ParadevAI:mainfrom
youngtilopia:codex/antigravity-gemini-quota

Conversation

@youngtilopia

@youngtilopia youngtilopia commented Nov 24, 2026 •

Copy link
Copy Markdown

What & why

The Antigravity card in Settings → Usage can show the Claude/GPT meters while omitting both Gemini meters. The Antigravity CLI can return all four windows through its read-only /usage command.

Use the CLI’s JSON output on versions that support read-only slash commands in print mode. Map the native buckets to the existing Usage rows and retain the existing fallback for older or unavailable CLIs. Google introduced non-interactive /usage in Antigravity CLI 1.1.11.

How I tested it

  • The focused Bun tests passed for both the native CLI response and the legacy response.
  • The patched quota reader returned the Gemini and Claude/GPT session and weekly meters against Antigravity CLI 1.5.16 on macOS.
  • Repository-wide Biome 2.4.2 and bun run typecheck passed.
  • The full bun run test run stopped on a shared recurrence assertion and local server and filesystem watcher errors. The live check exercised the patched reader directly.

Checklist

  • PR title follows conventional commits
  • Lint and typecheck pass
  • Allow edits from maintainers
  • CLA confirmed

Summary by cubic

Restores the Gemini quota meters that the Antigravity usage card was omitting by reading all four quota windows from the Antigravity CLI's read-only /usage command.

  • On macOS, runs agy --print /usage --output-format json when the CLI is at least 1.1.11 and maps the Gemini and Claude/GPT session and weekly buckets from its JSON output.
  • Falls back to the existing keychain-based quota fetch for older or unavailable CLIs.
  • mapAgyQuotaWindows now accepts both the native CLI field names (id, remaining_fraction, reset_time) and the existing keychain shape.

Written for commit 625d1c6. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • New Features
    • On macOS, quota usage can now be retrieved from a supported Antigravity CLI, showing usage percentages, quota labels, and reset times. If the CLI is unavailable or cannot provide usable quota data, the app continues to use its existing quota retrieval method.

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

On macOS, Antigravity account fetching now tries supported agy CLI quota output first, maps accepted bucket formats into quota windows, and falls back to the existing Keychain and token API path when CLI windows are unavailable. Fetch and request timeouts use abort signals.

Changes: Antigravity quota retrieval

Layer / File(s) Summary
Quota output normalization
packages/host-service/src/trpc/router/usage/agy-quota.ts, packages/host-service/src/trpc/router/usage/agy-quota.test.ts
Quota mapping accepts camelCase and snake_case bucket fields, rejects unknown IDs and non-finite remaining values, and clamps the calculated used percentage. The CLI mapper accepts successful usage results. Tests cover recognized buckets, duplicates, string values, and unknown buckets.
CLI-first retrieval and fallback
packages/host-service/src/trpc/router/usage/agy-quota.ts
On macOS, account fetching checks for CLI version 1.1.11 or later and requests headless usage output. When CLI quota windows are unavailable, fetching uses the Keychain and quota API path. Keychain and API calls receive abort signals.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant fetchAgyAccounts
  participant agyCLI
  participant quotaMapper
  participant Keychain
  participant quotaAPI
  fetchAgyAccounts->>agyCLI: Check version and request usage
  agyCLI-->>fetchAgyAccounts: Return usage result
  fetchAgyAccounts->>quotaMapper: Map CLI result
  alt CLI quota windows are available
    quotaMapper-->>fetchAgyAccounts: Return quota windows
  else CLI quota windows are unavailable
    fetchAgyAccounts->>Keychain: Read credentials with shared abort signal
    Keychain-->>fetchAgyAccounts: Return credentials
    fetchAgyAccounts->>quotaAPI: Request quota with combined timeout signal
    quotaAPI-->>fetchAgyAccounts: Return quota response
  end
Loading

Suggested reviewers: kitenite

Merge Risk: Minimal · up to 625d1

This change restores Gemini usage meters in the Antigravity card by reading the Antigravity CLI's usage output. It keeps the existing fallback for older or unavailable CLIs. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(desktop): restore Gemini quota in Antigravity usage" matches the main change. The raw summary and PR objectives show the change maps native Antigravity CLI usage buckets so the Gemini m…
Description check Passed The description fills the template's main sections. The 'What & why' section explains the missing Gemini meters, the CLI-based fix, the fallback, and links the CLI changelog for version 1.1.11. The 'H…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(desktop): restore Gemini quota in Antigravity usage" matches the main change. The raw summary and PR objectives show the change maps native Antigravity CLI usage buckets so the Gemini meters return in the Antigravity usage card. It follows conventional commit format and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description fills the template's main sections. The 'What & why' section explains the missing Gemini meters, the CLI-based fix, the fallback, and links the CLI changelog for version 1.1.11. The 'How I tested it' section lists the Bun tests, the live check against Antigravity CLI 1.5.16 on macOS, and the Biome and typecheck runs. The checklist is present, with the CLA item unchecked. No screenshots are attached, although the template strongly prefers before/after screenshots for user-visible bug fixes. The description does not link a related issue, and the template only asks for one when one exists.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff9490dc-0cad-497b-9e41-e3f4e7bb1a74
Commits

Reviewing files that changed from the base of the PR and between c9daa6e and 625d1c6.

Files selected for processing: 2

  • packages/host-service/src/trpc/router/usage/agy-quota.test.ts
  • packages/host-service/src/trpc/router/usage/agy-quota.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.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant