pr-af icon indicating copy to clipboard operation
pr-af copied to clipboard

budget: total_cost_usd reports $0 after 20 LLM invocations

Open AbirAbbas opened this issue 4 months ago • 1 comments

Same run as the diff_text verification issue: pr-af-go.review, 27 minutes wall clock, metadata.agent_invocations: 20, real OpenRouter completions throughout (harness processes visible, opencode provider) — yet metadata.budget.total_cost_usd: 0 and every cost_breakdown bucket is 0.

Cost ceilings (max_cost_usd) can't enforce anything if actual spend never registers. Looks like harness cost extraction isn't wired for this provider/path on the Go port.

🤖 Generated with Claude Code

AbirAbbas avatar Jul 15 '26 19:07 AbirAbbas

What happened

Additional evidence for #57, which already concerns the Go implementation: on 2026-11-11, pr-af main 30a724585769 returned result.metadata.budget.total_cost_usd as zero in a successful review. Its control-plane usage included paid direct AI calls. Earlier unowned reviews also recorded paid harness usage while result metadata remained zero.

Replication

Compare a completed review's budget metadata with its persisted usage rows. For an offline check, use reasoner fixtures that return a paid harness result and inspect the map delivered to the orchestrator's cost extraction.

Where

go/internal/orch/orchestrator.go: registerCost calls extractCost, which expects cost_usd in phase result maps. For example, runMetaLens in go/internal/reasoners/meta.go discards the returned harness result and returns only the schema map. The orchestrator can add supplied costs; the live phase return path does not supply that usage.

The fix

Connect actual AI/harness usage to the review's budget accounting.

Acceptance

Through pr-af.review with paid-result fixtures, returned budget totals and cost-based stopping must use the supplied spend rather than stay at zero.

AbirAbbas avatar Nov 12 '26 11:11 AbirAbbas