Repository navigation
feat(codex): report models with missing pricing - #1750
Conversation
Expose unpriced models in JSON totals and mark affected model breakdowns so consumers can distinguish unknown pricing from a real zero cost. Co-authored-by: Saurav Sharma <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change exposes missing pricing in JSON reports. Affected model entries include ChangesJSON Pricing Availability Signals
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant ReportAdapter
participant PricingDetection
participant JSONReport
ReportAdapter->>PricingDetection: evaluate model usage and cost mode
PricingDetection-->>ReportAdapter: missing pricing status
ReportAdapter->>JSONReport: serialize missingPricing and totals
JSONReport-->>ReportAdapter: JSON report with conditional unpricedModels
Merge Risk: ⚪ Minimal · up to The JSON pricing signals and cost-mode behavior are consistent across the supported report paths, with no material merge risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Clippy (1.98.0)Clippy execution failed 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 |
|
@coderabbitai review @cubic-dev-ai review |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 6707f93 | Commit Preview URL Branch Preview URL |
Sep 17 2026, 11:58 AM |
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="rust/adapters/codex/src/report.rs">
<violation number="1" location="rust/adapters/codex/src/report.rs:27">
P2: When Codex runs with `--mode display`, this unconditional attachment still adds `totals.unpricedModels` and `missingPricing` because the report path never receives or checks `SharedArgs.mode`. Pass the cost mode through the report path and suppress both fields in display mode (and in auto mode when a stored cost is available).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
|
|
There was a problem hiding this comment.
ℹ️ No critical issues — one docs wording nit inline.
Reviewed changes — reviewed the full diff for exposing unknown pricing in JSON reports.
- Added
totals.unpricedModels(sorted, deduplicated, present only when non-empty) to generic, unified, and focused Codex totals via sharedunpriced_models/attach_unpriced_modelshelpers. - Marked affected breakdowns with
missingPricing: true, serialized only when true so priced entries keep their shape. - Kept both new fields under
--no-costsince they describe pricing availability, not amounts, with test coverage for the stripping behavior. - Added mode-aware detection tests (zero-rate pricing counts as priced, zero-token usage ignored, stored costs suppress) plus sorted/dedup and sections-scoping tests.
- Documented the new JSON fields, cost-mode interaction, and command coverage in
docs/guide/json-output.md.
Muse Spark Contributor (free via Pullfrog for OSS) | 𝕏
|
Fixed the P2 by passing @cubic-dev-ai review |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git diff --name-status HEAD^ HEAD
printf '\n--- diff stat ---\n'
git diff --stat HEAD^ HEAD
printf '\n--- current commit ---\n'
git show -s --format='%H%n%s%n%b' HEAD
printf '\n--- changed diff ---\n'
git diff --find-renames --find-copies --unified=50 HEAD^ HEADLength of output: 21701 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main)"
printf '%s\n' "--- base: $base ---"
git diff --name-status "$base"...HEAD
printf '%s\n' "--- full diff stat ---"
git diff --stat "$base"...HEAD
printf '%s\n' "--- CostMode definitions and uses ---"
rg -n -C 4 '\benum\s+CostMode\b|\bCostMode::|\bmode:\s*CostMode\b' rust
printf '%s\n' "--- report_from_groups calls ---"
rg -n -C 5 '\breport_from_groups\s*\(' rust
printf '%s\n' "--- outlines ---"
ast-grep outline rust/adapters/codex/src/report.rs --items all --type function --match 'report_from_groups|group_json|codex_missing_pricing_models|totals_json'
ast-grep outline rust/crates/ccusage-core/src/output.rs --items all --type function --match 'unpriced_models|attach_unpriced_models|totals_json|missing_pricing_warnings'
printf '%s\n' "--- complete pull request diff ---"
git diff --find-renames --find-copies --unified=20 "$base"...HEADLength of output: 246814 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- summary aggregation and missing-pricing assignments ---'
rg -n -C 8 '\bmissing_pricing\b|ModelBreakdown\s*\{' rust/crates/ccusage-core/src/summary.rs rust/crates/ccusage-core/src rust/adapters/codex/src
printf '%s\n' '--- standard JSON producers ---'
rg -n -C 6 '\b(totals_json|summary_json|session_summary_json|agent_summary_json)\s*\(' rust/crates/ccusage-core/src rust/crates/ccusage-adapter-all/src
printf '%s\n' '--- relevant core output implementations ---'
sed -n '25,170p' rust/crates/ccusage-core/src/output.rs
sed -n '400,455p' rust/crates/ccusage-core/src/output.rs
printf '%s\n' '--- summary aggregation implementation ---'
ast-grep outline rust/crates/ccusage-core/src/summary.rs --items all --type function --match 'summarize|aggregate|model'
printf '%s\n' '--- serialization and sections implementation ---'
ast-grep outline rust/crates/ccusage-adapter-all/src/report.rs --items all --type function --match 'row_json|agent_json|sections_report_json|totals_json'
sed -n '100,235p' rust/crates/ccusage-adapter-all/src/report.rs
printf '%s\n' '--- no-cost stripping implementation ---'
rg -n -A70 -B5 '\bfn strip_cost_json\b' rust
printf '%s\n' '--- changed-line diagnostics ---'
git diff --check "$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main)"...HEADLength of output: 69020
The I found no actionable issues in the reviewed changes. I did not run repository tests in this inspection environment. ✏️ Learnings added
|
There was a problem hiding this comment.
Important
Focused Codex JSON now respects display mode, but unified reports still flag Codex models as unpriced in display mode.
Reviewed changes — reviewed the delta since the prior pullfrog review (d169b2e7 → fe31750).
- Threaded
CostModethrough focused Codexreport_from_groupsandgroup_json, suppressingtotals.unpricedModelsand per-modelmissingPricingindisplaymode. - Defaulted the hidden
report_jsonhelper toCostMode::Calculateand updated its call sites and tests. - Added
display_mode_omits_missing_pricing_metadatacovering the focused-path suppression.
Muse Spark Contributor (free via Pullfrog for OSS) | 𝕏
|
Fixed the unified-path inconsistency in
Focused adapter tests, Clippy, and pre-push cargo tests pass. @pullfrog review |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the delta since the prior pullfrog review (fe31750 → 6707f93).
- Threaded
shared.modethrough bothload_codex_rowsbranches intocodex_group_row, suppressingmissing_pricingindisplaymode so unified JSON agrees with focused Codex JSON. - Gated the Codex table missing-pricing stderr warning on
shared.mode != CostMode::Display, matching the JSON metadata suppression. - Added
display_mode_omits_codex_missing_pricing_from_unified_jsoncovering the unified-path suppression, and updated existingcodex_group_rowcall sites for the newmodeparameter.
Muse Spark Contributor (free via Pullfrog for OSS) | 𝕏
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the missing-pricing JSON reporting and display-mode suppression in this run.
- Unpriced-model JSON fields:
totals.unpricedModelsplusmissingPricing: trueon affected breakdowns, with sorted/deduplicated output and absent-when-empty semantics. - Codex display-mode suppression: focused Codex JSON, per-model flags, and table warnings now skip missing-pricing metadata in
displaymode. - Unified Codex row fix:
CostModethreaded intocodex_group_rowso unified JSON totals stay consistent with focused reports. - Shared helpers and docs:
unpriced_models/attach_unpriced_modelsreuse,--no-costpreservation, and JSON-output guide coverage notes.
Muse Spark Contributor (free via Pullfrog for OSS) | 𝕏
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main)"
printf '%s\n' "--- HEAD ---"
git show -s --format='%H%n%s%n%b' HEAD
printf '%s\n' "--- base ---"
printf '%s\n' "$base"
printf '%s\n' "--- full diff stat ---"
git diff --stat "$base"...HEAD
printf '%s\n' "--- changed files ---"
git diff --name-status "$base"...HEAD
printf '%s\n' "--- latest commit diff ---"
git diff --find-renames --find-copies --unified=30 HEAD^ HEAD
printf '%s\n' "--- full PR diff ---"
git diff --find-renames --find-copies --unified=15 "$base"...HEAD
printf '%s\n' "--- CostMode and Codex row paths ---"
rg -n -C 8 '\b(CostMode|codex_group_row|load_codex_rows|report_from_groups|group_json|missing_pricing|unpricedModels|attach_unpriced_models|unpriced_models)\b' \
rust/crates/ccusage-adapter-all/src/loader.rs \
rust/crates/ccusage-adapter-all/src/report.rs \
rust/crates/ccusage-adapter-all/src/tests.rs \
rust/adapters/codex/src/lib.rs \
rust/adapters/codex/src/report.rs \
rust/crates/ccusage-core/src/output.rs \
rust/crates/ccusage-core/src/cost.rs \
rust/crates/ccusage-core/src/types.rs
printf '%s\n' "--- structured outlines ---"
ast-grep outline rust/crates/ccusage-adapter-all/src/loader.rs --items all --type function --match 'load_codex_rows|codex_group_row'
ast-grep outline rust/crates/ccusage-adapter-all/src/report.rs --items all --type function --match 'report_json|totals_json|sections_report_json|row_json'
ast-grep outline rust/adapters/codex/src/report.rs --items all --type function --match 'report_from_groups|group_json|print_table_from_groups'
printf '%s\n' "--- diff diagnostics ---"
git diff --check "$base"...HEADLength of output: 196159
The unified Codex path now passes The focused Codex JSON and table paths use the same display-mode behavior.
🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |

Summary
unpricedModelsmissingPricing: true--no-costwhile omitting empty/false fieldsThis carries forward the implementation from #1737 by @ravsau on top of current
main. Saurav Sharma is credited as a co-author on the commit.Fixes #1736.
Validation
cargo fmt --manifest-path rust/Cargo.toml --all --checkccusage-core,ccusage-adapter-all, andccusage-adapter-codexjust testjust typecheckcargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets -- -D warningsjust docs::typecheckjust hawkSummary by cubic
Adds
totals.unpricedModelsandmissingPricing: trueto JSON reports so dashboards can tell "free" from "unknown" pricing. Fixes #1736.Behavior details
displaymode andautomode with a stored cost report nothing.unpricedModelsis sorted, deduplicated, and present only when unpriced usage was detected.--no-costkeeps these fields because they describe pricing availability, not amounts.daily,weekly,monthly,sessionfor all agents, including--instances,--sections,--by-agent. Not covered:blocksandsession --id.Written for commit 6707f93. Summary will update on new commits.
Summary by CodeRabbit
totals.unpricedModels.missingPricing: true; priced models omit this field.0.--no-costand are omitted when pricing checks are not performed.