Skip to content

feat: add cost and model to Code Review Processed Reviews screen#277

Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
session/agent_41193b18-3534-4d80-950e-6c291da52ed3
Open

feat: add cost and model to Code Review Processed Reviews screen#277
kiloconnect[bot] wants to merge 1 commit intomainfrom
session/agent_41193b18-3534-4d80-950e-6c291da52ed3

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 17, 2026

Summary

Add cost information and model used to the Code Reviewer "Processed Reviews" screen.

Changes

  • Rename "Code Review Jobs" → "Processed Reviews" in the UI (card title, empty states, alert descriptions) since "Jobs" is an internal term
  • Add cost display: Shows the total cost of each review (formatted from microdollars, e.g. "$0.42") by joining with microdollar_usage via project_id = cli_session_id
  • Add model display: Shows the AI model used (e.g. "claude-sonnet-4-20250514") by joining with cliSessions.last_model
  • Cost and model appear as a new metadata row below timestamps, only when data is available

Files Changed

  • src/lib/code-reviews/db/code-reviews.ts — Extended listCodeReviews query with LEFT JOINs to cliSessions and a microdollar_usage cost subquery; added CodeReviewWithCostAndModel type
  • src/lib/code-reviews/core/schemas.ts — Updated ListCodeReviewsResponse to use the extended type
  • src/components/code-reviews/CodeReviewJobsCard.tsx — Added cost/model display row, helper formatters, renamed title
  • src/app/(app)/code-reviews/ReviewAgentPageClient.tsx — Updated alert text
  • src/app/(app)/organizations/[id]/code-reviews/ReviewAgentPageClient.tsx — Updated alert text

Built for Brendan by Kilo for Slack

- Rename 'Code Review Jobs' to 'Processed Reviews' in the UI
- Join listCodeReviews query with cliSessions for model and
  microdollar_usage for cost data
- Display cost (formatted from microdollars) and model name
  on each review card
- Update alert descriptions in both personal and org pages
completed_at: cloud_agent_code_reviews.completed_at,
created_at: cloud_agent_code_reviews.created_at,
updated_at: cloud_agent_code_reviews.updated_at,
total_cost_microdollars: sql<number | null>`${costSubquery.total_cost}::bigint`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Potential bigint/string vs number mismatch for total_cost_microdollars

sum(microdollar_usage.cost) on Postgres often comes back as a string (and large values can exceed JS safe integer). Typing this as sql<number | null> can make the UI assume it is a number and can also hide precision/serialization pitfalls. Consider returning a string (or bigint) consistently and formatting/parsing at the edge (API/UI), or using a Drizzle mapping helper to coerce to a number safely.

@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 17, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
src/lib/code-reviews/db/code-reviews.ts 220 Potential bigint/string vs number mismatch for total_cost_microdollars
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (5 files)

@olearycrew olearycrew self-assigned this Feb 17, 2026
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.

1 participant