Skip to content

fix(agents): add agy CLI quota fallback and widen panel - #16999

Closed
alihancaliskanx wants to merge 3 commits into
omacom:quattrofrom
alihancaliskanx:fix-antigravity-quota-fallback
Closed

alihancaliskanx wants to merge 3 commits into
omacom:quattrofrom
alihancaliskanx:fix-antigravity-quota-fallback

Conversation

@alihancaliskanx

Copy link
Copy Markdown

Summary

This PR resolves two usability issues with the agents dashboard and Antigravity quota tracking:

  1. Antigravity Quota Fallback for Consumer / Pro Accounts:
    omarchy-agent-usage-agy queries v1internal:retrieveUserQuotaSummary on daily-cloudcode-pa.googleapis.com. Standard consumer/Pro accounts that are not attached to a Google Cloud developer/enterprise project receive a 403 Forbidden response (cloudaicompanionProject is None), causing the collector to mark the sign-in as expired. When the Cloud Code endpoint refuses the request with 401/403, the collector now falls back to agy --print /usage, parsing live quota groups (Gemini, Claude/GPT, and Argon) with UTC timestamps.
  2. Quota Group Identification:
    Ensures Gemini 4 Argon groups are not misclassified under Gemini Models.
  3. Panel Width:
    Expands contentWidth from Style.space(380) to Style.space(400) so that multi-agent subscription switch buttons ("Claude Code", "Codex", "Antigravity") have sufficient horizontal room without label clipping.

Testing

  • Ran all existing test suites (agent-usage-agy-harness-test.sh, agent-usage-agy-limits-test.sh, agent-usage-agy-scanner-test.sh, agent-usage-agy-timestamps-test.sh) — all 4 pass.
  • Added a new unit test in agent-usage-agy-limits-test.sh asserting CLI fallback behaviour when the quota endpoint responds with 403.
  • Verified live execution of omarchy-agent-usage-agy on a machine with active Antigravity Pro credentials.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds an agy --print /usage fallback for refused quota requests, separates Argon allowances, and widens the agents panel.

  • Antigravity limits can come from the CLI when Google refuses its quota request.
  • Argon quota windows stay separate from Gemini limits.
  • The agents panel has more room for account controls.

Reviews (4) · Last reviewed commit: "Drop the test gate from the agy CLI fall..." · Reviewed by Greptile

Comment thread bin/omarchy-agent-usage-agy Resolved
Comment thread bin/omarchy-agent-usage-agy Resolved
Consumer and Pro Antigravity accounts without a Google Cloud project receive a 403 Forbidden response from retrieveUserQuotaSummary on the Cloud Code API endpoint. Fall back to `agy --print /usage` when the API refuses the request so quota windows and reset times are reliably reported.

Also correctly identify Gemini 4 Argon groups, and expand the agents panel width from 380px to 400px so multi-agent subscription switch buttons fit without title truncation.
Limit the agy CLI usage fallback to agy's own account so accounts from other harnesses cannot inherit its limits. Preserve the plan returned by loadCodeAssist or cached for that account instead of defaulting to Pro.
The fallback was skipped whenever SANDBOX was set, which the test harness uses but so do other tools (Gemini CLI's sandbox sets it), silently restoring "Sign-in expired". The limits test now plants a failing agy stub on PATH instead, as the harness test does for omp, and the fallback runs agy with stdin on /dev/null like omp_usage(), so the CLI can never wait on the collector's input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@pi.dev>
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this, @alihancaliskanx. I reviewed it on a worker built from the Omarchy ISO and pushed one small fix to your branch. The main question about the fallback is now for the maintainer.

What ran. The four agent-usage-agy-* tests and ./test/cli pass on a worker at both your head and the new one. Your fallback test fails against the base code ("Sign-in expired", no limits) and passes with the change. A probe calling extract_limits() with the groups in the order Gemini 4 Argon, Gemini Models, Claude and GPT models shows the base taking Argon's usage as the plan's Weekly meter, while this branch reads Session and Weekly from Gemini Models and lists Argon on its own. agents-panel-test.sh needs node, which the worker lacks, so it did not run.

Pushed (4b505ae). Whenever SANDBOX was set, the fallback was skipped (bin/omarchy-agent-usage-agy:512). The test harness sets that variable, but so do other tools: Gemini CLI's sandbox, for one. In those environments the fix switched itself off and the panel went back to "Sign-in expired". I removed that check. The limits test now puts a failing agy stub on PATH, the same way the harness test stubs omp, so a refused test sign-in can never reach a real CLI. agy now also runs with stdin on /dev/null, as omp_usage() does. The stub checks both the exact arguments and stdin, and the test fails if stdin=subprocess.DEVNULL is removed.

Not verified, and why. The worker has no Antigravity account and no agy, so all the fallback test shows is that the parser reads the lines the stub prints. Two things still need evidence from a real machine:

  • The 403. On omarchy-agent-usage-agy misidentifies Claude/GPT quota as Gemini Session/Weekly and omits Argon bucket #16906, three people with Google AI Pro consumer accounts report that retrieveUserQuotaSummary returns HTTP 200 with only the Claude and GPT models group, not a 401 or 403. This fallback only runs on a refusal, so it would not run for them. One of them traced the missing groups to the User-Agent this collector sends: with antigravity/cli/1.4.12, the same endpoint returns all three groups. I could not check that claim here.
  • The output format. The others on that issue read agy -p /quota --output-format json. The parser here splits text on tabs or runs of two or more spaces. It drops single-space columns and decimal percentages such as 80.5%. It passes the reset column through without reset_of(), and it titles every Argon row "Argon Weekly", five-hour rows included. A redacted real sample of the output, plus agy --version, would settle whether that matches what agy prints.

Other findings, left for you and the maintainer:

  • This is three changes in one: the CLI fallback, the Argon group selection, and the panel width. Omarchy's AGENTS.md asks for one change per pull request. The Argon fix is two lines and would be easy to land on its own, but it has no test in the PR.
  • The Argon selection still falls back to groups[0] when no non-Argon Gemini group exists. So [Claude and GPT models, Gemini 4 Argon] would now make Claude/GPT the plan's meters, where the base made it a scoped allowance. Label an Antigravity answer with no Gemini group as allowances only #16912 changes the same line (:306) to handle an answer with no Gemini group at all. The two need to agree on one rule, whichever lands first.
  • Panel width: on the worker the panel draws 20 units wider, as expected. The view I could reach has no signed-in accounts, though, and its labels don't clip at 380 either. So the clipping this change fixes was not reproduced.

Before: the agents panel at Style.space(380), blank-slate view, labels not clipped
After: the same view at Style.space(400), wider by 20 units

Review. Two second opinions, Codex Medium and muse-wonder (via pi, thinking high), read the branch. Between them they found the SANDBOX gate, the inherited stdin, the parser gaps and the groups[0] case above. Both re-read the pushed fix and found nothing further. Their independence from this review is not guaranteed.

Next. This waits on the maintainer to choose how to fix the missing Gemini meters on consumer accounts: this CLI fallback, the User-Agent change described on #16906, or #16912. Whichever it is, splitting the Argon and panel changes into their own pull requests would let them land separately.

@dhh

dhh commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Superseded by #20916, which delegates to agy -p /usage --output-format json instead of calling Google's private API directly or spoofing User-Agent headers. Thanks for the contribution!

@dhh dhh closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants