-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Populate windowMinutes for Zai, Kimi, Grok, and Antigravity rate windows (#2431) #2514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
1123bfc
9adcfd2
5065967
f0319c8
3ca5e91
99d9be4
19708f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ public struct GrokUsageSnapshot: Sendable { | |
| { | ||
| primary = RateWindow( | ||
| usedPercent: percent, | ||
| windowMinutes: nil, | ||
| windowMinutes: ProviderPaceCapability.monthlyWindowSentinelMinutes, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For every Grok web-billing snapshot, this hard-codes a monthly duration even though the web response can represent weekly periods and exposes only Useful? React with 👍 / 👎. |
||
| resetsAt: webBilling.resetsAt, | ||
| resetDescription: nil) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import CodexBarCore | ||
| import Foundation | ||
| import Testing | ||
|
|
||
| @Suite(.serialized) | ||
| struct AntigravityWindowMinutesTests { | ||
| @Test | ||
| func `antigravity model quota derives windowMinutes from reset description`() throws { | ||
| let snapshot = AntigravityStatusSnapshot( | ||
| modelQuotas: [ | ||
| AntigravityModelQuota( | ||
| label: "Claude 3.5 Sonnet", | ||
| modelId: "claude-3-5-sonnet", | ||
| remainingFraction: 0.8, | ||
| resetTime: Date(), | ||
| resetDescription: "5-hour session reset"), | ||
| AntigravityModelQuota( | ||
| label: "Gemini 2.5 Flash", | ||
| modelId: "gemini-2-5-flash", | ||
| remainingFraction: 0.5, | ||
| resetTime: Date(), | ||
| resetDescription: "Weekly reset"), | ||
| ], | ||
| accountEmail: "test@example.com", | ||
| accountPlan: "Pro", | ||
| source: .remote) | ||
|
|
||
| let usage = try snapshot.toUsageSnapshot() | ||
| #expect(usage.primary?.windowMinutes == 10080) | ||
| #expect(usage.secondary?.windowMinutes == 300) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aliases are not present in the model-quota data produced by any production fetch path: remote fetches set
resetDescriptionthroughUsageFormatter.resetDescription, which yields a clock time, “tomorrow,” or an absolute date, while the local command-model parser sets it to nil. Consequently legacy Antigravity snapshots still emit nilwindowMinutes, and the new test passes only because it constructs descriptions that the parsers never produce. Derive cadence from stable quota/model metadata rather than the display-formatted reset string.Useful? React with 👍 / 👎.