Show reported provider spend in CLI dashboards - #3748
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Live 0.61.0 check that motivated this: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 1:10 AM ET / 05:10 UTC (Revision 4). ClawSweeper reviewWhat this changesAdds provider-reported 30-day USD spend to CLI dashboard snapshots when no local cost result exists, with regression tests and documentation. Merge readiness✅ Ready for maintainer review The PR remains useful: current main and v0.62.0 still omit provider-reported dashboard spend. The revised scope and new before-and-after evidence address the prior review; no blocking defects remain. Priority: P2 Review scores
Verification
How this fits togetherCodexBar combines provider usage and local cost results into dashboard snapshots consumed by the CLI and authenticated web dashboard. This change lets the existing cost display use compatible spend already present in a provider’s usage snapshot. flowchart LR
A[Provider usage history] --> C[Dashboard snapshot builder]
B[Local cost results] --> C
C --> D{Local result exists?}
D -->|Yes| E[Preserve local cost]
D -->|No| F[Check USD and 30-day history]
E --> G[CLI and web dashboard]
F -->|Compatible aggregate with Today unknown| G
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Reuse compatible provider aggregates through the existing dashboard cost fields while preserving local precedence and unknown Today values. Do we have a high-confidence way to reproduce the issue? Not applicable as a new dashboard data-source capability; source inspection confirms the existing local-only limitation, and supplied before-and-after evidence demonstrates the added behavior. Is this the best way to solve the issue? Yes. The fallback reuses existing data and output fields without another fetch, competing cost pipeline, or invented local-day total. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d987dd59ad34. 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)
|
|
Extended past the CLI dashboard: Overview now merges live Overlap with #3743: that PR shows credit balance; this one shows reported Activity spend on Overview and widget cost metrics. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Reuse compatible 30-day USD history when no local cost payload exists. Preserve unknown Today values for provider calendar windows, known zero, exclusion counts, and local cost precedence. Co-authored-by: Alec Gutman <44984861+Chipagosfinest@users.noreply.github.com>
010df21 to
a8ee4c9
Compare
OpenRouter Activity already supplies reported spend in its usage snapshot, but the CLI dashboard emitted
cost: nullbecause its producer only projected the separate local-cost result. Dashboard-v1 now uses a provider's compatible 30-day USD aggregate when no local cost payload exists. Existing local results retain precedence, including an unavailable local amount.Provider history keeps its own calendar meaning. Completed UTC daily buckets never become local Today merely because their date string matches:
todayUSDstays null, known zero stays zero, and incomplete-request counts remain attached to the reported window. Other currencies or history lengths remain unavailable in the fixed USD/30-day fields.Validation
make checkand independent P0–P2 review passed.TZ=America/Los_Angeles, including the UTC/local rollover, known zero, missing totals, incompatible currencies/windows, incomplete history, and local-cost precedence.cost: null; candidate{"todayUSD":null,"last30DaysUSD":12.5}.a8ee4c977986afd3c2bf086a78e9f4672035585b, including macOS, Linux, and GitGuardian.Live dashboard before and after
The screenshots contain only synthetic data.
Before
After
Thanks @Chipagosfinest for identifying the missing dashboard projection.