Skip to content

fix(antigravity): read the Gemini pool from the quota summary reliably - #177

Merged
CodeZeno merged 1 commit into
CodeZeno:mainfrom
fix2it:feat/agy-quota-request
Oct 19, 2026
Merged

CodeZeno merged 1 commit into
CodeZeno:mainfrom
fix2it:feat/agy-quota-request

Conversation

@fix2it

@fix2it fix2it commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes Antigravity quota retrieval so that the first-party Gemini quota pool is correctly identified, parsed, and displayed without falling back to or mixing with third-party model groups.

Motivation & Problem

  1. User-Agent Filtering: The Google Cloud Code internal quota endpoint (daily-cloudcode-pa.googleapis.com) inspects the client User-Agent. When queried with an unqualified antigravity header, the backend filtered out the Gemini Models group entirely, returning only third-party Claude/GPT groups.
  2. Ambiguous Group Selection: When the Gemini group was not explicitly matched, the poller picked the first available group with windows, causing third-party (Claude/GPT) usage percentages and reset times to be displayed under the Antigravity (Gemini) widget.
  3. Artificial Day Shifts: The poller previously applied a speculative $+6\text{ day}$ offset to weekly buckets, resulting in inaccurate countdown horizons.

Key Changes

  1. Explicit Client Version: Send User-Agent: antigravity/2.24.0 across loadCodeAssist, fetchAvailableModels, and retrieveUserQuotaSummary. This ensures Google's API returns the complete, modern quota tree including Gemini models.
  2. Authoritative Summary Endpoint:
    • The first endpoint returning a valid retrieveUserQuotaSummary is treated as authoritative and returned immediately.
    • Endpoints are no longer inconsistently merged, and secondary fetchAvailableModels calls are skipped when the summary has answered.
  3. Strict Group Classification:
    • Groups are strictly classified as Gemini vs. External (claude, gpt, 3p-* buckets).
    • An unrecognized group is used only if it is the sole group present.
    • A summary with empty groups or unrecognized windows is treated as "no limit data" rather than an error.
  4. Clean Reset Parsing:
    • Uses direct ISO 8601 parsing (parse_iso8601) on bucket reset timestamps without artificial day offsets.
  5. Accurate Serialization:
    • Unreported windows are cached with percentage: null (displaying -- rather than a misleading 0% used).

Verification & Tests

  • Added unit tests in src/poller/tests.rs covering summary parsing with multiple groups, single-group fallbacks, missing windows, and empty buckets.
  • Verified against live Google Cloud Code pa endpoints with real credentials (live_quota_summary_shape).

The summary picked the first group with windows when the Gemini group
did not match, so the widget showed the "Claude and GPT models" quota
under the Antigravity name.

- The first endpoint that returns retrieveUserQuotaSummary is
  authoritative and returned at once; endpoints are no longer merged and
  fetchAvailableModels is skipped when the summary answered.
- Groups are classified as Gemini or external (claude/gpt/3p-* buckets);
  an unrecognised group is used only when it is the sole group.
- A summary without recognised windows (or with an empty group list) is
  "no limit data", not a failure.
- The model-quota fallback uses Gemini models only, because per-model
  quotas do not say which window they belong to.
- Send an explicit Antigravity User-Agent; try the sandbox endpoint last.
- Absent windows are cached with `percentage: null` so external readers
  see "unknown" rather than 0% used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CodeZeno
CodeZeno merged commit a27a730 into CodeZeno:main Oct 19, 2026
0 of 2 checks passed
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