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
Merged
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>
… and its JSON from its fields assumed was set from the same entry field as cost_assumed, so the two could drift; it is now a property of cost_assumed. to_dict builds on asdict, so a new field reaches the JSON without a second list to keep. The JSON shape is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rder, as plugins build it Share is on the plugin surface. The last commit made assumed a read-only property, which a plugin passing assumed= or setting it would trip over, and the first put the new fields among the earlier ones, which moves positional arguments. assumed is a field again, set as before, and the four new fields follow partial. to_dict still builds on asdict, and its JSON is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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; the previous compatibility issue is fixed.Summary
Adds cache counts, unpriced reasons, and assumed rates to each share’s JSON.
No new actionable issues found.
Reviews (3) · Last reviewed commit: "fix(usage): a share keeps its assumed fi..." · Reviewed by Greptile