sdk/summary: surface unpriced turns instead of silently reporting them as $0#474
Conversation
Add `tally_unpriced` helper in cost.rs that counts turns with no pricing table entry and collects their model names. Wire the tally into both `compute_summary` (slim verb) and `SummaryGroupedReport` (grouped report), adding `unpriced_turns`/`unpriced_models` fields to each. Render a warning footer to stderr in `burn summary` human output so users know when cost totals are incomplete. New fields are additive/optional in JSON output; four new SDK tests and two updated CLI fixture constructors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07a1f7fd01
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // TS uses `process.stdout.write(lines.join('\n'))` — no trailing newline. | ||
| print!("{}", out); | ||
|
|
||
| if report.unpriced_turns > 0 { |
There was a problem hiding this comment.
Include unpriced fields in CLI JSON output
When burn summary --json is used with turns from an unknown model, this new warning path is skipped because emit_grouped returns through emit_json, and grouped_json_value manually builds the payload without inserting unpricedTurns or unpricedModels. That leaves JSON callers with the same silent $0 under-reporting this change is intended to surface; add the two fields to the grouped JSON payload when present.
Useful? React with 👍 / 👎.
| unpricedTurns?: number; | ||
| /** Distinct model names (first-seen order) that had no pricing entry. */ | ||
| unpricedModels?: string[]; |
There was a problem hiding this comment.
Propagate unpriced fields through the Node binding
For @relayburn/sdk callers with unknown-model turns, these declarations promise unpricedTurns/unpricedModels, but the napi Summary object in crates/relayburn-sdk-node/src/lib.rs still has no such fields and its From<sdk::Summary> conversion drops them. The runtime result from summary() therefore omits the new signal while TypeScript suggests it may exist; extend the binding struct and conversion as well.
Useful? React with 👍 / 👎.
|
Warning Review limit reached
More reviews will be available in 9 minutes and 10 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
When a turn's model has no entry in the vendored models.dev pricing snapshot,
cost_for_turnreturnsNoneand every summary aggregation counts the turn at $0 — with no signal anywhere. This happens on every new model release until the manual snapshot bump lands (#469, #472), so burn under-reports spend exactly when users adopt a new model. This PR makes the gap visible without inventing numbers:tally_unpriced()inanalyze/cost.rs: counts turns whose model has no pricing entry and collects the distinct model names.lookup_model_ratesemantics are deliberately unchanged — no fallback rates; estimated-but-wrong totals would be worse than a visible gap.unpricedTurns/unpricedModelsonSummaryandSummaryGroupedReport(additive, backward-compatible serde). The grouped tally runs over the same turn slice that feeds the table rows, so the count always agrees with what's displayed.burn summary(stderr, human mode only) when unpriced turns exist, pointing atpnpm run pricing:updateor the$RELAYBURN_HOME/models.dev.jsonoverride. JSON output carries the fields automatically.Merge order
Merge after #473 — this branch carries an identical-content copy of its rustfmt fix (started from the same base before #473 existed); git merges it cleanly.
Verification
tally_unpricedunit tests (dedup, all-priced),compute_summaryfield population, and an end-to-endsummary_reportgrouped test through a real SQLite ledger with an unknown model.-D warnings, 815 SDK tests + full workspace, npm suites (MCP 21/21).Plan:
plans/002-unpriced-turn-visibility.md(advisor-generated, executor-implemented, independently reviewed).🤖 Generated with Claude Code