Fix inflated Codex Standard/Fast cost splits - #2782
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 10:42 PM ET / August 9, 2026, 02:42 UTC. ClawSweeper reviewWhat this changesThe PR hides Codex Standard/Fast cost splits when physical fork rows exceed canonical daily usage, and falls back to canonical token-class pricing. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThis owner-authored PR is still necessary and directly addresses the open fork-row pricing regression. The focused fixture covers both suppression of an inflated split and preservation of a reconciled split; no actionable patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherCodexBar converts local Codex session caches into canonical daily model totals and then produces spend reports. This report-boundary logic decides whether physical Standard/Fast pricing rows are safe to display or whether canonical pricing must be used instead. flowchart LR
A[Codex session cache] --> B[Canonical daily usage]
A --> C[Physical pricing rows]
B --> D[Cost report builder]
C --> E[Validate row token total]
E -->|Trusted| F[Show Standard/Fast split]
E -->|Untrusted| G[Canonical token pricing]
F --> H[Daily usage report]
G --> H
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: Land the narrow guardrail so reports never present a precise Standard/Fast split derived from copied fork rows while retaining exact splits that reconcile with canonical ownership. Do we have a high-confidence way to reproduce the issue? Yes. The added scanner fixture creates copied fork rows whose physical Standard/Fast token total exceeds the canonical daily total and exercises the report boundary. Is this the best way to solve the issue? Yes. Suppressing only unreconciled physical splits and falling back to the existing canonical token-class pricing path is the narrowest maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ecdd46b8e10. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
Landed. Verification: the trust check on |
Summary
Codex's canonical day/model totals already deduplicate fork ownership, but the post-#2776 read-time pricing path could still sum physical pricing rows and publish an inflated Standard/Fast split. This repair validates each
CodexRowCostBreakdownagainst the canonical input-plus-output total before trusting it.[150, 60, 15]usage to its owned[50, 20, 5]suffix before the report boundary is exercised.Tests
swift test --filter 'CostUsage|SpendDashboard'— 551 tests in 41 suites passed.swift test --filter 'CostUsageScannerForkSplitTests|CostUsageScannerPriorityTests'— 19 tests in 2 suites passed.swift build— passed.git diff --check— passed.make checkcurrently reaches unrelated SwiftFormat findings inherited frommainin the newly added Fireworks source and tests. No Fireworks cleanup is included here.Credit
Reported by @1328189205. The initial fix and regression-test approach came from @Yuxin-Qiao in #2774.
Fixes #2754