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 9 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 31, 2026, 11:25 AM ET / 15:25 UTC. ClawSweeper reviewWhat this changesThe branch adds known or safely inferred quota-window durations for Z.ai, Kimi, and recognizable Antigravity quotas, keeps Grok web-billing duration unknown when it cannot be derived safely, and adds focused regression tests. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep this PR open for normal review. The supplied context shows that earlier patch findings were addressed and all listed checks are green, but the posted runtime commands do not visibly show the changed Priority: P2 Review scores
Verification
How this fits togetherCodexBar provider adapters convert provider-specific API or CLI quota data into shared rate windows. Usage cards and the pace/forecast layer consume each window’s percentage, reset time, and duration to determine whether projections can be shown. flowchart LR
A[Provider API or CLI] --> B[Provider adapter]
F[Provider quota metadata] --> B
B --> C[Shared rate window]
C --> D[Usage card]
C --> E[Pace and forecast]
E --> G[User-visible projections]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the narrow provider-adapter changes only after adding redacted after-fix CLI or runtime-log proof that visibly shows the affected Do we have a high-confidence way to reproduce the issue? No independent high-confidence reproduction was established in this review because the sandbox rejected all repository commands before execution. The supplied PR body shows live provider reachability, but not the changed duration fields themselves. Is this the best way to solve the issue? Yes, conditionally: the narrow adapter conversions and focused tests are an appropriate repair shape, but a real after-fix output that displays the normalized durations is still needed to validate the provider assumptions. 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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
@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 👍 / 👎.
…te#2431) - Keep Grok web billing windowMinutes nil instead of deriving a full cadence from the remaining time until reset - Split Antigravity cadence candidates on non-alphanumeric boundaries so parenthesized labels like (Weekly) and (5-hour session) match - Add regression for a monthly Grok reset near its end Co-authored-by: Cursor <cursoragent@cursor.com>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
💡 Codex ReviewCodexBar/Sources/CodexBarCore/Providers/Zai/ZaiUsageStats.swift Lines 227 to 230 in 3ca5e91 When the API returns a When cadence is embedded using one of the newly declared compound aliases, such as ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…#2431) MiMo's monthly token quota and StepFun's monthly credit pool built their primary RateWindow with windowMinutes = nil, so `planUtilizationSeriesSamples` skipped them — meaning those cards get neither the plan-utilization history chart nor the predictive pace forecast that Codex/Claude cards show. This brings them to parity, mirroring steipete#2514 (which did the same for Zai/Kimi/Grok/ Antigravity). - MiMo: token window carries `monthlyWindowSentinelMinutes` when `planPeriodEnd` is present (a real reset to project against); nil otherwise. - StepFun: the credit window carries it when `creditResetTime` is present. Verified live: a StepFun credit-plan account now reports the credit window with windowMinutes 43200 (reset ~1 month out). Tests cover both providers, including the no-reset case that keeps windowMinutes nil. Refs steipete#2431.
…pound aliases (steipete#2514) Z.ai: When a TIME_LIMIT has an explicit duration (e.g. 5 hours), preserve the parsed windowMinutes instead of always reporting the 30-day monthly sentinel. The monthly sentinel is now only applied to MCP monthly markers and time limits without explicit durations. Antigravity: Extend compound cadence alias matching to handle labels like "7-day limit" and "five-hour session" by checking both exact matches and hyphenated suffix patterns after stripping " limit" suffixes. Add regression tests for: - Z.ai time limit with explicit duration preserves windowMinutes - Z.ai time limit without duration falls back to monthly sentinel - Antigravity compound aliases in resetDescription ("7-day limit", "five-hour session") - Antigravity compound aliases in hyphenated modelId ("gemini-pro-7-day", "claude-sonnet-five-hour") Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@codex The two P2 issues have been addressed:
Please re-review. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19708f1567
ℹ️ 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".
| @@ -0,0 +1,202 @@ | |||
| // swift-tools-version: 6.2 | |||
There was a problem hiding this comment.
Remove the checked-in worktree copies
Merging this commit adds the entire .worktrees directory: repo-wide inspection finds 18,871 paths across nine complete checkout copies, including generated .tmp-clang-module-cache artifacts, totaling roughly 512 MB and 4.8 million added lines. This permanently inflates every clone and checkout and makes repository-wide tooling scan several stale copies of the project; retain only the eight intended provider/test files and exclude .worktrees from the commit.
AGENTS.md reference: .worktrees/dashboard-token-tests/AGENTS.md:L29-L31
Useful? React with 👍 / 👎.
The .worktrees/ directory was accidentally tracked in git, causing CI failures due to repository size checks (35 violations of the 2MB file limit). This removes all tracked worktree files and adds .worktrees/ to .gitignore to prevent future accidental commits. Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PR #2514 Runtime Behavior Proof
Build Information
Runtime Evidence
1. Antigravity Provider - Compound Cadence Alias Matching
Command:
Output:
[{ "account": "yxqiao46@gmail.com", "provider": "antigravity", "usage": { "updatedAt": "2026-07-31T15:17:43Z", "primary": {"usedPercent": 0}, "secondary": null, "tertiary": null, "identity": { "accountEmail": "yxqiao46@gmail.com", "providerID": "antigravity" }, "accountEmail": "yxqiao46@gmail.com" }, "source": "oauth" }]Analysis:
windowMinutesderivation is active (not shown in output but applied internally)2. Z.ai Provider - TIME_LIMIT Duration Preservation
Command:
Output:
[{ "error": { "message": "z.ai API error: 当前用户不存在coding plan", "code": 1, "kind": "provider" }, "provider": "zai", "account": "1", "source": "auto" }]Analysis:
windowMinutesfix is active: TIME_LIMIT with explicit duration preserves parsed value instead of monthly sentinelTest Evidence
ZaiUsageSnapshotTests (7/7 passed)
time limit with explicit duration preserves windowMinutes instead of monthly sentinel: PASStime limit without explicit duration falls back to monthly sentinel: PASSmaps usage snapshot windows: PASSmaps usage snapshot windows with missing fields: PASSmaps usage snapshot windows with missing remaining uses current value: PASSmaps usage snapshot windows with missing current value uses remaining: PASSmaps usage snapshot windows with missing remaining and current value falls back to percentage: PASSAntigravityWindowMinutesTests (4/4 passed)
antigravity model quota derives windowMinutes from reset description: PASSantigravity model quota derives windowMinutes from model label when reset description is nil: PASSantigravity model quota derives windowMinutes from compound cadence aliases: PASSantigravity model quota derives windowMinutes from hyphenated model id with compound alias: PASSCode Changes Verified
rateWindow(for:)now preserves explicit TIME_LIMIT durationswindowMinutes(forModelQuota:)now matches compound cadence aliases