feat(cost): split Codex and Claude local cost by live weekly windows - #3358
feat(cost): split Codex and Claude local cost by live weekly windows#3358stabey wants to merge 9 commits into
Conversation
Bring in 0.56.1, 0.56.2, and 0.56.3 development through steipete#3318. Keep quota-window history and fail-closed cost completeness across the merged coverage/request-count accumulators.
Menu rendering now reads weekly reset dates without migrating history buckets, and the window UI stays Codex/Claude-only via the descriptor.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 10:39 AM ET / 14:39 UTC. ClawSweeper reviewWhat this changesAdds Codex and Claude Usage & Spend totals and recent-history rows partitioned by live weekly quota-reset windows rather than calendar days. Merge readinessKeep open pending maintainer confirmation of this new Usage & Spend direction. Current main does not contain the quota-window presentation, and the branch now has direct redacted app captures plus focused boundary coverage; no discrete correctness or security defect was identified in the introduced change. Priority: P2 Review scores
Verification
How this fits togetherLocal Codex and Claude transcript scanners produce cost and token history that flows through provider presentation rules into the macOS Usage & Spend menu card. This change uses the provider’s weekly reset timing to turn that history into current and prior quota-window totals. flowchart LR
A[Local Codex and Claude logs] --> B[Cost and token scanner]
B --> C[Timed cost history]
D[Weekly quota reset data] --> E[Quota window projection]
C --> E
E --> F[Provider presentation rules]
F --> G[Usage and Spend menu card]
Decision needed
Why: The implementation is a new user-visible dashboard mode rather than a repair to an established contract, and no maintainer decision in the supplied discussion establishes that this product surface should be added. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: If sponsored, merge the provider-gated window projection with its backward-compatible optional cache fields and retain the reset-boundary regression coverage. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds a new dashboard presentation rather than reporting a broken current behavior; its redacted built-app captures directly show the proposed UI. Is this the best way to solve the issue? Unclear: the code path is coherent and covered, but a maintainer must first confirm that this new quota-window dashboard is the preferred product direction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9fbe605ee617. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5267187751
ℹ️ 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".
Fill sparse observed-reset holes, fail closed on incomplete days and model costs, omit windows that start before scanned history, keep calendar fallback on local midnight, and read the weekly reset from semantic windows so Claude OAuth still aligns.
A merged Pi daily-only total can make a reset day residual; still project the exact native timestamps into each window instead of dropping the day.
Unpriced Codex auto-review rows were fail-closing the whole day and current window after Pi merge. Keep independently priced models so Usage & Spend still shows amounts.
Replace the PR's synthetic layout proof with redacted Usage & Spend shots from this branch.
|
Live Codex and Claude Usage & Spend captures from this branch are now in the PR body (replacing the synthetic layout shots).
The cost-fix commit keeps priced model subtotals when |
Summary
Current window/Previous window/N windows ago), including same-day official and banked resets.Test plan
make checkmake test(986 selections / 83 groups, first-pass all green)CostUsageQuotaWeekLinuxTests,CostUsageDailyReportMergeTests,InlineCostHistoryDashboardLabelTests,ProviderArchitectureGatekeeperTestsScreenshots
Live Usage & Spend from a local adhoc build of this branch (2026-09-02). Codex account name is redacted. Codex was a live refresh; Claude is last-known usage from about 7 hours earlier because this adhoc build could not read Claude OAuth from Keychain.
Synthetic layout captures used by
MenuLayoutScreenshotRenderTests/test_renderQuotaWindowCostScreenshotsremain atdocs/screenshots/quota-window-{codex,claude}-{light,dark}.png.