fix(eval): cost readout counts zero-usage cases as $0 + follow-up ledger capture - #1050
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
…ed (#14) The 44-case eval:quality report printed 'Estimated cost USD: n/a' even with the RAG_EVAL_*_USD_PER_MILLION rates set (PR #1017): every extractive or unsupported case makes no provider call, its per-case estimate was null, and the all-or-nothing total nulled on any null case. A no-usage case costs exactly $0 when rates are configured — null stays reserved for rates-unconfigured, so the total keeps meaning 'cannot estimate'. Aggregation pin added. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
This pull request has been ignored for the connected project Preview Branches by Supabase. |
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe RAG evaluation report now distinguishes zero-cost cases that never contacted the provider from attempted cases with missing usage data. The outstanding-issues tracker advances its identifier and adds six open items. ChangesRAG evaluation cost handling
Outstanding-issues ledger
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2ed9ce125d
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/outstanding-issues.md`:
- Line 48: Fix the unbalanced Markdown strikethrough markers in issue `#015` by
removing or correctly balancing the ~~ delimiters around “6 generation attempts”
and “$2-4”. Ensure only the intended text is struck through and the remaining
description renders normally.
- Line 47: Update issue `#014` in the outstanding-issues document to reflect that
the PR resolves configured-rate and zero-cost eval cost reporting. Move it to
the resolved archive or rewrite the row to describe only any remaining
validation work, ensuring the outstanding-issues report no longer presents the
completed estimator fix as open.
In `@scripts/eval-quality.ts`:
- Around line 1141-1145: Update the estimatedCostUsd calculation in the
evaluation result to distinguish provider calls from cases with no provider
call. Use openAIRequestIds or modelUsed together with an explicit usage-present
signal, rather than hasOpenAIUsage alone, so generated answers with missing
token metadata return null while confirmed no-call cases return $0 and
usage-bearing calls still use estimateCostUsd.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 209d5a86-8960-477e-9b76-80c8a462760f
📒 Files selected for processing (3)
docs/outstanding-issues.mdscripts/eval-quality.tstests/eval-quality.test.ts
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…cile issue IDs Review findings on PR #1050 (Codex P2 + CodeRabbit major, converged): a case that attempted generation but lost the provider response (timeout, missing output) has real-but-unrecorded token spend — keying $0 off hasOpenAIUsage alone would report those as fully priced. $0 now applies only when no request id, no model, and no generation time were recorded; provider-attempted cases without usage metadata stay null (n/a total). Also resolves the ledger merge conflict against #1049's concurrent ID allocation: main's #12-#17 stand, this session's six items renumber to #18-#23 (next-id 024), the cost-readout row is rewritten as post-fix validation only (CodeRabbit), and the unbalanced strikethrough tildes in the E-3d row are fixed (CodeRabbit). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
Uh oh!
There was an error while loading. Please reload this page.
Summary
Two small post-program items:
Cost readout fix (issue #14). Every 44-case canary printed
Estimated cost USD: n/adespite the pricing rates being set since PR #1017. Root cause: extractive/unsupported cases make no provider call, their per-case estimate wasnull, and the all-or-nothing total nulled on any null case — so one extractive answer hid the whole run's spend. A no-usage case costs exactly $0 when rates are configured;nullnow stays reserved for rates-unconfigured, so the total keeps meaning "cannot estimate". One-line change inscripts/eval-quality.tsplus an aggregation pin test (priced + zero-cost cases sum; a genuinely unpriced case still yields n/a).Outstanding-issues capture (#12–#17). The post-program follow-up queue is now durable ledger memory: the monitoring retrieval-depth trio, comparison-class coverage, this cost fix, the parked E-3d residual, the operator metadata-refresh task, and the Sunday 2026-07-26 scheduled-artifact read.
RAG impact: no retrieval behaviour change — eval reporting + docs only; no
src/lib/rag/**edit.Verification
tests/eval-quality.test.ts— 28/28 including the new aggregation pinRisk and rollout
🤖 Generated with Claude Code
https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
Documentation