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

NA
11h ago
+4-2

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.

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