Populate windowMinutes for MiMo and StepFun monthly windows (#2431) - #2526
Populate windowMinutes for MiMo and StepFun monthly windows (#2431)#2526LeoLin990405 wants to merge 1 commit into
Conversation
…#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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1928af5a7
ℹ️ 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".
| // Codex/Claude windows. Only when there's a real period end to reset against. | ||
| let windowMinutes = self.planPeriodEnd == nil | ||
| ? nil | ||
| : ProviderPaceCapability.monthlyWindowSentinelMinutes |
There was a problem hiding this comment.
Route monthly windows through history and card pace
Setting the sentinel here (and in the analogous StepFun change) still does not enable either advertised card feature: UsageStore.planUtilizationSeriesSamples routes generic providers only through exact 300/10080-minute session-equivalent windows, so a lone 43200-minute primary produces no history samples, while both provider descriptors retain the default .unsupported pace capability, causing resetWindowPaceDetail to return nil. Add explicit monthly sampling and .calendarMonthResetWindow capabilities for MiMo and StepFun, with a model-seam test that verifies the history and pace output rather than only the snapshot field.
AGENTS.md reference: AGENTS.md:L25-L27
Useful? React with 👍 / 👎.
| let creditWindowMinutes = self.creditResetTime == nil | ||
| ? nil | ||
| : ProviderPaceCapability.monthlyWindowSentinelMinutes |
There was a problem hiding this comment.
Reject zero StepFun reset timestamps
When a credit-plan response contains "subscription_credit_reset_time": "0" (the API's existing representation for an unconfigured reset), parsing produces a non-nil Date(timeIntervalSince1970: 0), so this nil check incorrectly marks it as a real monthly window. Validate that the timestamp/reset date is positive and meaningful before assigning the monthly sentinel; otherwise downstream consumers receive a fabricated 30-day window anchored in 1970.
Useful? React with 👍 / 👎.
c1928af to
117e855
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 1:31 AM ET / 05:31 UTC. ClawSweeper reviewWhat this changesAdds monthly Merge readiness⛔ Blocked until stronger real behavior proof is added - 8 items remain Keep this PR open: its current changes set the monthly sentinel on two snapshots, but they do not route either provider through the downstream history and pace features the PR promises, and StepFun can treat an API reset value of Priority: P2 Review scores
Verification
How this fits togetherProvider adapters normalize vendor quota responses into flowchart LR
A[MiMo and StepFun APIs] --> B[Provider usage snapshots]
B --> C[Rate window metadata]
C --> D[Usage history sampling]
C --> E[Pace capability decision]
D --> F[Utilization chart]
E --> G[Pace forecast]
F --> H[Usage card]
G --> H
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Wire valid monthly MiMo and StepFun windows through the existing history and calendar-month pace paths, reject absent or non-positive reset dates, and verify the resulting chart samples and pace output at the model seam. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: construct a valid monthly MiMo or StepFun snapshot and pass it through the existing usage-history and pace model seams; the current descriptor and sampling rules leave both outputs absent. A StepFun fixture containing reset timestamp Is this the best way to solve the issue? No. Setting 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:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
Companion to #2514 (#2431). MiMo's monthly token quota and StepFun's monthly credit pool build their primary
RateWindowwithwindowMinutes = nil.planUtilizationSeriesSamplesrequires a window withwindowMinutes, so those two cards get neither the plan-utilization history chart nor the predictive pace forecast that the Codex/Claude cards show — a real info-density gap.Changes
MiMoUsageSnapshot): the monthly token-quota window carriesProviderPaceCapability.monthlyWindowSentinelMinuteswhenplanPeriodEndis present (a real reset to project against), andnilotherwise.StepFunUsageFetcher): the credit-pool window carries it whencreditResetTimeis present (otherwise the pace projection would be meaningless).Both are gated on a real reset date, so no window is fabricated for an account without one.
Verification
swift test --filter "MiMo|StepFun"— 115 passed, including new cases: StepFun's credit window now assertswindowMinutes == 43200, and MiMo asserts43200with a period end andnilwithout one.swiftlint --strict— 0 violations; SwiftFormat — clean.windowMinutes: 43200(reset ≈ 1 month out) — it now feeds the history + pace forecast. (MiMo verified by construction; the account under test has no active plan period to exercise it live.)Refs #2431.