Skip to content

Fall back to retrieveUserQuota for Gemini limits on Ultra - #19908

Merged
dhh merged 1 commit into
quattrofrom
fix-gemini-usage
Nov 23, 2026
Merged

dhh merged 1 commit into
quattrofrom
fix-gemini-usage

Conversation

@dhh

@dhh dhh commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Why

On Google AI Ultra, v1internal:retrieveUserQuotaSummary omits the Gemini group and returns only "Claude and GPT models". After #19866 rightly stopped substituting that third-party group for Gemini, Ultra accounts showed no quota meter in the agents panel ("limits": []).

Meanwhile, v1internal:retrieveUserQuota on the same Cloud Code endpoint still reports every Gemini model's live 5-hour quota bucket (remainingFraction and resetTime), ticking down in real time as prompts run.

What changed

  • bin/omarchy-agent-usage-agy: When retrieveUserQuotaSummary returns no Gemini Session/Weekly window, fall back to v1internal:retrieveUserQuota and pick the fullest gemini* bucket as Session (5-hour) (dropping Google's rolling now+5h synthetic resetTime when usage is 0%, and degrading cleanly on HTTP 400/404 while preserving stale cached limits on transient errors).
  • test/shell.d/agent-usage-agy-test.sh: Covers the Ultra fallback, project forwarding, transient 500 stale-cache preservation, untouched-bucket reset suppression, skipping the fallback when the summary already includes Gemini, and graceful 404 degradation.

Verification

  • Ran bin/omarchy-agent-usage-agy --force live against a Google AI Ultra account: now reports live "Session (5-hour)" usage (7.14%, real resetsAt) instead of [].
  • Passed test/shell.d/agent-usage-agy-test.sh, test/shell.d/agent-usage-shared-test.sh, and test/shell.d/agent-usage-partition-test.sh.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Adds retrieveUserQuota as a fallback when the quota summary has no Gemini Session or Weekly window.

  • Antigravity limits show a Gemini session meter when the summary omits it.

No actionable issues were found. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read quota summary] --> B{Gemini window present?}
  B -->|Yes| C[Save summary limits]
  B -->|No| D[Read model quotas]
  D -->|Success| E[Add most-used Gemini bucket]
  E --> C
  D -->|HTTP 400 or 404| C
  D -->|Other failure| F[Keep cached limits as stale]
Loading

Reviews (1) · Last reviewed commit: "Fall back to retrieveUserQuota for Gemin..." · Reviewed by Greptile

@dhh
dhh merged commit c685ce4 into quattro Nov 23, 2026
3 checks passed
@dhh
dhh deleted the fix-gemini-usage branch November 23, 2026 13:17
@omarchybot omarchybot added the bug Something isn't working label Nov 23, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 in Codex (reasoning effort not exposed) checked 046e90638d051310eb2d1b200d2d2c62e427a113 on a disposable Omarchy worker. With a local HTTPS quota fixture and dummy sign-in, the base emitted no Gemini meter, this head emitted the fixture's 37% Session usage, and reverting the fix removed it again. The CLI and six focused collector, account, update and panel test files passed. These were simulated API responses; no live Google account was queried.

One case remains open at bin/omarchy-agent-usage-agy:372: the fallback runs beyond Ultra and always calls the selected model bucket Session (5-hour). A synthetic Free-tier bucket resetting six days later was emitted with that label. A Free-tier report describes per-model quotas matching the weekly window, so the fallback needs its window assumption checked for those accounts.

The configured second reviewer, Opus 5.5 High, hit its weekly quota; omabot review --ping confirmed it was unavailable. The readiness judge also returned no judgement. This is waiting on the maintainer for review, the non-Ultra window assumption, and the overlapping request-header fixes in #17636, #17825, #18730 and #19834.

Before: the worker's simulated Ultra account has no Gemini Session meter

After: the same worker panel displays the simulated 37% Gemini Session meter

@emirb emirb added this to the 4.6.0 milestone Dec 1, 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