Skip to content

fix: read Antigravity CLI quota and clarify provider setup - #24159

Closed
elashera wants to merge 3 commits into
stablyai:mainfrom
elashera:fix/antigravity-cli-usage
Closed

elashera wants to merge 3 commits into
stablyai:mainfrom
elashera:fix/antigravity-cli-usage

Conversation

@elashera

@elashera elashera commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca can show an Antigravity quota that differs from the CLI, including missing its weekly limit. Read the CLI's own quota so users can see the Gemini 5-hour and weekly limits before starting work, with Claude/GPT limits available in the detail panel.

What Changed

  • Run agy --print /quota through the existing process runner, with cancellation, a 20-second timeout and bounded output. Parse model-family windows, remaining percentages and reset times.
  • Prefer the Antigravity result over the existing Gemini mirror. Preserve a successful Gemini read as a legacy fallback when the CLI read is unavailable or fails.
  • Use one Gemini (Antigravity) Providers section with agy sign-in instructions and refresh. Preserve the existing experimental Gemini CLI opt-in in an expandable, searchable control. Antigravity usage does not require that opt-in.
  • Share primary-family selection between parsing and both roster modes: show Gemini 5h/weekly in the detailed row and the tighter Gemini window in compact mode, falling back to available buckets on partial responses. Retain all families in the hover detail.
  • Publish the Antigravity result independently so its subprocess cannot delay other providers. Missing-CLI handling checks the structured ENOENT code. CLI detection alone no longer suppresses the setup CTA after an unavailable result.

Why

The old per-model Gemini read does not represent Antigravity's own quota windows. Calling its non-interactive quota command reuses the CLI's existing sign-in and avoids implementing OAuth/token extraction in Orca. The existing renderer bucket model can display these results without a new wire format.

Linked Issue

Partially addresses #22511: fixes the missing weekly/group-window display and uses the CLI as the quota source. The issue remains open for AI-credit balances; this PR does not claim to complete that requirement.

Related: #19587. This adds sign-in guidance and usage refresh, not an account identity/email inspector. AI-credit balances are outside this change.

Visual Proof

The original comparison uses the same four illustrative quota buckets to isolate the presentation change. These are actual Orca components rendered in a hidden Electron window over Playwright CDP; the before settings/roster components come from the base commit. The before sample is not a claim that the old Gemini fetch returned these four buckets.

Before After
Before After

Latest review revision (expanded compatibility control, detailed and compact summaries, with deliberately higher Claude/GPT usage to verify Gemini remains the summary):

Review revision

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS arm64 with Node 24:

  • Initial PR validation: 192 focused tests passed across 17 files: quota parsing/process failures, service integration, settings, search, visibility and roster/detail separation.
  • Review revision: 92 focused tests across 9 files and all 104 service tests across 8 files pass (the Antigravity service file overlaps). New regressions cover pending CLI publication, partial quotas, compact family selection, ENOENT versus permission failures, hidden-directory preparation failures, setup visibility, search and enabling/disabling the legacy opt-in.
  • pnpm typecheck, the changed-code quality gate, localization catalogs, extraction and coverage pass.
  • A real agy --print /quota returned Gemini and Claude/GPT 5-hour and weekly rows; the app owner checked the running dev UI.
  • Hidden Electron CDP captures verify the before/after UI using deterministic quota samples. The review revision also verifies enabling and disabling the Gemini opt-in without activating a desktop window.
  • The installed CLI JSON quota response was inspected: its command data contains group windows but no AI-credit balance. Credits remain outside this PR.
  • Full pnpm lint was attempted. After fixing this change's localization findings, it stops on existing import cycles in unchanged mobile transport/terminal files once mobile dependencies are installed. The focused quality gate passes.
  • Full pnpm build compiles desktop/web/mobile assets, then fails in the unchanged macOS native helper packaging: lipo: no eligible inputs found for the expected arm64/x86_64 helper paths.
  • Full pnpm test completed in 614s: 96,836 passed, 17 failed, 831 skipped, 1 expected failure, plus 1 unhandled error (10,095 files passed, 17 files failed, 103 skipped). Failures are in unchanged orchestration/mail, repo-icon, hook refresh, SSH Node-header and cross-version fixtures; the cross-version harness reports the missing local v1.4.190 tag. No affected Antigravity/settings/roster tests failed. These broad-suite failures have not been independently reproduced on the base commit.

