Skip to content

fix(rate-limits): read native Antigravity usage - #20797

Open
abti-ai wants to merge 1 commit into
stablyai:mainfrom
abti-ai:fix/antigravity-native-usage
Open

abti-ai wants to merge 1 commit into
stablyai:mainfrom
abti-ai:fix/antigravity-native-usage

Conversation

@abti-ai

@abti-ai abti-ai commented Sep 15, 2026

Copy link
Copy Markdown

Summary

  • Read Antigravity quota data from native agy --print /usage --output-format json instead of mirroring Gemini quota state.
  • Preserve Antigravity's independent Gemini and Claude/GPT quota groups and native 5h/weekly windows.
  • Integrate those buckets with Orca's existing Used/Remaining and compact/detailed usage UI patterns.

Behavior

  • Compact mode selects the tightest window independently per Antigravity group using the existing consumption-based rule; ties preserve first-in-order/session-first behavior.
  • Compact Usage shows bare percentage + reset countdown.
  • Compact status/menu shows % used / % left + reset countdown.
  • Detailed Usage keeps short 5h / wk; provider flyouts use localized Session / Weekly.
  • Unknown future windows preserve their source label or duration fallback.

Implementation

  • Uses execFileCaptureToTermination through Orca's shared runProcess / resolveSpawn path with fixed argv, no shell interpolation, AbortSignal handling, bounded output/deadline, and process-tree termination.
  • Antigravity refresh is independent from Gemini state/OAuth.
  • Shared tightest-window selection helper avoids renderer import cycles.

Validation

  • Focused Antigravity/status-bar tests: 107/107 passed after the final squash.
  • Typecheck, changed-code quality, formatting, lint/static analysis, localization, Electron/Vite build, Windows package, and all Node 24 test shards passed on the finalized feature revision.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5f524a7d-36e0-4b64-874c-1524267c8689

📥 Commits

Reviewing files that changed from the base of the PR and between 3ac7723 and 03bce76.

📒 Files selected for processing (6)
  • src/main/rate-limits/antigravity-usage-fetcher.test.ts
  • src/main/rate-limits/antigravity-usage-fetcher.ts
  • src/renderer/src/components/status-bar/UsageRosterPanel.test.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.tsx
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/status-bar/tooltip.tsx

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


📝 Walkthrough

Walkthrough

The change adds direct Antigravity usage fetching through the agy CLI. The refresh service now stores Antigravity results independently from Gemini. Shared rate-limit types include provider group metadata. Status-bar segments and tooltips render grouped Antigravity windows, native labels, usage percentages, and reset durations. Antigravity visibility now depends on its own configuration. Tests cover fetching, service integration, rendering, and visibility.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 03bce

This change switches Antigravity usage reporting from mirroring Gemini quota data to reading native quota data directly from the agy CLI, with independent refresh, grouped status-bar displays, and fallback handling for stale or failed reads. Review confirms that error and stale-data states remain visibly indicated to users rather than silently showing outdated data as current, and previously identified ordering and validation concerns have been addressed with test coverage. No unresolved correctness, stability, or security concerns were found in the reviewed scope, so the change appears ready to merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, behavior, motivation, and validation, but it omits most required template sections. It does not include an issue link, visual proof or an explicit N/A expl… Update the description to use the repository template. Add a valid Fixes #... issue reference, provide before-and-after visual proof or write N/A with a reason, complete the Testing checklist with platform details, complete AI Disclosur…
Docstring Coverage ⚠️ Warning Docstring coverage is 10.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: reading native Antigravity usage data.
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: Description check

Explanation

The description explains the implementation, behavior, motivation, and validation, but it omits most required template sections. It does not include an issue link, visual proof or an explicit N/A explanation, testing checkboxes and platform details, AI disclosure, review section, boundary confirmation, notes, or the checklist.

Resolution

