Skip to content

fix(cloud-agent-next): round session usage to two decimals - #6046

Merged
eshurakov merged 1 commit into
mainfrom
kilo/jolly-shell-o23
Sep 10, 2026
Merged

fix(cloud-agent-next): round session usage to two decimals#6046
eshurakov merged 1 commit into
mainfrom
kilo/jolly-shell-o23

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Cloud Agent Token Usage on the web was shown to four decimal places (e.g. $1.2346). Round it to cents ($1.23) so session usage matches ordinary dollar display.

  • formatSessionCost now uses two-decimal half-up rounding
  • Component rows still reconcile to the displayed total
  • Amounts below half a cent are hidden instead of rendering $0.00

Verification

  • session-cost-breakdown.test.ts and ChatHeader.test.ts (96 tests) passed via Jest without the PostgreSQL worker setup
  • No manual UI pass in this environment (no local Cloud Agent session)

Visual Changes

Token Usage in the chat header and session info dialog now shows $1.23 instead of $1.2346. Totals under $0.005 no longer appear.

Reviewer Notes

Per-message API request costs still use four decimals; only session Token Usage is two decimals.

Show Token Usage as dollar cents instead of four-decimal amounts, and hide totals that round to $0.00.
@kilo-code-bot

kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Session Token Usage rounding was scaled from four decimals to cents with matching hide-below-half-cent thresholds; tests cover the new precision and I found no correctness issues.

Files Reviewed (3 files)
  • apps/web/src/components/cloud-agent-next/session-cost-breakdown.ts
  • apps/web/src/components/cloud-agent-next/session-cost-breakdown.test.ts
  • apps/web/src/components/cloud-agent-next/ChatHeader.test.ts

Reviewed by grok-4.6 · Input: 102.7K · Output: 10.8K · Cached: 132.9K

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants