Skip to content

fix(rate-limits): read native Antigravity usage, gated on agy 1.1.11 - #22055

Closed
werlang wants to merge 12 commits into
stablyai:mainfrom
werlang:fix/antigravity-agy-version-gate
Closed

werlang wants to merge 12 commits into
stablyai:mainfrom
werlang:fix/antigravity-agy-version-gate

Conversation

@werlang

@werlang werlang commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The Antigravity row in the status bar shows your real agy quota instead of copying Gemini's numbers. Old or broken agy installs get a plain message telling you to update, instead of a blank row or someone else's numbers.

What Changed

Before: the Antigravity status-bar row mirrored Gemini quota, or (with #20797 alone) spawned agy -p /usage on every refresh with no version check.

After: the row shows native Antigravity quota (Gemini Models + Claude/GPT pools, 5h/weekly windows with reset countdowns) once agy 1.1.11+ is detected.

Mechanism:

  • New antigravity-usage-fetcher.ts runs agy --print /usage --output-format json through the shared execFileCaptureToTermination path (no shell, fixed argv, 10s timeout, abort-aware) and maps the four quota buckets onto the existing provider model. The Gemini mirror is deleted; the fetch cycle reads Antigravity independently.
  • Pre-check: agy --version must parse to >= 1.1.11 before /usage is ever spawned (prerelease/build metadata preserved, so 1.1.11-rc.1 stays gated; unreadable versions fail closed). Pre-1.1.11 answers print-mode /usage with a billable agent turn, so this prevents quota spend on every refresh.
  • Strict quota parsing: any malformed group/bucket rejects the whole response as a parse error instead of presenting a partial pool set as ok.

Why

agy -p /usage needs no tokens, keychain access, or Gemini CLI install (agy handles sign-in), per the 1.1.11 release notes and https://antigravity.google/docs/cli/headless/. Keychain/OAuth and language-server alternatives (#21999, #20933) add credential handling this path avoids.

Linked Issue

Fixes #9122

Closes #20797 as superseded (this rebases #20797 by @abti-ai onto current main with authorship preserved, plus the version gate and strict parsing; happy to close in favor of #20797 if @abti-ai picks those up there instead).

Visual Proof

N/A — no signed-in agy host on this machine to capture live quota; the renderer paths are covered by renderToStaticMarkup tests (StatusBarProviderSegment, UsageRosterPanel, tooltip).

Testing

  • Automated tests added/updated: antigravity-usage-fetcher.test.ts (33 tests incl. 1.1.10/1.1.11-rc.1 never receiving the usage argv, unreadable-version and probe-failure fail-closed cases, malformed-entry parse errors); neighbor suites (service, status-bar segments, roster, visibility, tooltip) pass.
  • I manually tested these changes locally (no signed-in Antigravity host available; needs a live check on a signed-in host after install)
  • Platforms: logic is platform-independent (resolved binary + fixed argv, no shell); Windows package/static analysis covered by CI.

AI Disclosure

Implemented with OpenCode (Muse Spark).

Review

Addresses @abruption's version-compatibility finding on #20797, Copilot's prerelease-gate finding, and CodeRabbit's strict-parsing finding on this PR.

Agent skill upstream boundary

  • Not applicable, no skill-installer source copied or translated.

Notes

Security: fixed argv, no shell interpolation, bounded output/deadline, process-tree termination. Cross-platform: no node:child_process imports (shared runner only). SSH/remote and Mobile: untouched paths.

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)

abti and others added 2 commits September 21, 2026 15:12
agy older than 1.1.11 answers print-mode /usage with a billable agent
turn instead of a quota report. Probe --version first and return an
actionable unavailable result without ever spawning the usage argv.
Copilot AI lite review requested due to automatic review settings September 21, 2026 18:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The version parser admits prerelease builds such as 1.1.11-rc.1, allowing the billable /usage command before the stable safety fix.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Replaces Gemini-mirrored Antigravity quotas with native agy CLI usage, gated by a minimum version and rendered with grouped quota windows.

Changes:

  • Adds CLI probing, version gating, parsing, timeout, and abort handling.
  • Integrates independent Antigravity results into the rate-limit service.
  • Updates status-bar grouping, compact metrics, labels, visibility, and tests; removes the old mirror.
File Description
src/​shared/​rate-limit-types.ts Adds provider-specific bucket metadata.
src/​renderer/​src/​components/​status-bar/​use-status-bar-controller.ts Updates Antigravity visibility rationale.
src/​renderer/​src/​components/​status-bar/​UsageRosterPanel.tsx Renders grouped native usage windows.
src/​renderer/​src/​components/​status-bar/​UsageRosterPanel.test.tsx Tests grouped and compact rendering.
src/​renderer/​src/​components/​status-bar/​usage-section-selection.ts Adds shared tightest-window selection.
src/​renderer/​src/​components/​status-bar/​tooltip.tsx Adds native labels and grouped panels.
src/​renderer/​src/​components/​status-bar/​tooltip.test.ts Tests grouped tooltip output.
src/​renderer/​src/​components/​status-bar/​StatusBarProviderSegment.tsx Adds Antigravity status summaries.
src/​renderer/​src/​components/​status-bar/​StatusBarProviderSegment.test.tsx Tests status-bar summaries.
src/​renderer/​src/​components/​status-bar/​status-bar-provider-visibility.ts Removes the Gemini OAuth visibility gate.
src/​renderer/​src/​components/​status-bar/​status-bar-provider-visibility.test.ts Updates visibility expectations.
src/​renderer/​src/​components/​status-bar/​antigravity-usage-format.ts Adds group labels and bucket sorting.
src/​renderer/​src/​components/​status-bar/​antigravity-compact-metrics.tsx Implements compact grouped metrics.
src/​main/​rate-limits/​service/​service-full-cycle-preparation.ts Fetches Antigravity independently.
src/​main/​rate-limits/​service/​service-full-cycle-application.ts Applies independent Antigravity results.
src/​main/​rate-limits/​service-antigravity-usage.test.ts Tests service independence and stale handling.
src/​main/​rate-limits/​antigravity-usage-mirror.ts Removes the Gemini mirror.
src/​main/​rate-limits/​antigravity-usage-mirror.test.ts Removes obsolete mirror tests.
src/​main/​rate-limits/​antigravity-usage-fetcher.ts Adds gated native CLI fetching and parsing.
src/​main/​rate-limits/​antigravity-usage-fetcher.test.ts Tests version gating and fetch behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/rate-limits/antigravity-usage-fetcher.ts Outdated
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Antigravity usage is fetched from its own CLI and processed through an independent refresh path. Shared version parsing is used by the Antigravity fetcher and Claude-related version checks. Rate-limit data carries provider window labels and group names into compact, verbose, and tooltip rendering. Antigravity visibility no longer requires Gemini CLI OAuth. Tests cover fetch parsing and failures, refresh behavior, grouped rendering, and visibility.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to 354f5

