Skip to content

fix(usage): show Antigravity 5-hour limit as exhausted when weekly limit is spent - #48492

Open
KaavinB wants to merge 1 commit into
pingdotgg:mainfrom
KaavinB:fix/antigravity-5h-weekly-exhausted
Open

KaavinB wants to merge 1 commit into
pingdotgg:mainfrom
KaavinB:fix/antigravity-5h-weekly-exhausted

Conversation

@KaavinB

@KaavinB KaavinB commented Dec 3, 2026

Copy link
Copy Markdown

Problem

When an Antigravity model group (Gemini Models or Claude and GPT models) exhausts its weekly limit (0% left), agy usage --json marks the group's 5-hour bucket "disabled": true, omits reset_time, and leaves a stale remaining_fraction (e.g., 0.9899866580963135).

antigravityUsageOutputToLimits did not decode disabled, so it emitted the 5-hour bucket at ~99% remaining, and poolMember() in packages/shared/src/usageLimits.ts only clamped weekly-blocked session windows for claudeAgent and codex.

Fix

  • apps/server/src/provider/antigravityUsageLimits.ts: Decode optional disabled on UsageBucket. When disabled: true, emit usedPercent: 100 (even if remaining_fraction is stale or omitted), omit windowDurationMins so disabled buckets do not show a 5-hour pace clock, and inherit the same group's exhausted weekly reset_time on disabled 5-hour (session) buckets. This keeps direct views (Thread details card, /usage-limits) and exhaustedUsageWindow accurate without touching the other model group.
  • packages/shared/src/usageLimits.ts: Extend poolMember() to clamp each Antigravity <group>-5h window against its matching <group>-weekly window (gemini-5h ↔ gemini-weekly, 3p-5h ↔ 3p-weekly). When an Antigravity 5-hour window has no session clock (resetsAt === undefined) and its matching weekly window is spent with a valid future reset time, report resetsAt from the weekly window with refillPercent: 100 while keeping existing stale/invalid clock guards intact.

Fixes #48279.

Verification

  • Server probe regression tests (apps/server/src/provider/antigravityUsageLimits.test.ts): Fed the real agy usage --json payload from [Bug]: Antigravity 5-hour limit still shows ~99–100% left when its weekly limit is exhausted (0%) #48279 (exhausted gemini-weekly + disabled gemini-5h with stale remaining_fraction: 0.9899866580963135, alongside active 3p-weekly and 3p-5h) through makeAntigravityUsageProbe. Confirmed gemini-5h emits usedPercent: 100 with resetsAt: "2026-12-08T11:55:08.000Z" and no windowDurationMins, 3p-5h stays at usedPercent: 0, and a standalone disabled bucket without remaining_fraction still emits usedPercent: 100.
  • Shared pooling & fallback tests (packages/shared/src/usageLimits.test.ts): Verified collectLimitPools clamps gemini-5h only when gemini-weekly is exhausted and 3p-5h only when 3p-weekly is exhausted (single-account and multi-account pools), computes the weekly refill clock when the 5-hour bucket omits resetsAt, preserves active-session partial refills and stale-clock suppression, and keeps exhaustedUsageWindow accurate before and after the weekly reset.
  • Checks run:
    • ./node_modules/.bin/vp test run apps/server/src/provider/antigravityUsageLimits.test.ts packages/shared/src/usageLimits.test.ts — 2 files, 105 tests passed.
    • ./node_modules/.bin/vp run check:changed upstream/main — passed (format, lint with 0 warnings/errors, graphql, knip, typecheck across 37 packages, test 3 files / 107 tests).

Gemini 4 Neon via Antigravity in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Dec 3, 2026
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Antigravity usage conversion now treats disabled buckets as fully used and can apply the group’s weekly reset time to disabled 5-hour buckets. Shared usage pooling now accounts for matching exhausted weekly windows when calculating session usage and refill.

Changes: Antigravity Usage Limits

