You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(usage): show Antigravity 5-hour limit as exhausted when weekly limit is spent - #48492
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.
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).
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
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
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 <pool>-5h to <pool>-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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:M30-99 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an Antigravity model group (
Gemini ModelsorClaude and GPT models) exhausts its weekly limit (0%left),agy usage --jsonmarks the group's 5-hour bucket"disabled": true, omitsreset_time, and leaves a staleremaining_fraction(e.g.,0.9899866580963135).antigravityUsageOutputToLimitsdid not decodedisabled, so it emitted the 5-hour bucket at ~99% remaining, andpoolMember()inpackages/shared/src/usageLimits.tsonly clamped weekly-blocked session windows forclaudeAgentandcodex.Fix
apps/server/src/provider/antigravityUsageLimits.ts: Decode optionaldisabledonUsageBucket. Whendisabled: true, emitusedPercent: 100(even ifremaining_fractionis stale or omitted), omitwindowDurationMinsso disabled buckets do not show a 5-hour pace clock, and inherit the same group's exhausted weeklyreset_timeon disabled 5-hour (session) buckets. This keeps direct views (Thread details card,/usage-limits) andexhaustedUsageWindowaccurate without touching the other model group.packages/shared/src/usageLimits.ts: ExtendpoolMember()to clamp each Antigravity<group>-5hwindow against its matching<group>-weeklywindow (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, reportresetsAtfrom the weekly window withrefillPercent: 100while keeping existing stale/invalid clock guards intact.Fixes #48279.
Verification
apps/server/src/provider/antigravityUsageLimits.test.ts): Fed the realagy usage --jsonpayload from [Bug]: Antigravity 5-hour limit still shows ~99–100% left when its weekly limit is exhausted (0%) #48279 (exhaustedgemini-weekly+ disabledgemini-5hwith staleremaining_fraction: 0.9899866580963135, alongside active3p-weeklyand3p-5h) throughmakeAntigravityUsageProbe. Confirmedgemini-5hemitsusedPercent: 100withresetsAt: "2026-12-08T11:55:08.000Z"and nowindowDurationMins,3p-5hstays atusedPercent: 0, and a standalone disabled bucket withoutremaining_fractionstill emitsusedPercent: 100.packages/shared/src/usageLimits.test.ts): VerifiedcollectLimitPoolsclampsgemini-5honly whengemini-weeklyis exhausted and3p-5honly when3p-weeklyis exhausted (single-account and multi-account pools), computes the weekly refill clock when the 5-hour bucket omitsresetsAt, preserves active-session partial refills and stale-clock suppression, and keepsexhaustedUsageWindowaccurate before and after the weekly reset../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,lintwith 0 warnings/errors,graphql,knip,typecheckacross 37 packages,test3 files / 107 tests).Gemini 4 Neon via Antigravity in T3 Code.