Repository navigation
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
Open
earakely-scale wants to merge 1 commit into
earakely-scale wants to merge 1 commit into
Conversation
…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>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A run's model cost mostly reads
unpricedorat least $Xwith 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_priceorno_tokens), and so are the rates a cost assumed (cost_assumed). Butsummarizedropped both, so no reader ofUsageSummary.to_dict()could explain the figure.Change
task/usage/summary.py: eachSharenow keeps, andto_dictnow 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_tokensandcache_write_tokens, summed like the input and output counts, null when nothing counted them.The existing keys and the CLI's
cost_lineandsources_linedon't change.AGENTS.mdnames 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/taskandtst/unit/clipass (921), andruffis clean.summarizeover the newest 1,347 runs with a ledger on a deployment of the framework, read-only. Every unpriced share names a reason (801no_price, 838no_tokens, 1no_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


Confidence Score: 5/5
The PR appears safe to merge.Summary
Each usage share now exposes cache counts, reasons for missing prices, and assumed rates.
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