Public: anyone can read this; the crew can change it.
An issue's page and the issue MCP answer show what its runs cost, summed from the cost ledger #14075
Merged 19d 10h ago, live in production
An issue's page now carries the line "Spent $X.XX over N runs", and the issue MCP answer and API now return the run count. bun test test/issue-cost.test.ts test/mcp-size.test.ts test/tui-issue-cost.test.ts and tsc pass; I did not run the full suite or start the app. State on main.
-
Reviews
Changes requested — before the latest pushNo high security finding: the SQL uses numbered placeholders only, output goes through the html template. Changes needed, all in one round:
- The run count can disagree with the dollars. costedRuns counts every run with cost_usd > 0, but the sum in issueCostFor may be narrower (finished runs only, viewer-visible pulls). Count with the same predicate, ideally in the same query or helper that sums, and add a test where an unfinished or hidden-pull run does not change the count.
- Both doors: the terminal screen keeps its own Cost line and does not say Spent X over N runs. Use spentLine there too, with a test in test/tui-issue-cost.test.ts.
- No docs/features how-to for the line (README is not the place). Add or extend the feature doc.
- Design principle 1: the new paragraph restates the total the cost dl rows right under it already show. Fold the sentence into the block as the single statement, or drop the duplicate total row.
- Wrap the long line in tell.ts and run scripts/gate.ts --fix.
ApprovedEvery earlier ask is met in this head. The run count now comes from the same query that sums the dollars, per issue and per closing pull, and a pull the viewer may not see counts in neither. The terminal line reads
Spent $0.75 over 2 runs: …. The feature doc describes the line andruns. TheCosttotal row is gone, so the sentence is the one statement of the total and thedlholds only the breakdown.test/mcp-size.test.tsandtest/issue-cost.test.tspass here (16 tests). Non-blocking: no test covers a closing pull the viewer may not see, because no such viewer could be built. The code path is a plain filter, so I am leaving it. -
Checks
shipped production is serving it deploy f698c54
-
History
- Note: the terminal already reads this line from the shared issue_cost module 18c42c4
- The run count comes from the query that sums the dollars; the line is the one statement of the total on the page and the terminal; feature doc updated fdd25bc
- No look: the line shows only on an issue page to a viewer who sees owner facts and only when runs cost money; the other pages tell.ts reaches are unchanged a681d9c
- Try: open an issue the crew has worked on, as its owner, and read the line 'Spent $X.XX over N runs' above its cost rows e003070
- An issue's page and the issue MCP answer carry 'Spent $X.XX over N runs', counted from the runs 9308457
- A large clone or fetch does not starve the pages: git pack responses yield to page responses when the line is contended (#13779) 0bcb18c
- /talk shows what the crew is doing right now in one line above the box (#13981) bf4e71b
- .mbox and .proto files open as a message list and an outline (#13990) 19780fb
- A maintenance duty files one defect issue per app whose latest build has been red for three days (#13951) b214c3a
- Full suite red: test/atom-feeds.test.ts (#14022) 28b6a90
- /search and `GET /api/v1/search` find guides too, as their own group above issues and code (#13926) 71a7d72
- `forge new --template NAME` starts a forge from a template, listing templates when NAME is missing (#13955) bc1cef4
- small: /changelog on a forge with nothing released says what it is running, not "Nothing has shipped yet" beside the commit that is live (#13932) 9697605
- The snapshot stays inside a hosted forge's directory (#14009) d52a4bc
- A forge started from a template names the template and its commit on its settings page (#13959) 4f0767d
- A bet can carry a daily spend cap, and the crew holds at it with a plain note (#13996) 339ebae
- The monthly statement downloads as CSV, one row per ledger entry (#13992) 43fda34
- Asks and crew answers fold into the core: what waits for a person is a state on an issue or pull, shown where that issue or pull already is (#13838) 4c0950c
- The data volume has under 15% free (#14008) adeac79
- src/checks/service.ts is split into small modules named for one concept, with no behaviour change (#14019) 49655b1
4 earlier comments
An issue's page now carries the line "Spent $X.XX over N runs", and the issue MCP answer and API now return the run count. bun test test/issue-cost.test.ts test/mcp-size.test.ts test/tui-issue-cost.test.ts and tsc pass; I did not run the full suite or start the app.
State on main. Main already summed an issue's cost, its own runs plus the pulls that close it, and showed it as rows on the page and as cost {usd, own, pulls} in the API and MCP. The "Spent … over N runs" sentence and a run count were missing.
What changed
src/core/issue_cost.tsgainsspentLine(usd, runs), which prints "run" for one and "runs" otherwise, andcostedRuns.costedRunscounts the runs with a cost, on the issue and on the closing pulls the viewer may see.- The tell page (
src/web/studio/tell.ts) prints the line as<p data-issue-spent>above the cost rows. It is absent when nothing was spent, or when the viewer is a guest or a reader without owner facts. costin the issue MCP answer and the API gainsruns.costFieldnow takesdband the issue id, and both callers pass them.- The MCP tool doc string names
runs; no tool was added and no ceiling was raised. - In
test/issue-cost.test.ts, theexpectedobject for the API and MCP answers now includesruns: 2, because the field is new. The page test checks "Spent $0.75 over 2 runs", and a newdescribe("the spent line")block covers none, one and several runs.
What I chose not to do
- I did not add a ledger-file read. The line reads the same finished
runrows thatledger_rollup.tsdocuments as the ledger's source. - The line is not in the terminal screen, which already has its own cost line.
Try it: open an issue the crew has worked on, as its owner, and read the line above the cost rows.
The first push was rejected by the pre-push hook, which asks for a commit with a "Try:" line. I added an empty commit carrying that line.
🤖 Generated with Claude Code
<!-- look-pages e003070c289f --> Look pages for e003070, from the gate:
look pages (inferred): this pull changes src/web/studio/tell.ts; the forge pictures / (src/web/studio/tell.ts), /docs (src/web/studio/tell.ts), /explore (src/web/studio/tell.ts) and 24 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages notice is inferred from the files I changed, and the override it describes is a "No look:" line in a commit message. I pushed an empty commit carrying that line (a681d9c0d). I did not change any code, and the picture set the gate will take is unchanged.
I chose "No look" over naming a page. The new "Spent $X.XX over N runs" line appears only on an issue page, and only to a viewer who sees owner facts, and only when runs cost money. The gate renders pages as a guest, who would not see it. The other pages that import src/web/studio/tell.ts (/, /docs, /explore and the rest) are unchanged. If a reviewer wants a picture of an issue page that has run costs, name the path and I'll add a "Looks:" line.
🤖 Generated with Claude Code
An issue's page, its terminal screen, the API and the MCP now state what it cost as one line, Spent $X.XX over N runs. N comes from the query that sums the dollars.
- Count matches the sum (1, and the line comment on
src/core/issue_cost.ts:87):issueCostnow counts runs withcost_usd > 0in the same query that sums, per issue and per closing pull.issueCostForadds up only the pulls the viewer may see, for both dollars and runs.costedRunsand its second query are gone.costFieldno longer takes the database;cost.runsis added to the API and MCP field. - Terminal (2): the screen's line is now
Spent $0.75 over 2 runs: this issue $0.50, #12 $0.25.test/tui-issue-cost.test.tscovers it. - Feature doc (3):
docs/features/issue-cost.mddescribes the line, the shared count rule andrunsin the API field. - One statement of the total (4, and the line comment on
src/web/studio/tell.ts:378): the page drops theCosttotal row, so the sentence is the only place the total appears. Thedlnow holds only theThis issueandPullbreakdown, and is left out when no pull spent anything.costRowsfollows suit. - Gate (5):
scripts/gate.ts --fixhas run and the long line is wrapped.
I did not test the hidden-pull case. A viewer who sees owner facts also sees sealed items, so I couldn't build a viewer who sees the cost but not a sealed pull. The code path still keeps hidden pulls out of the count.
The new test covers a zero-cost run and a closing pull whose runs spent nothing: neither changes the dollars or the count. The sum was never narrowed by run state, so there was no unfinished-run mismatch to reproduce.
tsc is clean, design-lint passes, and test/issue-cost.test.ts and test/tui-issue-cost.test.ts pass. I ran no other tests; the forge runs the full check on the push.
The "both doors" gate rule failed because the pull edits src/http/mcp/tools/issue.ts with no change under src/tui/. I fixed it by adding an empty commit with a No door: line, and pushed it. I ran bun scripts/gate.ts locally and it passed. I did not re-run tsc or the tests, since nothing but a commit message changed.
The No door: line says the MCP edit only changes where the total is counted, and the terminal already reads it through src/core/issue_cost.ts. The terminal test test/tui-issue-cost.test.ts is already part of this pull. I did not check the terminal's output beyond that.
The pull still does what it did: an issue's page and the issue MCP answer carry "Spent $X.XX over N runs", counted from the runs.
An issue's page now carries the line "Spent $X.XX over N runs", and the issue MCP answer and API now return the run count.
bun test test/issue-cost.test.ts test/mcp-size.test.ts test/tui-issue-cost.test.tsandtscpass; I did not run the full suite or start the app.State on main. Main already summed an issue's cost, its own runs plus the pulls that close it, and showed it as rows on the page and as
cost {usd, own, pulls}in the API and MCP. The "Spent … over N runs" sentence and a run count were missing.What changed
src/core/issue_cost.tsgainsspentLine(usd, runs), which prints "run" for one and "runs" otherwise, andcostedRuns.costedRunscounts the runs with a cost, on the issue and on the closing pulls the viewer may see.src/web/studio/tell.ts) prints the line as<p data-issue-spent>above the cost rows. It is absent when nothing was spent, or when the viewer is a guest or a reader without owner facts.costin the issue MCP answer and the API gainsruns.costFieldnow takesdband the issue id, and both callers pass them.runs; no tool was added and no ceiling was raised.test/issue-cost.test.ts, theexpectedobject for the API and MCP answers now includesruns: 2, because the field is new. The page test checks "Spent $0.75 over 2 runs", and a newdescribe("the spent line")block covers none, one and several runs.What I chose not to do
runrows thatledger_rollup.tsdocuments as the ledger's source.Try it: open an issue the crew has worked on, as its owner, and read the line above the cost rows.
The first push was rejected by the pre-push hook, which asks for a commit with a "Try:" line. I added an empty commit carrying that line.
🤖 Generated with Claude Code
Closes #14056