From 18eb15a69014019b9c092d0ff75811b93548b802 Mon Sep 17 00:00:00 2001 From: Naman Arora Date: Mon, 2 Nov 2026 19:58:15 +0530 Subject: [PATCH 1/2] fix(cli): show the recorded cost in list and show `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. --- CHANGELOG.md | 1 + src/reverse_api/cli.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa65ad..21aabac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `agent --json` and `engineer --json` report `status: error` (`engine_failure`) when the run ends without writing its client, instead of `ok` with a `script_path` that does not exist. - Playwright MCP prompt: `browser_run_code` is now `browser_run_code_unsafe`, and the nonexistent `browser_scroll` tool is no longer listed. - The Claude SDK message buffer is raised to 32 MB, so a large screenshot no longer aborts a run. +- `list` and `show` report the cost of Claude, Copilot and Cursor runs. They read only `total_cost` or `cost`, while those engines record `estimated_cost_usd`, so the cost was always empty. ### Security - Raise security minimums to aiohttp >=3.14.4, certifi >=2026.10.19, multidict >=6.9.1, OpenTelemetry API >=1.45.1, PyJWT >=2.15.0 and urllib3 >=2.8.0, and lock the patched versions. certifi drops the emSign root CAs whose intermediate keys were compromised. diff --git a/src/reverse_api/cli.py b/src/reverse_api/cli.py index 174098c..be2417d 100644 --- a/src/reverse_api/cli.py +++ b/src/reverse_api/cli.py @@ -2289,8 +2289,9 @@ def _get_run_details(run: dict) -> dict: local_path = f"./scripts/{subdir.name}/" break - usage = run.get("usage", {}) - cost = usage.get("total_cost", usage.get("cost")) + # The engines record estimated_cost_usd; OpenCode runs and older entries carry cost or total_cost. + usage = run.get("usage") or {} + cost = next((usage[key] for key in ("estimated_cost_usd", "total_cost", "cost") if usage.get(key) is not None), None) return { "run_id": run_id, From 773577a8609e009d0cc302a5bc98c3152b7e6561 Mon Sep 17 00:00:00 2001 From: Naman Arora Date: Mon, 2 Nov 2026 20:12:41 +0530 Subject: [PATCH 2/2] Clarify the changelog entry: list and show used to read only total_cost or cost --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21aabac..46d782a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `agent --json` and `engineer --json` report `status: error` (`engine_failure`) when the run ends without writing its client, instead of `ok` with a `script_path` that does not exist. - Playwright MCP prompt: `browser_run_code` is now `browser_run_code_unsafe`, and the nonexistent `browser_scroll` tool is no longer listed. - The Claude SDK message buffer is raised to 32 MB, so a large screenshot no longer aborts a run. -- `list` and `show` report the cost of Claude, Copilot and Cursor runs. They read only `total_cost` or `cost`, while those engines record `estimated_cost_usd`, so the cost was always empty. +- `list` and `show` report the cost of Claude, Copilot and Cursor runs. They used to read only `total_cost` or `cost`, while those engines record `estimated_cost_usd`, so the cost was always empty. ### Security - Raise security minimums to aiohttp >=3.14.4, certifi >=2026.10.19, multidict >=6.9.1, OpenTelemetry API >=1.45.1, PyJWT >=2.15.0 and urllib3 >=2.8.0, and lock the patched versions. certifi drops the emSign root CAs whose intermediate keys were compromised.