Skip to content

feat(usage): each share of a run's summary says why it went unpriced and which rates it assumed, with its cache reads and writes - #923

Open
earakely-scale wants to merge 1 commit into
mainfrom
share-unpriced-reasons
Open

earakely-scale wants to merge 1 commit into
mainfrom
share-unpriced-reasons

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

A run's model cost mostly reads unpriced or at least $X with nothing saying why. On the newest 1,347 runs with a ledger on one deployment, 73% read unpriced and 23% at least. The reason is on each ledger entry (unpriced_reason: no_model, no_price or no_tokens), and so are the rates a cost assumed (cost_assumed). But summarize dropped both, so no reader of UsageSummary.to_dict() could explain the figure.

Change

task/usage/summary.py: each Share now keeps, and to_dict now carries:

  • unpriced_reasons: the distinct reasons its unpriced entries or per-model rows gave, sorted; [] when none is unpriced.
  • cost_assumed: the distinct rates its priced parts assumed (cache_read_rate, cache_write_rate, input_excludes_cache), sorted.
  • cache_read_tokens and cache_write_tokens, summed like the input and output counts, null when nothing counted them.

The existing keys and the CLI's cost_line and sources_line don't change. AGENTS.md names the new keys.

Testing

  • summary_test.py: the JSON shape test now pins the four keys. A new test covers reasons and assumed rates gathered from both whole entries and per-model rows, cache counts summed, reasons sorted and distinct, and an unpriced entry that gives no reason.
  • tst/unit/task and tst/unit/cli pass (921), and ruff is clean.
  • On real data: this branch's summarize over the newest 1,347 runs with a ledger on a deployment of the framework, read-only. Every unpriced share names a reason (801 no_price, 838 no_tokens, 1 no_model), every assumed share names its rates, each share's cache reads equal its entries' sums, and every summary round-trips through JSON.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Each usage share now exposes cache counts, reasons for missing prices, and assumed rates.

  • Run usage shares now show cache counts and explain their cost estimates.

No actionable issues were found. Tests were reviewed but not run.

Reviews (1) · Last reviewed commit: "feat(usage): each share of a run's summa..." · Reviewed by Greptile

…and which rates it assumed, with its cache reads and writes

A run's cost often reads "unpriced" or "at least" with nothing saying why. The ledger's entries carry the reason
(unpriced_reason: no_model, no_price, no_tokens) and the rates a cost assumed (cost_assumed), but the summary
dropped both, so no reader of its JSON shape could explain the figure. Each share now keeps them, as
unpriced_reasons and cost_assumed, beside its cache reads and writes; to_dict carries all four. The CLI's lines
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 25, 2026 17:06

This branch has not been deployed

No deployments
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.

1 participant