Skip to content

Use agy CLI for Antigravity usage limits to include weekly quotas - #20916

Merged
dhh merged 2 commits into
quattrofrom
agy-cli-usage
Nov 30, 2026
Merged

dhh merged 2 commits into
quattrofrom
agy-cli-usage

Conversation

@dhh

@dhh dhh commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Google's v1internal:retrieveUserQuotaSummary omits the Gemini group (including its 7-day weekly bucket) for direct HTTP calls with a bare antigravity User-Agent, leaving Ultra accounts on the retrieveUserQuota 5-hour-only fallback.

Instead of spoofing internal User-Agent / changelist headers against Google's private API, delegate to agy's own headless command when the agy CLI is installed and signed in:

agy -p /usage --output-format json --log-file /dev/null

This lets the official agy binary handle auth, token refresh, and Google's API directly while surfacing Gemini's 5-hour session, 7-day weekly, and touched Claude/GPT weekly windows in the agents panel — with zero direct private-API calls using agy's OAuth token.

Also drops epoch-0 (1970-01-01T00:00:00Z) reset timestamps emitted for untouched buckets and keeps the existing Cloud Code HTTP path for omp/pi/opencode sign-ins or machines without agy.

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; the previous fallback issue is fixed.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous fallback issue is fixed.

Summary

The PR reads Antigravity quotas through agy when available, including weekly limits, while keeping the HTTP fallback for other sign-ins.

  • Gemini usage now reads weekly limits through the agy CLI when available.
  • Quota windows no longer show epoch-zero reset times as real dates.

Reviews (2) · Last reviewed commit: "Let omp usage run before reporting an ag..." · Reviewed by Greptile

Comment thread bin/omarchy-agent-usage-agy Resolved
@dhh
dhh merged commit 9525d81 into quattro Nov 30, 2026
6 checks passed
@dhh
dhh deleted the agy-cli-usage branch November 30, 2026 13:51
lukehsiao added a commit to lukehsiao/dotfiles that referenced this pull request Nov 30, 2026
Antigravity was disabled in the agents panel because Omarchy 4.5.0-3
extracts OAuth tokens and polls Google's private Cloud Code API
directly. Upstream Omarchy fixed this in PR #20916 (commit 9525d8199f)
by delegating to `agy -p /usage --output-format json --log-file /dev/null`,
letting the official CLI handle auth, refresh, and Google's API itself.

This change re-adds the cloned `lukehsiao.agents` plugin with upstream's
`omarchy-agent-usage-agy` verbatim and a `usage-update` wrapper that
keeps all other agents on the packaged updater. To make switching back
automatic once upstream releases the fix, a `post-update.d` hook probes
`/usr/bin/omarchy-agent-usage-agy` for `def agy_usage` and `"/usage"`,
flips back to stock `omarchy.agents` via `restoreCloneSource`, and
prints a cleanup reminder while leaving files intact for chezmoi.
`run_onchange_after_configure-agents-plugin.sh.tmpl` shares that probe,
switches to the clone before enabling `providers.agy`, and triggers an
immediate IPC refresh. This snapshots the 4.5.0-3 QML files until the
next Omarchy release ships PR #20916.

Tested:
  Rendered `run_onchange_after_configure-agents-plugin.sh.tmpl` across
  `omarchy`, `macos`, and `ubuntu`, checked all scripts with
  `shellcheck -s bash` and `bash -n`, ran isolated unit tests for the
  collector, `usage-update` wrapper, `reconcile-agents-plugin` hook, and
  activation script, and applied live with `chezmoi apply`:

    MACOS_BYTES=0 UBUNTU_BYTES=0
    TEST_COLLECTOR_PR20916=PASS
    TEST_USAGE_UPDATE_WRAPPER=PASS
    TEST_RECONCILE_AND_CONFIGURE=PASS
    omarchy-plugin-list -> lukehsiao.agents (enabled: true)
    usage-update --force agy -> Session 16.0%, Weekly 88.6%
    omarchy-shell omarchy.agents refresh -> ok

Ref: omacom/omarchy#20916
Assisted-by: LLM shellcheck
cursor Bot pushed a commit to mark-groves/omarchy that referenced this pull request Nov 30, 2026
…acom#20916)

* Use agy CLI for Antigravity usage limits to include weekly quotas

* Let omp usage run before reporting an agy CLI failure
meeksoft added a commit to meeksoft/omarchy-agent-usage-extensions that referenced this pull request Dec 1, 2026
Omarchy fixed the collector upstream (omacom/omarchy#20916, reading agy's own
/usage), after 4.5.0-3. Passing --except agy unconditionally would hide that
fix after an update, so the updater now overrides agy only while the
installed stock collector still sends the bare "antigravity" User-Agent.

Also prefer the Gemini Models group over another Gemini-named one, such as a
Gemini 4 Argon allowance Google may list first, which would otherwise take
over the Session and Weekly meters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lbssousa added a commit to lbssousa/agents-omarchy that referenced this pull request Dec 1, 2026
Agent.qml, Main.qml and collectors.py are omarchy 4.6.0-rc2's
(shell/plugins/agents) verbatim. Panel.qml and README.md take the
rc1..rc2 changes with this clone's pace marker kept as it was: the
deliberate delta against rc2 is the same as it was against rc1.

rc2's Antigravity collector (omacom/omarchy#20916) reads the limits
from `agy -p /usage --output-format json`, which lists the Gemini
group's weekly bucket even for accounts Google routes through AICode
(checked with agy 1.5.20 on such an account). So gemini-weekly.py and
the merge of its file into the agy record go: the panel shows the
weekly limit straight from agy.json. Without the agy CLI (an omp, pi
or opencode sign-in alone) the collector still asks Cloud Code, which
leaves that bucket out for those accounts.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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