Skip to content

Add the day's API value to the hourly summary - #21

Merged
btsouth merged 1 commit into
btsouth:mainfrom
diogochaves:feat/summary-day-value-upstream
Oct 16, 2026
Merged

btsouth merged 1 commit into
btsouth:mainfrom
diogochaves:feat/summary-day-value-upstream

Conversation

@diogochaves

@diogochaves diogochaves commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Hi Tyler! This one is a feature request, so feel free to close it if it's not aligned with the project.

hourly-summary.json has the day's tokens but not what they are worth. A program that wants today's estimated API value outside the dashboard, such as a bar widget or a status script, has to run collector.py report --days 1 and read the report's summary.

That's my case. Agent Pulse feeds the AI panel in my Omarchy bar, which was inspired a lot by Ceiling: I really missed being able to peek at the bar and see my current usage, the way I could on Windows. The panel's foot shows the day's tokens and their estimated API value, with a link back to Agent Pulse. Today it gets the value by running the report each time the panel opens; with this change it reads it from the summary, like the tokens.

4-agent-pulse-console-lb-panel

The snapshot now prices the events it already counts, using the report's own price(), and adds two fields:

  • value: the estimated API value of the same events tokens counts.
  • unpricedTokens: the part of tokens that no rate covers.

It reads each event's recorded speed tier as well, so a Codex Fast turn is valued the way the report values it. schemaVersion stays 1 because the fields are only additions, and readers that ignore them see no change. The changelog entry is under Unreleased, and VERSION is left for the release.

Checks:

  • python3 -m unittest discover -s tests: 248 tests OK. A new test checks that for the same day the snapshot's tokens, value and unpricedTokens equal report(days=1)'s summary, with a priced model, an unpriced model and a Fast turn. It also checks that a day with no rates comes out all unpriced.
  • The py_compile and bash -n checks from the CI workflow.

hourly-summary.json carried the day's tokens only, so a bar widget that
wanted the day's estimated API value had to run `collector.py report
--days 1` and read the report's summary. The snapshot now prices the
events it already counts, with the report's own price(), and adds
`value` and `unpricedTokens`. It reads each event's recorded speed tier
too, so a Codex Fast turn is valued as the report values it. Schema
version 1 is kept: the fields are additive.

Checked with a test that the snapshot's value and unpriced tokens match
`report(days=1)`'s summary for the same day, including a Fast turn, and
that a day with no rates is all unpriced.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f691b22e-cb3a-47f7-99f2-e15b7e29b164
📥 Commits

Reviewing files that changed from the base of the PR and between 1f08b68 and 1aa5ae5.

📒 Files selected for processing: 3
  • CHANGELOG.md
  • collector.py
  • tests/test_collector.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The hourly snapshot now includes estimated API value and unpriced-token totals. The snapshot uses event pricing and retains its existing token and timing totals. The changelog and tests describe and verify the added fields.

Changes: Hourly snapshot pricing

Layer / File(s) Summary
Price and return snapshot totals
collector.py, tests/test_collector.py, CHANGELOG.md
hourly_snapshot loads rates, prices events, and returns aggregate value and unpricedTokens fields. Tests compare the totals with report and cover missing rates. The changelog documents the fields and notes that schema version 1 remains unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: btsouth

Merge Risk: ⚪ Minimal · up to 1aa5a

The new estimated-value and unpriced-token fields follow the hourly snapshot’s existing event totals. No material merge-blocking issue is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding the day's estimated API value to the hourly summary.
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@btsouth
btsouth merged commit 60b9ee0 into btsouth:main Oct 16, 2026
2 checks passed
@diogochaves
diogochaves deleted the feat/summary-day-value-upstream branch October 16, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants