Skip to content

Show reported provider spend in CLI dashboards - #3748

Merged
steipete merged 1 commit into
steipete:mainfrom
Chipagosfinest:fix/snapshot-spend-on-dashboard
Sep 20, 2026
Merged

steipete merged 1 commit into
steipete:mainfrom
Chipagosfinest:fix/snapshot-spend-on-dashboard

Conversation

@Chipagosfinest

@Chipagosfinest Chipagosfinest commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

OpenRouter Activity already supplies reported spend in its usage snapshot, but the CLI dashboard emitted cost: null because 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: todayUSD stays 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 check and independent P0–P2 review passed.
  • All 1,247 selections across 114 full-suite groups passed with no failures, retries, or timeouts.
  • 27 focused tests passed under TZ=America/Los_Angeles, including the UTC/local rollover, known zero, missing totals, incompatible currencies/windows, incomplete history, and local-cost precedence.
  • Built, signed CLI before/after proof used identical no-network synthetic provider fixtures in task-owned copies of the helper and its resource bundle. Real-home reads/writes and all network access were denied for the one-shot command. Both exited successfully: baseline cost: null; candidate {"todayUSD":null,"last30DaysUSD":12.5}.
  • The authenticated loopback HTTP route returned the same result, and the real Chrome dashboard rendered Last 30 days $12.50 with Today omitted. The fixture makes no provider API requests and uses no real credentials.
  • CI run 35484141518 passed all nine checks on a8ee4c977986afd3c2bf086a78e9f4672035585b, including macOS, Linux, and GitGuardian.

Live dashboard before and after

The screenshots contain only synthetic data.

Before

Dashboard without reported Activity spend

After

Dashboard showing reported 30-day spend

Thanks @Chipagosfinest for identifying the missing dashboard projection.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

Live 0.61.0 check that motivated this: codexbar usage --provider openrouter already prints Last 30 days (UTC): $… (reported) plus Activity token/request/model counts. codexbar dashboard left cost: null for the same provider because only the local cost-command providers were attached.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 1:10 AM ET / 05:10 UTC (Revision 4).

ClawSweeper review

What this changes

Adds 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
Reviewed head: a8ee4c977986afd3c2bf086a78e9f4672035585b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, compatible implementation with direct before-and-after proof and useful regression coverage.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
Evidence reviewed 7 items Introduced change and compatibility: The pinned merge-base-to-head delta changes four files. The builder preserves any local cost payload, including unavailable local amounts; otherwise it accepts only USD/30-day history, preserves known zero and incomplete counts, and leaves Today unknown.
Still needed on main and in the release: Inspected the builder at fetched main d987dd5 and release v0.62.0 (4b3ed1a). Both still call makeCost exclusively and return no cost when the separate local result is absent; neither contains this fallback.
Provider calendar and consumer contract: OpenRouter’s bundled provider emits USD history for 30 completed UTC days. The existing web renderer independently displays available cost fields, so an unknown Today value is omitted while the aggregate appears. No provider fetch, credential handling, or HTTP authorization changes are introduced.
Findings None None.
Security None None.

How this fits together

CodexBar 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
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta Production +15/-1; tests +122/-0 The small projection helper is justified by missing dashboard coverage and has focused boundary tests.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Displaying already-available provider spend is a bounded dashboard improvement without an urgent runtime failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The captured built-CLI before/after output and inspected Chrome screenshots exercise the dashboard projection with isolated synthetic provider inputs: the aggregate becomes $12.50 and Today remains absent. This proves the changed display behavior without requiring live provider credentials; upstream fetching and browser security behavior are unchanged.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-18T21:31:03.289Z sha 8fcf687 :: needs real behavior proof before merge. :: [P2] Preserve UTC bucket semantics before deriving today's spend
  • reviewed 2026-09-18T21:40:22.967Z sha 010df21 :: needs real behavior proof before merge. :: [P2] Preserve UTC semantics before deriving today's spend | [P2] Exclude stale publication inputs before building Overview | [P1] Honor hidden sources in the ownership-mismatch fallback
  • reviewed 2026-09-20T02:34:17.406Z sha a8ee4c9 :: needs real behavior proof before merge. :: none

@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

Extended past the CLI dashboard: Overview now merges live costUsage when the spend publication omitted OpenRouter, and widgets persist Activity 30-day cost/tokens. OpenRouter is selectable in the widget gallery.

Overlap with #3743: that PR shows credit balance; this one shows reported Activity spend on Overview and widget cost metrics.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 18, 2026
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>
@steipete
steipete force-pushed the fix/snapshot-spend-on-dashboard branch from 010df21 to a8ee4c9 Compare September 20, 2026 02:29
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 20, 2026
@steipete steipete changed the title Project live plugin spend onto dashboard cost rows Show reported provider spend in CLI dashboards Sep 20, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 20, 2026
@steipete
steipete merged commit f65c002 into steipete:main Sep 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants