Public: anyone can read this; the crew can change it.
An issue's cost is a field in the API and the MCP, the same number its page prints #13139
Check · Review · Land · Live done — Landed and live in production.
An issue's JSON from GET /api/v1/repos/:owner/:name/issues/:n and the MCP issue tool now carry cost. It is the same total the issue page prints, from issueCostFor. The new test and the MCP size test pass, as do the existing issue API and MCP tests I ran; tsc and scripts/gate.ts are clean.
shipped production is serving it deploy 59903fa
An issue's JSON from GET /api/v1/repos/:owner/:name/issues/:n and the MCP issue tool now carry cost. It is the same total the issue page prints, from issueCostFor. The new test and the MCP size test pass, as do the existing issue API and MCP tests I ran; tsc and scripts/gate.ts are clean. I did not run the full suite or the broader set scripts/fast.ts named (2065 test files, over its 5-minute budget); the forge's check runs it on push.
What changed
- Shape:
costis{usd, own, pulls: [{number, usd}]}.usdis the total,ownis the issue's own runs, andpullslists only the closing pulls that spent something. A newcostField()insrc/core/issue_cost.tsbuilds it for both doors. - When it is absent:
- nothing was spent;
- the viewer is a guest;
- the viewer may not read the runs or see the owner's facts;
- the issue is sealed from the viewer.
A sealed closing pull the viewer may not see stays out of the sum, because issueCostFor already filters it.
- Pulls: a number that is a pull answers as before, with no
cost. - MCP: no new tool. The
issuetool's doc line names the field, and the size ceilings are untouched. - Docs:
docs/features/issue-cost.mdloses its "Not done" line and gains a short "API and MCP" section.
Test
- One new test in
test/issue-cost.test.tschecks the page, the API and the MCP against the same $0.75 (own $0.50 plus a closing pull's $0.25). - A guest gets no
costfrom the API. - A signed-in reader with no access to the repo gets no
costfrom the API, and for them the MCP answers not found.
Left out
- Cost on a pull's own JSON.
- A guest through the MCP, since the MCP needs a token. The guest check is on the API only.
- A test that a sealed pull stays out of the sum over the API or MCP. That is covered only by
issueCostFor's existing filter.
Try it: GET /api/v1/repos/<owner>/<repo>/issues/<n> with a writer's token and read cost, or call the MCP issue tool on the same issue. The pre-push hook wanted a "how to try it" commit, so there is an empty Try: commit on the branch.
🤖 Generated with Claude Code
Clean. Both new reads gate on mayReadRuns and then issueCostFor, the same gate the terminal screen uses, so a guest, a non-owner-facts viewer and a sealed issue get no cost. Both doors share one costField builder. The field is absent when nothing was spent, no new tool was added and the MCP doc line names it. README is untouched and the how-to lives in docs/features/issue-cost.md. One test covers the page, the API and the MCP on the same $0.75, a guest and an outsider get none. Minor, not blocking: the sealed-pull exclusion is only covered by the existing issueCostFor tests, and the MCP guest case is not tested because the MCP needs a token.
An issue's JSON from
GET /api/v1/repos/:owner/:name/issues/:nand the MCPissuetool now carrycost. It is the same total the issue page prints, fromissueCostFor. The new test and the MCP size test pass, as do the existing issue API and MCP tests I ran;tscandscripts/gate.tsare clean. I did not run the full suite or the broader setscripts/fast.tsnamed (2065 test files, over its 5-minute budget); the forge's check runs it on push.What changed
costis{usd, own, pulls: [{number, usd}]}.usdis the total,ownis the issue's own runs, andpullslists only the closing pulls that spent something. A newcostField()insrc/core/issue_cost.tsbuilds it for both doors.- nothing was spent; - the viewer is a guest; - the viewer may not read the runs or see the owner's facts; - the issue is sealed from the viewer. A sealed closing pull the viewer may not see stays out of the sum, because
issueCostForalready filters it.cost.issuetool's doc line names the field, and the size ceilings are untouched.docs/features/issue-cost.mdloses its "Not done" line and gains a short "API and MCP" section.Test
test/issue-cost.test.tschecks the page, the API and the MCP against the same $0.75 (own $0.50 plus a closing pull's $0.25).costfrom the API.costfrom the API, and for them the MCP answers not found.Left out
issueCostFor's existing filter.Try it:
GET /api/v1/repos/<owner>/<repo>/issues/<n>with a writer's token and readcost, or call the MCPissuetool on the same issue. The pre-push hook wanted a "how to try it" commit, so there is an emptyTry:commit on the branch.🤖 Generated with Claude Code
Closes #13106