fix: skip elapsed reset times when picking LLMProxy next reset#2335
fix: skip elapsed reset times when picking LLMProxy next reset#2335OfficialAbhinavSingh wants to merge 1 commit into
Conversation
parseSnapshot computed nextResetAt as the globally earliest reset time
(quotaGroups.compactMap { parseDate }.min()) with no future filter, so a
stale already-elapsed reset_time could be surfaced as the next reset.
Filter to reset times after the snapshot updatedAt before taking the
minimum, mirroring GrokWebBillingFetcher and ClaudeStatusProbe.
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 10:05 AM ET / 14:05 UTC. Summary Reproducibility: yes. from source: provide quota groups containing an elapsed Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Next step before merge
Security Review detailsBest possible solution: Land the date filter with the regression cases after the contributor attaches redacted after-fix output from a real LLMProxy quota-stats response showing an elapsed reset is ignored while the nearest future reset is displayed. Do we have a high-confidence way to reproduce the issue? Yes, from source: provide quota groups containing an elapsed Is this the best way to solve the issue? Yes for the parser bug: filtering timestamps after AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1d307430a13d. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
LLMProxyUsageFetcher.parseSnapshot(data:updatedAt:)computes the displayed next reset as the globally earliest reset across all quota groups:There is no future filter, so if any quota group carries an already-elapsed
reset_time(a group that rolled over and is momentarily stale until the next refresh), that past date wins the.min()and is surfaced asnextResetAt→RateWindow.resetsAt. A user then sees a "next reset" that is in the past.Concrete: reset times
[2023-11-01 (past), 2023-11-20 (soon), 2023-12-25 (later)]with a snapshot time of2023-11-14→ shows2023-11-01; correct is2023-11-20.Fix
Ignore reset times at or before the snapshot time (
updatedAt) before taking the minimum:This mirrors the existing convention in
GrokWebBillingFetcher(filter { $0.date > now }) andClaudeStatusProbe(first(where: { $0 >= now })). When every reset is in the past,nextResetAtbecomesnil(honestly "unknown") rather than a stale past date; downstream (RateWindow.resetsAt) already acceptsDate?. Normal all-future data is unchanged.Test
TestsLinux/LLMProxyResetLinuxTests.swift(via the existing_parseSnapshotForTestinghook):2023-11-20), not the past onenextResetAt == nilProof (real run)
Runs on CI in the
build-linux-cli"Swift Test (Linux only)" step (swift test --parallel). Local red→green inswift:6.3.3, only the.filterline differs:Before the fix — filter removed, the past reset wins:
After the fix — all pass:
Build clean,
swiftlint --strict0 violations,swiftformat --lintclean.Small and self-contained — happy to adjust or close if the behavior isn't wanted.