Preserve spend totals while local history catches up - #3051
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
a597df3 to
fa7c088
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:31 PM ET / 21:31 UTC. ClawSweeper reviewWhat this changesThe PR retains established Codex spend totals during a same-scope bounded history refresh, records the exact retained report window, and safely migrates local cache metadata. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readinessNo actionable correctness or security defect remains on the latest head. The PR resolves the earlier scope and retained-window concerns; keep it open for normal maintainer review once the running macOS checks finish. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherCodexBar scans local Codex session history into cached spend snapshots for the dashboard and CLI. During bounded catch-up, this change prevents an incomplete snapshot from replacing an established total unless its account, history window, and bucket time zone match. flowchart LR
A[Local Codex session history] --> B[Cost usage scanner]
B --> C[SQLite spend cache]
C --> D{Coverage established?}
D -->|Yes| E[Publish new total]
D -->|No, same scope| F[Retain established total]
D -->|No, changed scope| G[Show incomplete result]
E --> H[Dashboard and CLI output]
F --> H
G --> H
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land the scoped retention and migration behavior after the current macOS matrix completes successfully. Do we have a high-confidence way to reproduce the issue? Yes: focused current-head tests create an established cached total, drive an incomplete Codex refresh, and assert retention only for the identical account, history window, and bucket time zone. Is this the best way to solve the issue? Yes: retaining only a previously established, scope-matched snapshot during bounded catch-up is the narrowest maintainable fix, with an explicit cache-version migration for older retained payloads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 41d904fd6d88. 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 (5 earlier review cycles)
|
fa7c088 to
d3cf7c8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3cf7c8ab1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
4a60d7f to
be8ca78
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Maurício Pólvora <mauricio.polvora@gmail.com>
|
Landed as 2613217 after rebasing onto current main and preserving contributor credit. Verified account-, history-window-, and time-zone-scoped spend retention with real session-log append/catch-up fixtures and real SQLite migration from the current production parser hash; existing usage rows survive without rebuilding while unsafe old retained reports are discarded. Full local suite: 931 selections across 78 groups, zero failures, retries, or timeouts. Formatting/lint, provider architecture gate, independent review, and hosted CI all passed. Thank you @mauriciopolvora! |
No description provided.