Populate windowMinutes for Zai, Kimi, Grok, and Antigravity rate windows (#2431) - #2514
Populate windowMinutes for Zai, Kimi, Grok, and Antigravity rate windows (#2431)#2514Yuxin-Qiao wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1123bfccce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| primary = RateWindow( | ||
| usedPercent: percent, | ||
| windowMinutes: nil, | ||
| windowMinutes: ProviderPaceCapability.monthlyWindowSentinelMinutes, |
There was a problem hiding this comment.
Preserve reset-based cadence for Grok web billing
For every Grok web-billing snapshot, this hard-codes a monthly duration even though the web response can represent weekly periods and exposes only resetsAt. GrokProviderDescriptor.primaryLabel(window:now:) prioritizes windowMinutes, so a weekly web period is now labeled Monthly and excluded from the descriptor's weekly pace calculation; this also contradicts the existing web-snapshot test that expects the unknown duration to remain nil. Keep the duration unset or derive it from the reset timestamp before assigning a sentinel.
Useful? React with 👍 / 👎.
| let windowMinutes: Int? = if let desc = quota.resetDescription?.lowercased() { | ||
| if desc.contains("weekly") || desc.contains("7-day") || desc.contains("7d") { | ||
| 10080 | ||
| } else if desc.contains("session") || desc.contains("5h") || desc.contains("5-hour") || desc | ||
| .contains("five hour") |
There was a problem hiding this comment.
Derive Antigravity cadence from production fields
These aliases are not present in the model-quota data produced by any production fetch path: remote fetches set resetDescription through UsageFormatter.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 nil windowMinutes, 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 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 30, 2026, 10:35 PM ET / July 31, 2026, 02:35 UTC. ClawSweeper reviewWhat this changesThe PR populates missing rate-window durations for Zai, Kimi, Grok, and Antigravity provider snapshots so their usage can participate in CodexBar’s pace and forecast calculations. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 10 items remain Keep open: the current branch still assigns a Grok cadence from remaining time until reset, which can misclassify a monthly window near its reset as weekly, and its Antigravity label fallback does not tokenize parenthesized aliases. It also needs redacted after-fix provider output before merge. Likely related people: steipete is the best available low-confidence routing candidate from repository ownership; current-main history should confirm the area owner. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s provider adapters convert each service’s quota response into shared rate windows. Pace and forecast calculations consume the window duration plus reset time to present usage guidance in the menu bar and CLI-facing snapshots. flowchart LR
ProviderData[Provider quota response] --> Adapter[Provider adapter]
Adapter --> RateWindow[Rate window with duration]
RateWindow --> Pace[Pace calculation]
Pace --> Forecast[Forecast engine]
Forecast --> Display[Menu bar and CLI snapshot]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cadence unknown unless stable provider metadata proves the complete quota period; normalize Antigravity token boundaries and add production-shaped regression cases, then attach redacted live output showing the populated window and improved pace behavior. Do we have a high-confidence way to reproduce the issue? Yes for the patch defects from source: a monthly Grok snapshot with fewer than eight days until reset is classified as weekly, and the supplied parenthesized Antigravity labels do not match the alias sets. A real provider-account reproduction of the broader feature fix is still missing. Is this the best way to solve the issue? No. Deriving a quota’s full cadence from time remaining until its next reset is not reliable; preserve unknown cadence without stable source metadata, and normalize punctuation for the Antigravity alias path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8ef86077e70a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
@clawsweeper re-review We have addressed your review comments in commit 1. Grok Web Billing Cadence
2. Antigravity Model Quotas (
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 506596711b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for token in normalized.components(separatedBy: CharacterSet(charactersIn: " -/")) where !token.isEmpty { | ||
| candidates.insert(token) |
There was a problem hiding this comment.
Strip punctuation before matching cadence aliases
When cadence appears in a parenthesized model label such as the newly added Gemini 2.5 Pro (Weekly) or Claude 3.5 Sonnet (5-hour session) fixtures, this split produces tokens like (weekly) and session), neither of which matches the alias sets. Both windows therefore retain a nil windowMinutes, so the new label-fallback test fails and the intended fallback does not work; normalize punctuation or tokenize on non-alphanumeric boundaries before matching.
Useful? React with 👍 / 👎.
Summary
Several provider fetchers omit
windowMinuteswhen constructingRateWindowinstances, which causes the pace calculation and usage forecast engine to silently disable itself for those providers.This PR populates
windowMinutesfor:ZaiUsageStats.swift): PopulateProviderPaceCapability.monthlyWindowSentinelMinutes(43,200) fortimeLimitandisMCPMonthlyMarkerrate windows.KimiUsageSnapshot.swift): PopulateProviderPaceCapability.monthlyWindowSentinelMinutes(43,200) formonthlyWindowsubscription rate windows.GrokStatusProbe.swift): PopulateProviderPaceCapability.monthlyWindowSentinelMinutes(43,200) for web billing rate windows.AntigravityStatusProbe.swift): DerivewindowMinutes(300 for session windows, 10,080 for weekly windows) fromresetDescriptioninrateWindow(for quota:).Verification
AntigravityWindowMinutesTests.swifttestingwindowMinutesderivation for Antigravity model quotas.ZaiProviderTests.swift&KimiProviderTests.swiftassertions to verify populatedwindowMinutes.swift test --filter ZaiProviderTests(40/40 passed).swift test --filter KimiProviderTests(67/67 passed).swift test --filter GrokBillingResponseTests(4/4 passed).swift test --filter AntigravityStatusProbeTests(61/61 passed).make check(0 format/lint violations).Fixes #2431