Users whose agy login has expired no longer see why usage is unavailable. Restore the actionable authentication message before merging, or accept this bounded UI regression.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 41 functions across 33 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 summarizes the main change: native Antigravity usage with a minimum agy version gate.
Description check ✅ Passed The description includes all required sections, explains the user-visible and implementation changes, links issue #9122, documents visual proof as not applicable, and lists testing and checklist statu…
Linked Issues check ✅ Passed The PR satisfies the coding requirements in [#9122] and [#20797]. fetchAntigravityRateLimits reads native agy --print /usage --output-format json data and does not mirror Gemini state. It checks `…
Out of Scope Changes check ✅ Passed The changes remain within [#9122] and [#20797]. The shared parseCliVersion addition and the Claude version-parser call-site updates support the required version-gate implementation and remove duplic…

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: fb8cb1e7-d925-4a97-9e9e-f252dece08b4

📥 Commits

Reviewing files that changed from the base of the PR and between f07bf85 and ea59a23.

📒 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/main/rate-limits/antigravity-usage-fetcher.ts Outdated
- Preserve prerelease/build metadata in extractAgyVersion so
  1.1.11-rc.1 stays below the stable floor and never spawns /usage.
- Reject the whole quota response on any malformed group/bucket
  instead of returning ok with a partial pool set.
- JSDoc the new fetcher surface.

@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 — two external wire-shape assumptions worth confirming with a real capture, plus stale comments and a scope question.

Reviewed changes

  • Native Antigravity fetcher — new fetchAntigravityRateLimits runs agy --version (semver >= 1.1.11 via hasReachedAppVersion, fails closed on unreadable output) before spawning agy --print /usage --output-format json through execFileCaptureToTermination (fixed argv, no shell, abort-aware). The Gemini mirror (antigravity-usage-mirror.ts) and its tests are deleted. This addresses the 1.1.10 billable-turn finding.
  • Service wiring — Antigravity becomes its own Promise.allSettled slot in service-full-cycle-preparation.ts and participates in applyStalePolicy stale retention, independent of Gemini.
  • Renderer — grouped verbose/compact rendering, per-group tightest-window selection (usage-section-selection.ts), native 5h/wk labels, reset countdowns, and a grouped provider flyout (tooltip.tsx).
  • Visibility — antigravityUsageConfigured (checked status item + detected agy) replaces the Gemini OAuth requirement as the durable signal.
  • Shared types — additive optional RateLimitWindow.windowLabel and RateLimitBucket.id/groupName/groupDescription.

ℹ️ Stale comments still describe the removed Gemini mirror

status-bar-provider-visibility.ts:11-15 still says durability "requires geminiCliOAuthEnabled — the snapshot mirrors the Gemini fetch", which this PR makes false by removing both the requirement and the mirror. Likewise rate-limit-types.ts:73 still narrows buckets to "(Gemini only)", but it now carries Antigravity data too. Both lines sit outside the diff hunks, so flagging them here rather than inline.

ℹ️ Scope: is this the vehicle, or is it superseded?

A maintainer noted on #20797 that this work is superseded by the maintained quota migration (#21654 → #21678), and the PR body itself offers to close in favor of #20797. Nothing in the code blocks merge, but it is worth settling which branch carries the change so two competing implementations do not both land.

ℹ️ Nitpicks

  • use-status-bar-controller.ts:106 adds a third stacked // Why: line ("Antigravity visibility is based on its own detected CLI and snapshot") that restates the :105 line above it; the block only needs one.
Technical details
# Rating scale and evidence sources

## External contract (verified, no action needed)
- A real agy 1.2.6 capture (HarnessDesk PR #769 fixture) matches the parser:
  `command.data.groups[].buckets[]` with `id`/`name`/`window`/`remaining_fraction`/`reset_time`.
- Official status-line docs name `remaining_fraction`/`reset_time`.
- 1.1.11 release notes confirm print-mode `/usage` no longer starts a billable turn.

## Remaining open questions
- `window: '5h'` literal — only `'weekly'` observed in captures.
- `agy --version` flag existence/output — absent from the headless flag reference; no capture found.

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
Comment thread src/main/rate-limits/antigravity-usage-fetcher.ts Outdated
Comment thread src/main/rate-limits/antigravity-usage-fetcher.ts 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.

ℹ️ Both findings from the prior review are addressed; one small cleanup remains.

Reviewed changes (delta since ea59a23)

  • Strict quota parsing — parseAgyUsageResponse now rejects any malformed group/bucket as a parse error instead of skipping it and returning ok, via a shared agyQuotaFormatError; the malformed-JSON catch reuses it too. New tests cover a missing group name, a bucket without a window, a negative/over-one fraction, and one malformed bucket beside a valid one. This resolves the partial-pool finding.
  • Prerelease-safe version gate — extractAgyVersion now preserves prerelease/build metadata, so 1.1.11-rc.1 ranks below the stable 1.1.11 floor through hasReachedAppVersion; a new test proves a prerelease never receives the /usage argv. extractAgyVersion tests now assert the full version string.
  • Docs — JSDoc added to the exported and helper functions.

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

@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 (delta since fb950cf)

  • Removed the unreachable empty-buckets branch — parseAgyUsageResponse no longer falls back to unavailable when buckets.length === 0. Every group is required to be non-empty above, and each bucket entry either pushes or returns a format error, so buckets is always populated at the return site. The deletion is behavior-preserving and resolves the sole cleanup from the prior review.

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

@werlang

werlang commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review — the open prerelease finding (18:20) was addressed in fb950cf: the extractor now preserves prerelease/build metadata, so 1.1.11-rc.1 stays below the stable 1.1.11 floor and never spawns the billable /usage command; a regression test pins it. CodeRabbit and pullfrog both confirmed on the current head (e502328). Please re-assess.

For maintainers: PR Checks and PR test LoC are sitting at action_required on this PR (https://github.com/stablyai/orca/actions/runs/35640662382) — a fork account can't approve its own workflow run, so someone with admin on stablyai/orca needs to approve it so CI can run, then approve + merge. pullfrog is ✅ and every review finding is closed.

@werlang

werlang commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review — everything actionable on my side is done.

Review findings: all addressed.

  • Copilot (prerelease build passing the agy version gate) — fixed in fb950cf: extractAgyVersion keeps the prerelease/build suffix, so 1.1.11-rc.1 stays below the stable 1.1.11 floor and never spawns the billable /usage argv. Regression test added. Thread resolved.
  • CodeRabbit (partial quota parse returning ok) — fixed in fb950cf: any malformed group/bucket now rejects the whole response as a parse error. CodeRabbit confirmed on the thread.
  • pullfrog (agy --version flag, window: "5h" spelling, unreachable buckets.length === 0 branch) — all confirmed or fixed through e502328; every thread is resolved.

Local gates on this branch are green: pnpm test for src/main/rate-limits + src/shared/app-version (32/32), pnpm run check:code-quality:changed (0 findings across 18 changed files, including the design-system and casting gates), and pnpm tc.

CodeRabbit's "Docstring Coverage 24%" line is advisory only — no such check run exists on this PR or on merged PRs such as #21418, and this repo's comment policy is non-obvious-only, so I did not pad the diff with generated docstrings.

What I need from a maintainer (I have read-only access on stablyai/orca, so I cannot do either):

  1. Approve the held workflow runs — PR Checks and PR test LoC are parked at action_required for this fork PR, which is why the merge state reads UNSTABLE despite nothing failing. fix(opencode): attribute shared-server sessions to their panes #21577 merged through the same step.
  2. Give the approving review.

@werlang

werlang commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@oliver-mee — this is ready to land, but it's blocked on maintainer-only actions (my account is read-only on the repo). Three things:

  1. Approve the workflow run — PR Checks + PR test LoC are action_required on head e502328, so CI has never actually run: https://github.com/stablyai/orca/actions/runs/35640662382
  2. Approve the PR — 16 reviews so far are all COMMENTED, zero approvals.
  3. Merge (after checks are green).

Review state is clean: pullfrog's final delta review on e502328 is ✅ "No new issues found"; CodeRabbit confirmed its one actionable finding addressed; all four pullfrog findings (prerelease gate, agy --version probe, window: "5h" spelling, dead branch) are fixed and confirmed in-thread. You validated the branch independently — 142/142 unit tests across src/main/opencode. The two nits you left were on #21322, not this one. Copilot's 🟡 predates the fix in fb950cf; a fresh review is already requested.

Jinwoo-H and others added 4 commits September 23, 2026 17:15
Service suites spawned the real agy CLI on machines that have it installed,
failing nine activation and orchestration tests.

Co-Authored-By: Claude <noreply@anthropic.com>
… version parser

- Spawn agy with runProcess and branch on its exit code and timedOut flag,
  dropping the git runner and the error-field guessing it required.
- Move the semver extraction shared by the Claude and agy probes to
  parseCliVersion in shared/app-version.
- A response missing command.data.groups is now a parse error; only an
  empty group list means no quota.
- Sort buckets within each group at parse time and set windowLabel only for
  windows without a known duration.
- Drop the never-rendered groupDescription field and the test-only exports;
  tests exercise fetchAntigravityRateLimits end to end.

Co-Authored-By: Claude <noreply@anthropic.com>
… batch

A slow agy CLI (up to 15s across the version probe and the usage read) held
every other provider's result back inside Promise.allSettled. It now runs as
its own promise and applies after the batch, the same way Grok does.

Antigravity has no dedicated fetch cycle, so a persistent agy error keeps the
5-minute full-fetch retry cadence Kimi already uses; the activation test now
covers both providers.

Co-Authored-By: Claude <noreply@anthropic.com>
…vider checks

Buckets that carry a groupName now render the same way for any provider:
- one groupUsageSections helper replaces five ad hoc group-by loops;
- tooltips head each pool with its name and label buckets by window;
- the roster and status bar compact modes show the tightest window per pool
  via getCompactUsageSections, which collapses to today's single figure for
  ungrouped providers;
- the verbose status bar shows each pool's windows with their reset chips.

Main now orders buckets, so the renderer's Antigravity sorter goes, along
with antigravity-compact-metrics.tsx, antigravity-usage-format.ts, the
non-null assertions they needed, and the unreachable bucket branch. Pool
short labels come from word initials ("Claude and GPT models" -> "C/G")
instead of hardcoded model names, and chips fall back to a window's source
name when its duration is unknown. The roster's compact chip now uses the
row's shared countdown clock.

Co-Authored-By: Claude <noreply@anthropic.com>

@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: a229a645-76df-402e-8934-cea17fe237ad

📥 Commits

Reviewing files that changed from the base of the PR and between e502328 and ce258be.

📒 Files selected for processing (27)
  • src/main/agent-hooks/managed-hook-detection-commands.ts
  • src/main/claude/claude-session-end-hook-capability.test.ts
  • src/main/claude/claude-session-end-hook-capability.ts
  • src/main/rate-limits/antigravity-usage-fetcher.test.ts
  • src/main/rate-limits/antigravity-usage-fetcher.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-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/relay/managed-hook-installer.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/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-section-selection.ts
  • src/renderer/src/lib/window-label-formatter.test.ts
  • src/renderer/src/lib/window-label-formatter.ts
  • src/shared/app-version.test.ts
  • src/shared/app-version.ts
  • src/shared/rate-limit-types.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/status-bar/tooltip.test.ts

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

Comment thread src/renderer/src/components/status-bar/StatusBarProviderSegment.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.

Important

Antigravity's CLI spawn no longer terminates the process tree on timeout or abort. execFileCaptureToTermination always enabled the termination barrier (terminationBarrier: termination ?? true); the migrated runProcess call does not, so a hung or aborted agy can leave descendants behind — sharper on Windows, where a .cmd shim makes cmd.exe the root. One-line fix inline.

Reviewed changes (delta since e502328)

  • Shared CLI version parser — parseCliVersion moved to shared/app-version.ts; parseClaudeCliVersion and extractAgyVersion are deleted, and the Claude capability, managed-hook detection, and relay installer now import the shared parser.
  • agy fetch through runProcess — the --version probe and /usage read now go through the shared runProcess runner (bounded output, timeout, abort) instead of execFileCaptureToTermination, with failures swallowed to a fail-closed version result.
  • Antigravity applied outside the shared provider batch — its fetch starts alongside Grok in preparation and applies in its own updateState after the batch, re-checking the abort signal before applying.
  • Renderer grouping made generic — usage-section-selection.ts gains groupUsageSections / getUsageGroupShortLabel; UsageRosterPanel, StatusBarProviderSegment, and tooltip group by bucket.groupName rather than Antigravity-specific branches; antigravity-usage-format.ts and antigravity-compact-metrics.tsx are deleted.
  • Test-harness coverage — the shared service harness stubs fetchAntigravityRateLimits, and all seven service suites mock the fetcher so the real spawn no longer runs in unit tests.

ℹ️ Nitpicks

  • The deleted fetcher-level abort test (propagates refresh cancellation instead of converting it to a provider error) has no replacement: the new post-await if (signal.aborted) return in service-full-cycle-application.ts:211 is now the only guard and is untested for Antigravity.

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
execFileCaptureToTermination defaulted terminationBarrier to true; the
runProcess migration dropped it, so a timed-out or aborted agy killed only
the root and left descendants behind (cmd.exe behind a .cmd shim on
Windows). Pin it with a regression assertion.
formatRateLimitWindowChipLabel defaulted to render-time Date.now() and
ProviderSegment scheduled no boundary render, so remaining-time chips went
stale until an unrelated state update. Feed useResetCountdownClock through
the verbose and compact label paths.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Preserve the authentication-specific /usage failure. · antigravity-usage-fetcher.ts:137-184

src/main/rate-limits/antigravity-usage-fetcher.ts:137-184
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve the authentication-specific /usage failure.

When agy --version meets the minimum, an authentication failure reaches the /usage branch. The refactor ignores usageRun.stderr and changes the previous authentication-specific unavailable result into generic error / unknown output. The status bar then loses the actionable authentication detail. Restore the previous classification only for authentication-related stderr. Keep other failures generic.

Suggested fix
   if (usageRun?.code !== 0) {
+    const timedOut = usageRun?.timedOut === true
+    const authFailure =
+      !timedOut && /auth|login|sign.?in|credential/i.test(usageRun?.stderr.trim() ?? '')
     return antigravityFailure(
-      'error',
-      usageRun?.timedOut
+      authFailure ? 'unavailable' : 'error',
+      timedOut
         ? 'Antigravity usage could not be refreshed before the agy CLI timed out.'
+        : authFailure
+          ? 'Antigravity usage is unavailable because the agy CLI is not authenticated.'
         : 'Antigravity usage could not be read from the agy CLI.',
-      'unknown',
+      authFailure ? 'usage-unavailable' : 'unknown',
       now
     )
   }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 16792419-9eb4-40db-960b-ff1fb3f31a1c

📥 Commits

Reviewing files that changed from the base of the PR and between ce258be and 354f593.

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

Included review availability: 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.

✅ No new issues found.

Reviewed changes (delta since ce258be)

  • Restored process-tree termination for the agy spawn — runAgy now passes terminationBarrier: true, matching the barrier the old execFileCaptureToTermination path enabled by default, so a timed-out or aborted agy takes its descendants with it. A regression assertion on both the --version and /usage specs keeps it from being dropped again.
  • Drove reset-countdown chips from the countdown clock — ProviderSegment re-introduces useResetCountdownClock, now seeded with every window reset (session/weekly/fableWeekly/monthly plus buckets), and threads the returned now through the verbose chip labels and getCompactUsageSections, so remaining-time text re-renders on the label boundary instead of waiting for an unrelated state update. A hoisted hook mock pins the wiring in the new test.

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

…-version-gate

# Conflicts:
#	src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
#	src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
@werlang

werlang commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Status: all findings addressed, branch back to MERGEABLE (head 34694c45).

  • pullfrog's terminationBarrier finding — fixed in 14728d89 (tree kill restored on timeout/abort + regression assertion); pullfrog confirmed.
  • CodeRabbit's stale-countdown finding — fixed in 354f5938 (ProviderSegment now owns useResetCountdownClock and threads now through both label paths); CodeRabbit confirmed.
  • Conflicts with main resolved in 34694c45. Two files conflicted: status-bar-provider-visibility.{ts,test.ts}. Resolution keeps both signals — main's new opencodeGoApiKeyConfigured term, and this PR's antigravityUsageConfigured term, which is now independent of geminiCliOAuthEnabled because Antigravity usage comes from the agy CLI probe. Tests updated accordingly.

Verification: status-bar + rate-limits suites 940/940, pnpm tc clean, changed-code quality gate 0 findings.

⚠️ Heads-up for whoever approves CI: src/main/rate-limits/codex-fetcher-pty-settle.test.ts fails 4 tests on main itself (verified by checking out main) — unrelated to this PR, but it may light up the test job.

@werlang

werlang commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@oliver-mee @nwparker — gentle nudge: this one is ready and only waiting on maintainer-only actions (author account is read-only).

Head 34694c45 · MERGEABLE · all review findings closed

  1. Approve the workflow run — PR Checks / PR test LoC sit at action_required on every commit, so CI has never actually run: https://github.com/stablyai/orca/actions/runs/35640662382
  2. Approve the PR — 16 reviews, all COMMENTED, zero approvals.
  3. Merge once green.

Where things stand: pullfrog ✅ and CodeRabbit ✅ both confirmed the last two findings (terminationBarrier on the agy spawn, countdown-clock labels). Conflicts with main are resolved in 34694c45 — @nwparker that includes your #22551 OpenCode Go change: hasUsageProviderSettings now keeps both opencodeGoApiKeyConfigured and antigravityUsageConfigured, the latter standalone because this PR makes Antigravity usage come from the agy CLI probe instead of mirroring the Gemini fetch. Shout if you'd rather Antigravity fold back under the Gemini term.

Heads-up for whoever approves CI: codex-fetcher-pty-settle.test.ts fails 4 tests on main itself (verified on main) — unrelated to this PR.

@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 (delta since 354f593)

  • Merged upstream main (7a4f080) into the branch. The only conflicts were status-bar-provider-visibility.ts and its test; the resolution keeps the PR's standalone antigravityUsageConfigured signal and layers upstream's new opencodeGoApiKeyConfigured term on top, in both hasUsageProviderSettings and the per-provider opencode-go branch, with the test expectations updated to match. Both sides are preserved correctly.
  • Adopted the upstream rate-limit/status-bar changes that auto-merged alongside the PR — fetchOpenCodeGoUsage with onApiKeyResolved in service-full-cycle-preparation.ts, plus the grouped-usage renderer, window-label-formatter, and service-suite test updates. Antigravity's separate fetch/apply path and applyStalePolicy wiring survived the merge intact, and the PR's files now diff cleanly against main (34 files, all PR-owned).
  • Unrelated formatting collapse in agent-status-main-agent-fact.test.ts (an upstream-only file) rode in with the merge; cosmetic, no assertions changed.

All prior inline threads are resolved.

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

The merge commit's lint-staged oxfmt pass rewrote line wrapping in a file
this PR does not otherwise touch, adding unrelated diff noise against main.
Restored to main's exact content (hook skipped — oxfmt would reapply it).
@werlang

werlang commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded — not abandoned.

While this PR was waiting for review, #24073 landed the agy-CLI quota core on main (same direction, different implementation: response parsing restructured, the model-turn latch replacing a version gate). Rebasing this branch on top of that restructure would mean resolving conflicts across a half-redundant diff.

What survives from this PR is now #24283 (branch fix/antigravity-agy-version-gate-followup, on current main, 2 focused commits):

Tracked by #24282. The renderer bucket-group work from this PR's later commits is already covered by #24073's own rendering.

Thanks for the reviews here — the prerelease finding in particular carried over verbatim into #24283 as a pinned regression test.

@werlang werlang closed this Oct 1, 2026
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.

[Bug]: Antigravity usage is a copy of the Gemini quota — wrong pools, and refresh breaks entirely without a local Gemini CLI install

4 participants