Update the description to use the repository template. Add a valid Fixes #... issue reference, provide before-and-after visual proof or write N/A with a reason, complete the Testing checklist with platform details, complete AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

  • Fix all pre-merge checks with AI

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e3792a05-6083-42e2-923f-e91208f7bad9

📥 Commits

Reviewing files that changed from the base of the PR and between c9ae17f and 3ac7723.

📒 Files selected for processing (20)
  • src/main/rate-limits/antigravity-usage-fetcher.test.ts
  • src/main/rate-limits/antigravity-usage-fetcher.ts
  • src/main/rate-limits/antigravity-usage-mirror.test.ts
  • src/main/rate-limits/antigravity-usage-mirror.ts
  • src/main/rate-limits/service-antigravity-usage.test.ts
  • src/main/rate-limits/service/service-full-cycle-application.ts
  • src/main/rate-limits/service/service-full-cycle-preparation.ts
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.test.tsx
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.test.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.tsx
  • src/renderer/src/components/status-bar/antigravity-compact-metrics.tsx
  • src/renderer/src/components/status-bar/antigravity-usage-format.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-section-selection.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/shared/rate-limit-types.ts
💤 Files with no reviewable changes (2)
  • src/main/rate-limits/antigravity-usage-mirror.ts
  • src/main/rate-limits/antigravity-usage-mirror.test.ts

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

Comment thread src/renderer/src/components/status-bar/UsageRosterPanel.tsx Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one real defect in the timeout classification, and the test that should catch it asserts a shape production never produces.

Reviewed changes

  • Native Antigravity fetcher — new fetchAntigravityRateLimits shells out to agy --print /usage --output-format json via execFileCaptureToTermination (fixed argv, no shell, AbortSignal, 10s deadline, 1 MiB cap), parses provider groups/buckets, and classifies failures.
  • Mirror removedantigravity-usage-mirror.ts and its tests are deleted; Antigravity becomes its own Promise.allSettled slot, applied through applyStalePolicy so buckets participate in stale retention.
  • Visibility decoupled from Geministatus-bar-provider-visibility.ts now treats antigravityUsageConfigured (checked status item + detected agy CLI) as the durable signal, no longer requiring the Gemini OAuth opt-in.
  • Renderer — grouped verbose/compact Antigravity rendering, per-group tightest-window selection (session-first ties), native 5h/wk/source-window labels, and a shared usage-section-selection helper.
  • Shared types — optional RateLimitWindow.windowLabel and RateLimitBucket.id/groupName/groupDescription (additive, wire-safe).

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/rate-limits/antigravity-usage-fetcher.ts Outdated
@abti-ai
abti-ai force-pushed the fix/antigravity-native-usage branch from 3ac7723 to 03bce76 Compare September 15, 2026 07:35

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Timeout classification fixedclassifyAgyFailure now also matches killed === true / signal === 'SIGTERM', so a real deadline kill from execFileCaptureToTermination reaches the timeout-specific copy instead of the generic read-failure message. The regression test now rejects with the production shape ({ code: null, killed: true, signal: 'SIGTERM' }), matching the established git-username.ts#isExecTimeoutError predicate. Cancellation stays distinct: aborts are rethrown before classification.
  • Bucket sorting extracted and applied uniformlyUsageRosterPanel verbose rendering and the tooltip.tsx provider flyout now route Antigravity groups through sortAntigravityBuckets instead of ad-hoc .sort((a, b) => windowMinutes - …), so unknown windows (windowMinutes <= 0, e.g. a future daily window) render after known 5h/weekly windows, with duration-ascending then name tie-breaks. Non-Antigravity ordering is unchanged.
  • Coverage added — new tests assert the unknown-window-after-known ordering in UsageRosterPanel detailed mode, the Session < Weekly < daily ordering plus native labels in the provider flyout, and non-Antigravity ordering preservation.

Verified against runProcess / execFileCaptureToTermination that a deadline kill resolves timedOut: true with signal: 'SIGTERM' and code: null, so the new predicate is reachable. Focused tests pass (3 files, 71 tests).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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.

2 participants