feat(harness): stop sharing agent $ cost with the client#871
Conversation
The harness computed the LLM dollar cost (cost_usd) per turn and streamed it to the client in the usage.recorded SSE event, where miot-chat rendered it in the TUI footer as $0.0123. We don't want tenants to see per-query cost. Stop emitting cost_usd to the client and remove the client-side plumbing that displayed it. The dollar cost is still computed and retained server-side (span attribute, eval reports, provenance logs) so we keep tracking our own spend. Token counts remain visible; only the $ figure is removed. Untouched: the Postgres EXPLAIN total_cost (a query-planner estimate, not dollars) in nexo/generic_pg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
|
Tracked by #872. |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@turbo-repo/packages/miot-chat/src/tui/__tests__/transcript.project.test.ts`:
- Around line 478-479: Update the transcript projector test in
transcript.project.test to assert that client-side usage totals do not include
both monetary fields: keep the existing costUsd check and add a matching absence
assertion for lastCostUsd on s2.usageTotals. Use the existing usageTotals
expectation block in the test to ensure the client contract stays free of both
money-related properties.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0b128f6c-ef03-4136-a595-871e621d3918
📒 Files selected for processing (8)
miot-harness/src/miot_harness/observability/callbacks.pymiot-harness/tests/observability/test_usage_recorded_event.pyturbo-repo/packages/miot-chat/src/tui/__tests__/components/FooterLine.test.tsxturbo-repo/packages/miot-chat/src/tui/__tests__/transcript.project.test.tsturbo-repo/packages/miot-chat/src/tui/chrome/FooterLine.tsxturbo-repo/packages/miot-chat/src/tui/session/types.tsturbo-repo/packages/miot-chat/src/tui/transcript/project.tsturbo-repo/packages/miot-harness-client/src/types.ts
💤 Files with no reviewable changes (2)
- turbo-repo/packages/miot-harness-client/src/types.ts
- turbo-repo/packages/miot-chat/src/tui/transcript/project.ts
Symmetric with the costUsd absence check — both monetary fields were removed from UsageTotals, so the client-contract test should verify neither leaks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|



What & why
The harness computed the LLM dollar cost (
cost_usd) per turn and streamed it to the client in theusage.recordedSSE event, where miot-chat rendered it in the TUI footer as$0.0123. We don't want tenants to see how much each query costs us.This stops the dollar cost from ever leaving the server, while keeping it tracked internally so we still measure our own spend.
Changes
Boundary fix (backend)
miot-harness/.../observability/callbacks.py— no longer attachescost_usdto theusage.recordedevent. The cost is still computed and kept as the server-side span attribute (gen_ai.usage.cost_usd), so eval reports and provenance logs are unchanged.Client cleanup (token counts untouched)
miot-harness-client/src/types.ts— droppedcost_usdfromUsageRecordedData.miot-chat/.../session/types.ts— removedcostUsd/lastCostUsdfromUsageTotals+ZERO_USAGE.miot-chat/.../transcript/project.ts— removed cost accumulation.miot-chat/.../chrome/FooterLine.tsx— footer now shows1234→56with no$figure.Left intentionally untouched (internal-only):
report.py,run_golden.pyeval totals,provenance.pyplan_cost, and the PostgresEXPLAINtotal_cost(a query-planner estimate, not dollars).Verification
test_usage_recorded_event.py+test_callbacks.py→ 10 passed (event omitscost_usd; span attribute retained).FooterLine.test.tsx+transcript.project.test.ts→ 29 passed (footer shows tokens, no$).tsc --noEmitonmiot-chatandmiot-harness-client→ exit 0.cost_usd/costUsdreferences remain inturbo-repo.🤖 Generated with Claude Code
Summary by CodeRabbit