Layer / File(s) Summary
Convert disabled Antigravity buckets
apps/server/src/provider/antigravityUsageLimits.ts, apps/server/src/provider/antigravityUsageLimits.test.ts
Disabled buckets are reported as 100% used. Disabled session buckets use a valid group weekly reset when available. Tests cover stale remaining fractions and buckets without a remaining fraction.
Apply weekly exhaustion to session pools
packages/shared/src/usageLimits.ts, packages/shared/src/usageLimits.test.ts
Matching exhausted Antigravity weekly windows block session windows. The logic uses the weekly reset when the session reset is missing and tests reset clocks, refill calculations, and model-specific exhausted-window results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 126e8

Antigravity Usage → Limits now shows a group's 5-hour window as exhausted when that group's weekly quota is spent, and it uses the weekly reset time for restoration. The other model group is unaffected. The change is small and covered by regression tests, and no remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the Antigravity 5-hour usage limit and the weekly-limit condition that drives the change. It follows the conventional commit form and matches the changeset: the server now reports disa…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section names the failing behavior and the stale remaining_fraction. The Change section expl…
Linked Issues check Passed Issue #48279 requires that a disabled Antigravity 5-hour bucket, under an exhausted weekly group, show 0% left and not inflate the pool average. It also asks that the exhausted weekly reset time be us…
Out of Scope Changes check Passed The whole-PR diff (merge base efbd62a to head 126e8fb) touches only apps/server/src/provider/antigravityUsageLimits.ts, packages/shared/src/usageLimits.ts, and their test files. Every server change …
Full details: Title check

Explanation

The title names the Antigravity 5-hour usage limit and the weekly-limit condition that drives the change. It follows the conventional commit form and matches the changeset: the server now reports disabled 5-hour buckets as 100% used, and the shared pooling logic clamps 5-hour windows against weekly windows.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section names the failing behavior and the stale remaining_fraction. The Change section explains both files. The Scope section links issue #48279. The Verification section lists the focused test command, the pass counts, and the observed results. It also names the model and harness, as the template asks.

Full details: Linked Issues check

Explanation

Issue #48279 requires that a disabled Antigravity 5-hour bucket, under an exhausted weekly group, show 0% left and not inflate the pool average. It also asks that the exhausted weekly reset time be used when the 5-hour bucket has no reset clock.

Evidence at head:

  • apps/server/src/provider/antigravityUsageLimits.ts: UsageBucket decodes disabled. A disabled bucket emits usedPercent: 100 even when remaining_fraction is stale or absent. windowDurationMins is omitted for disabled buckets. A disabled session bucket takes the valid reset_time of the same group's spent weekly bucket (spentWeeklyReset).
  • packages/shared/src/usageLimits.ts: isBlockingWeeklyWindow maps &lt;pool&gt;-5h to &lt;pool&gt;-weekly for antigravity. poolMember clamps the session window when that weekly window is at 100%. When reported.resetsAt is undefined, the weekly reset is used with refillPercent: 100. Stale or invalid clocks still fall through to the existing guards.
  • The Claude and Codex branches keep their prior conditions. The session-clock check was restructured but preserves prior logic for those drivers.

Tests reported in the PR cover the issue payload, single- and multi-account pools, fallback reset clocks, and stale-clock suppression. I did not run the tests. The 3p-5h and 3p-weekly identifiers are taken from the PR description; the issue payload shows only gemini-* identifiers.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff (merge base efbd62a to head 126e8fb) touches only apps/server/src/provider/antigravityUsageLimits.ts, packages/shared/src/usageLimits.ts, and their test files. Every server change relates to decoding disabled, emitting 100% for disabled buckets, omitting the 5-hour pace clock, and inheriting the weekly reset. Every shared change relates to Antigravity weekly-blocking of 5-hour windows and the reset fallback. The parseResetTime helper extracts existing reset-date logic and is used by the required changes. No unrelated change was found.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e1a0323 and 126e8fb.

Files selected for processing: 4

  • apps/server/src/provider/antigravityUsageLimits.test.ts
  • apps/server/src/provider/antigravityUsageLimits.ts
  • packages/shared/src/usageLimits.test.ts
  • packages/shared/src/usageLimits.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Antigravity 5-hour limit still shows ~99–100% left when its weekly limit is exhausted (0%)

1 participant