Skip to content

fix(cli): show the recorded cost in list and show - #155

Open
namanarora00 wants to merge 2 commits into
kalil0321:mainfrom
namanarora00:fix/list-show-cost
Open

namanarora00 wants to merge 2 commits into
kalil0321:mainfrom
namanarora00:fix/list-show-cost

Conversation

@namanarora00

@namanarora00 namanarora00 commented Nov 2, 2026 •

Copy link
Copy Markdown

Why

list and show never show a cost for Claude, Copilot or Cursor runs. _get_run_details reads usage.total_cost or usage.cost, but those engines record a run's cost in history as usage.estimated_cost_usd. That was already true when list was added in #47: engineer.py wrote estimated_cost_usd, and other parts of cli.py read it. So list --full, show, and their --json outputs had cost: null for every run except OpenCode ones.

What

  • _get_run_details reads estimated_cost_usd first, then total_cost and cost, so OpenCode runs and older history entries keep working.
  • CHANGELOG entry under Unreleased → Fixed.

Verification

  • list --json, show --json and the show table were checked against history entries recording estimated_cost_usd, cost and total_cost. Each now reports its cost. On main, the estimated_cost_usd entry reports none.
  • pytest: 1231 passed, 10 skipped, same as main. ruff check src tests and mypy src are clean.

This PR and #156 (OpenCode cost) each add lines in the same CHANGELOG section, so whichever merges second will need a small conflict resolution there.


Summary by cubic

Fixes list and show so Claude, Copilot, and Cursor runs display their recorded cost instead of always showing none.

Those engines record cost as usage.estimated_cost_usd, but _get_run_details only read total_cost or cost, so the cost was empty for every run except OpenCode ones. The fix reads estimated_cost_usd first, falling back to total_cost and cost for OpenCode runs and older history entries. Adds a CHANGELOG entry under Unreleased.

Written for commit 773577a. Summary will update on new commits.

View guided diff

RetriggerView in GreptileConfidence Score: 5/5

Safe to merge. The focused checks found no introduced regression in cost selection or rendering.

Summary

list and show now read estimated_cost_usd before total_cost and cost, restoring recorded costs for Claude, Copilot, and Cursor runs while retaining support for older history entries.

  • Run lists and details now show costs from supported history formats.

No actionable issues were found in the changed code. This change is safe to merge.

T-Rex validation blocked

Evidence upload could not be completed because no upload or artifact-publication facility was available. Execution completed, but the authored test source, command captures, and observed outputs remain local files only.

Reviews (1) · Last reviewed commit: "fix(cli): show the recorded cost in list..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread CHANGELOG.md Resolved
`list` and `show` read `usage.total_cost` or `usage.cost`, but the Claude,
Copilot and Cursor engines record a run's cost as `usage.estimated_cost_usd`,
so those runs always showed no cost. Read `estimated_cost_usd` first and keep
`total_cost` and `cost` as fallbacks for OpenCode runs and older history.

This branch has not been deployed

No deployments
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