Issue cost: what an issue and its pulls spent
An issue's page and its terminal screen say what the issue cost: the dollars its own agent runs spent plus the dollars spent on every pull whose description closes it. It is for people who write to the repository and want to know what a piece of work cost before they look at the whole ledger.
- Web (
/<owner>/<repo>/issues/<n>): under the Runs card, one line,Spent $0.75 over 3 runs, the single statement of the total. When a closing pull spent anything, rows follow:This issuefor the issue's own runs and onePullrow per pull, the pull number linking to the pull. With no runs of its own but a closing pull that spent something, the Runs card is left out and the line stays. - Terminal (open the issue): the same sentence under the Crew card, with
the breakdown after it, for example
Spent $0.75 over 3 runs: this issue $0.50, #12 $0.25.
Rules
- A pull counts when its description closes the issue, read by
closesFromBody(src/core/pulls.ts), in any state:Closes #7counts for #7 and not for #70. Runs are summed fromrun.cost_usd, in US dollars as recorded, rounded to a ten-thousandth. - A pull that closes two issues counts in both, so the issues' totals can add up to more than the repository spent. The repository's total is the usage ledger's.
- The run count is made by the query that sums the dollars (runs on the issue and on each closing pull whose cost is above zero), so N always belongs to the $X; a pull the viewer may not see counts in neither.
- Nothing is shown when nothing was spent.
- The same gate applies on both doors (
issueCostFor,src/core/issue_cost.ts): the viewer must read the repository's runs, see the owner's facts (as the runs list hides cost from other readers), and be allowed to see the issue. A sealed pull the viewer may not see is left out of the sum. A guest sees nothing.
API and MCP
GET /api/v1/repos/:owner/:name/issues/:n and the MCP issue tool carry
cost: {usd, own, runs, pulls: [{number, usd}]}, the number the page prints, from
issueCostFor. The field is absent when nothing was spent, for a guest, and
for a viewer who may not read the runs or see the owner's facts.