fix(receipt): step cost reads exact only when reported, not estimated - #179
Merged
Conversation
…estimated V1StepUsage.costText showed a complete (non-partial) step cost as exact $ regardless of how it was priced, so a step whose cost was estimated from tokens over-claimed exactness. The backend now derives one cost_confidence per step from its per-record breakdown (exact only when every priced record is reported/billed, else estimated), and the app renders $ vs ~=$ from it — the same app-wide cost grammar the other surfaces use.
Merged
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.
V1StepUsage.costTextrendered any complete (non-partial) step cost as exact$, with no confidence check — so a step whose cost was estimated from tokens was shown as an exact figure, over-claiming precision (found in the earlier security/honesty audit).Fix: the backend derives one
cost_confidenceper step from its existing per-recordcost_confidence_breakdown— exact only when every priced record is reported/billed, otherwise an estimate — and the macOS app picks$vs≈$from it (partial stays~$, unpriced stays—). This matches the app-wide cost grammar used everywhere else.Backend helper unit-tested;
swift build+ all snapshot-harness suites pass (no snapshot flips — no fixture renders a priced step cost).