To reproduce: sign in by running agy on the machine running Orca, open Providers → Gemini (Antigravity), refresh usage, and enable Antigravity Usage in Appearance → Status Bar. Check that the detailed roster has the two Gemini windows and its detail panel also shows the Claude/GPT windows.

AI Disclosure

Implemented and reviewed with OpenAI Codex (GPT-6). The contributor directed and manually checked the local UI.

Review

  • Cross-platform: process execution uses runProcess, command discovery and runtime-PATH helpers; no shell command interpolation. Windows and Linux runtime checks remain for CI/maintainer testing.
  • SSH/remote/local: the fetch remains in the existing host-side rate-limit service and uses that host's CLI. No renderer credential cache or new RPC fields. Instructions identify the machine running Orca. A real SSH run was not performed.
  • Agents/integrations: changes are guarded by the Antigravity provider. Other providers publish without waiting for the Antigravity subprocess; a deferred-process service regression verifies this. Folder workspaces need no Git metadata.
  • Performance: one bounded subprocess per full refresh. Other provider results publish independently; the overall refresh still waits up to the 20-second subprocess deadline. No extra polling loop.
  • UI: existing tokens/components, searchable setup, localized copy; the hover detail retains all buckets. Native Windows/Linux and mobile visual validation remain untested.
  • Security: Orca does not extract or store Antigravity tokens. The CLI owns authentication. Output and diagnostic length are capped; no prompts or credentials are included in the screenshots.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Author

GitHub: @elashera. X/Twitter handle: not provided.

Notes

Review triage: the hidden working-directory resolver was already inside the fetcher try/catch; a regression test now verifies that boundary. No blanket docstring expansion was added because the repository asks for concise, non-obvious comments only.

The legacy successful-Gemini fallback remains; if the Antigravity CLI fails while Gemini succeeds, the displayed fallback can still differ from Antigravity. Parsing currently targets the installed CLI's tab-separated /quota output. No version bump or release changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds Antigravity CLI quota reading to the rate-limit tracking system.

The PR appears safe to merge; no new actionable issue was identified in the latest revision.

Summary

The PR reads Antigravity CLI quota windows, prefers them over the legacy Gemini mirror, and adds provider setup and status-bar presentation. The latest revision preserves the legacy settings panel’s expansion state when a search temporarily opens it.

  • Antigravity results publish independently of other provider results.
  • Detailed usage retains both model families; summaries prioritize Gemini windows.

Reviews (3) · Last reviewed commit: "fix: preserve Gemini panel state across ..."

@greptile-apps

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 7c7c9bcc-e224-407c-9179-6b673abb88df

📥 Commits

Reviewing files that changed from the base of the PR and between e3e5a35 and 161570c.

📒 Files selected for processing (3)
  • src/renderer/src/components/settings/AntigravityAccountsSection.test.tsx
  • src/renderer/src/components/settings/AntigravityAccountsSection.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts

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


📝 Walkthrough

Walkthrough

The change adds Antigravity quota fetching through the agy CLI and parses its five-hour and weekly buckets. The rate-limit service prefers the CLI result and uses successful Gemini data as a fallback. The status bar displays Gemini model buckets and uses Antigravity’s checked status item for configuration. The account pane, translations, and usage-tracking documentation add Antigravity instructions.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 16157

Antigravity quota support has no established merge-blocking issue in the available evidence. The settings expansion tests cover the intended behavior; normal checks remain appropriate before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 16157

The new quota read uses a fixed command and keeps sign-in under the CLI’s control. Cancellation, bounded output, and fallback behavior limit failures. No security regression was established, but CLI compatibility and shutdown behavior are not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected execution scope is the Orca host user and the installed CLI’s session. The subprocess inherits host environment authority, so the resolved executable remains trusted local code; the absolute-path check is not executable-integrity verification.

Trust Boundaries and Controls

  • observed — The renderer requests refresh without command parameters. Host code owns executable resolution, fixed arguments, working directory, output limits, and cancellation. Failed exits may expose a capped diagnostic line, while successful output is passed to the quota parser rather than published wholesale.

Resilience and Maintainability Implications

  • observed — Timeouts and cancellation do not publish parsed partial quota output. Missing executables are classified using structured ENOENT codes, and cancellation is checked again before the independently settled result mutates shared state.

Hardening Proposals

  • proposed — Validate supported CLI versions’ non-interactive quota semantics and descendant-process termination behavior before relying on stronger isolation or cleanup guarantees.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 32 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 primary changes: reading Antigravity CLI quota and clarifying provider setup.
Description check ✅ Passed The description follows the repository template and provides complete context for the change, rationale, linked issues, visual proof, testing, AI disclosure, compatibility considerations, and known va…
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.
  • 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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9948c2a5-0bc8-442e-b0da-042ce61d3b65

📥 Commits

Reviewing files that changed from the base of the PR and between fa3710d and ac0a3dd.

📒 Files selected for processing (34)
  • docs/site/content/docs/agents/usage-tracking.mdx
  • src/main/rate-limits/antigravity-quota-fetcher.test.ts
  • src/main/rate-limits/antigravity-quota-fetcher.ts
  • src/main/rate-limits/antigravity-quota-parser.test.ts
  • src/main/rate-limits/antigravity-quota-parser.ts
  • src/main/rate-limits/antigravity-usage-mirror.test.ts
  • src/main/rate-limits/antigravity-usage-mirror.ts
  • src/main/rate-limits/rate-limit-service-test-harness.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-antigravity-usage.test.ts
  • src/main/rate-limits/service-cursor-usage.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/main/rate-limits/service-minimax-usage.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service-window-activation.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/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/AntigravityAccountsSection.tsx
  • src/renderer/src/components/settings/accounts-pane-provider-setting-sections.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/status-bar/UsageRosterPanel.test.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.tsx
  • 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/usage-provider-settings-target.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/shared/node-cli-command-resolution.ts
  • src/shared/rate-limit-types.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.

@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.

Important

Swapping the Gemini accounts section for the Antigravity one also removes the only control that writes geminiCliOAuthEnabled, which leaves the standalone Gemini usage provider unenablable for anyone who has not already opted in. See the inline note on AccountsPane.tsx; this needs a scope decision before merge.

Reviewed changes

  • Antigravity quota reader: fetchAntigravityRateLimits runs agy --print /quota through runProcess (20s timeout, bounded output, abort-aware), and parseAntigravityQuotaRows maps the tab-separated CLI rows into used-percent windows.
  • Provider precedence: resolveAntigravityRateLimits prefers the CLI read and keeps a successful Gemini snapshot as fallback; the full-cycle fetch adds Antigravity to the main Promise.allSettled tuple.
  • Settings: the experimental Gemini OAuth switch is replaced by a "Gemini (Antigravity)" section with agy sign-in copy and a refresh button; search keywords and the en/es catalogs are updated.
  • Status bar: a checked Antigravity item is now a durable visibility signal independent of Gemini OAuth, and the verbose roster narrows Antigravity to its Gemini family windows while the detail panel keeps every bucket.

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

Comment on lines +382 to +384
matchesSettingsSearch(searchQuery, getAccountsGeminiSearchEntries()) ? (
<AntigravityAccountsSection key="antigravity" />
) : null,

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.

This swap drops renderGeminiAccountsSection, which held the only Switch bound to settings.geminiCliOAuthEnabled — a repo-wide search finds no other writer of that setting. The standalone gemini provider, its status-bar item, and the usage-tracking docs all still exist, and fetchGeminiRateLimits returns unavailable while the flag is false, so new users have no way to turn Gemini usage on. If retiring the Gemini provider is intended, its fetch/status-bar/docs should go too; otherwise keep its toggle.

Technical details
# Removed the only `geminiCliOAuthEnabled` control

## Affected sites
- `src/renderer/src/components/settings/AccountsPane.tsx:382-384` — Gemini section replaced by `AntigravityAccountsSection`; the deleted `renderGeminiAccountsSection` carried the `settings.geminiCliOAuthEnabled` switch.
- `src/main/rate-limits/gemini-usage-fetcher.ts:206` — returns `unavailable`/`'Gemini CLI OAuth is disabled in settings'` whenever the flag is false.
- `src/renderer/src/components/status-bar/status-bar-provider-visibility.ts:105-106` — `hasUsageProviderSettingsForProvider('gemini')` still keys on the flag.

## Required outcome
- Either restore a user-reachable control for `geminiCliOAuthEnabled`, or fully retire the `gemini` provider (fetch, visibility, status-bar item, docs) so no feature depends on a setting nothing can set.

## Open questions for the human
- Is the standalone Gemini usage provider intentionally deprecated in favor of the Antigravity CLI read, or is the Gemini status-bar item meant to stay configurable?

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.

Addressed in e3e5a35: the Gemini CLI OAuth switch is restored inside the Antigravity section (expandable, searchable).

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

p.provider === 'antigravity'
? allSections.filter(
(section) =>
section.label === 'Gemini Models · 5h' || section.label === 'Gemini Models · Weekly'

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.

These two literal labels duplicate PRIMARY_FAMILY and shortWindowLabel from antigravity-quota-parser.ts across the main/renderer boundary. If the CLI's family text or the label formatting changes, this filter silently empties and the verbose roster falls back to showing the Claude/GPT rows it is meant to hide. Selecting by window.windowMinutes plus a shared family constant would keep the summary stable.

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.

Addressed in e3e5a35: the roster now derives labels from the shared getAntigravitySummaryBuckets helper instead of duplicating the family/label strings.

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

result = await runProcess({
program: command,
args: ANTIGRAVITY_QUOTA_ARGS,
cwd: resolveHiddenRateLimitPtyCwd(),

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.

resolveHiddenRateLimitPtyCwd() throws when the resolved directory is root-like, and it is called outside the try block, so the fetch can reject instead of returning a ProviderRateLimits. Promise.allSettled in the service absorbs that, but the function's direct-call contract (and its unit tests) assume it always resolves — moving this call inside the try keeps it total.

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.

Addressed in e3e5a35: resolveHiddenRateLimitPtyCwd() is now evaluated inside the try, with a regression test covering the throw.

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

@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 — the new commit cleanly addresses the prior review findings; one stale test comment inline.

Reviewed changes

This incremental re-review covered commit e3e5a35 ("fix: address Antigravity quota review findings"), the delta on top of the initial ac0a3dd. All three prior inline findings and CodeRabbit's ENOENT note are addressed.

  • Restored the Gemini CLI OAuth control: the switch that writes geminiCliOAuthEnabled is back, now a searchable, collapsible <details> inside the Antigravity section, covered by a new component test and an AccountsPane search test.
  • Shared the summary-bucket logic: extracted getAntigravitySummaryBuckets plus the family/window constants into src/shared/antigravity-usage-windows.ts, consumed by both the parser and UsageRosterPanel, removing the duplicated literal labels.
  • Made the Antigravity CLI read total: resolveHiddenRateLimitPtyCwd() now runs inside the try, and a structured error.code === 'ENOENT' replaces the message.includes('ENOENT') check — both backed by new fetcher tests.
  • Published Antigravity independently: its fetch is lifted out of the main Promise.allSettled tuple into antigravityResultPromise and applied in a deferred updateState, with a regression test asserting other providers publish while the CLI read is pending.
  • Reworked Antigravity visibility: antigravityUsageConfigured no longer counts toward the global hasUsageProviderSettings, and getVisibleUsageProvider hides an unavailable Antigravity so the setup CTA returns after a not-installed result.
  • Session fallback: session now falls back to the tightest available bucket when the Gemini family is absent.

Local focused runs: main-side fetcher/parser/mirror/service tests (31) and renderer roster/section/visibility/AccountsPane tests (57) all pass.

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

Comment on lines +128 to +129
// Why: a checked Antigravity item plus a detected CLI is a configured
// provider; its `/quota` read does not need the Gemini OAuth opt-in.

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.

This rationale describes hasUsageProviderSettingsForProvider, but it now sits above hasUsageProviderSettings, which intentionally returns false for an Antigravity-only configuration. Reword it to match the assertion so a future maintainer doesn't "fix" it to true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 161570c. The comment now explains that CLI detection does not prove a signed-in account and configuration depends on the quota snapshot, matching the false assertion.

@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

This incremental re-review covered commit 161570c ("fix: preserve Gemini panel state across settings search"), the delta on top of the prior pullfrog review at e3e5a35.

  • Fixed the legacy Gemini credential panel's expansion state: the <details> no longer uses onToggle; it is fully controlled by open={legacySettingsExpanded || Boolean(model.searchQuery)} with a <summary> onClick that calls event.preventDefault() and toggles local state only when not searching, so a search-forced open no longer overwrites what the user chose.
  • Added regression coverage: a new test round-trips the panel through a search query (with and without a prior manual expand) and asserts the pre-search state is restored after the query clears.
  • Corrected a stale test comment: the rationale above hasUsageProviderSettings({ antigravityUsageConfigured: true }) === false in status-bar-provider-visibility.test.ts now describes the correct function.

The new behavior is covered by passing focused tests (pnpm test src/renderer/src/components/settings/AntigravityAccountsSection.test.tsx, 4/4).

Pullfrog  | Fix it ➔ | 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.

1 participant