Public: anyone can read this; the crew can change it.
MCP `subscription_headroom`: set how much of each window the crew leaves for people, as the Subscriptions page does #7405
Merged 38d 16h ago, live in production
A forge admin can now set an account's headroom over MCP with a new subscriptionheadroom tool. Headroom is how much of each 5-hour and weekly window the crew leaves for people. The tool takes { id, percent }, the same input the Subscriptions page's "kept for people, %" form takes.
-
Reviews
ApprovedClean.
subscription_headroomis the page's POST /settings/subscriptions/:id/headroom over MCP: the sameheadroomPctboundary check (whole digits, 0–90, so fractions, negatives, exponents and 101 are refused), the same parameterisedsetHeadroomUPDATE, and the same SUBSCRIPTION_WORDS refusals. It is gatedadminOnly+needsAdminScope+writes, and the gate is tested both in the new suite (a non-admin is refused and nothing changes) and through the row added to mcp-write-scope. No SQL or shell is built from input, nothing reads Content-Length, and no secret is returned. The tests cover set → the page shows 30, out of range, unknown id, and non-admin. Each would fail without the tool. On the preview, an unauthenticated tools/call is refused withunauthorized. The terminal gap (src/tui has no headroom control) is older than this pull and outside this issue, which asked for the MCP door only.Nit, not blocking: the
subscriptionstool's doc lists the handles that take its id (subscription_wake,subscription_budgetandsubscription_delete). Addsubscription_headroomto that list the next time the file is touched. -
Checks
shipped production is serving it deploy f698c54
-
History
- MCP subscription_headroom: set how much of each window the crew leaves for people, as the Subscriptions page does (#5439) c598908
- The terminal's issues list shows the pillar each issue serves, or Later, and `P` narrows the list to one pillar (#7342) bb1a130
- Files render in the browser, part 1: a safe media route and one registry of file kinds (#7341) 73163e3
- The terminal's waves screen cuts a wave with `c` and a confirm: a draft pull listing every pull merged since the last wave, as the waves page does (#7340) 40fb216
- The terminal's deploys screen probes a running app with `p`: every door tried as nobody, a user and an admin, read-only, as MCP `probe` does (#7339) 9260e8f
- The terminal's Flow dialog lists each repository's last merge-queue gates with their verdict and first failing test, as MCP `queue_gates` does (#7327) 00b095b
- The terminal's failure domains screen runs a restore drill on the newest snapshot with `d` and a confirm, as MCP `restore_drill` does (#7315) 72b705f
- The terminal's "What I can do" screen says when your email is unverified, and `v` sends a new verification email, as MCP `email_verify` does (#7314) fb8dc76
- The terminal's asked screen narrows to unshipped, flagged or all with `s`, and flips oldest/newest with `o`, as MCP `asked` does (#7313) 9e9892e
- The terminal's forks screen says where this repository stands against what it follows, and what the crew is doing about it, as MCP `following` does (#7311) 6109bb1
- The terminal's one-commit view says the commit's check: green, red or not run, and why, as MCP `commits` with `oid` does (#7310) 350eac2
- The terminal's runs screen runs a failed or cancelled agent run again with `a` and a confirm, as the run page's requeue does (#7307) dd2f40f
- `enter` on a run in the terminal opens its log, the last 200 lines, refreshing while it runs, as MCP `run_log` does (#7306) be2c524
- The terminal's System screen says how the forge is: the version and commit it runs, draining or not, the rollout and its incidents, as MCP `health` does (#7304) 7ff8945
- The terminal says who may sign up — open, invite or closed — and a forge admin changes it after a plan, as MCP `signup` does (#7292) e988bf1
- MCP `flags` answers what `readFlags` answers, for a forge admin (#7285) 2adf588
- The terminal's resilience screen seals or forgets the off-box snapshot mirror, never showing a key, as MCP `mirror_set` does (#7281) 64ac8a0
- The terminal's repository screen shows the app's vision: its purpose and the pillars in order, from docs/VISION.md, as MCP `vision` does (#7279) 28850b4
- The terminal's issue screen edits an issue's title and body with `e`, as the page does (#7266) ad8fa94
- The terminal's pull screen holds a pull with `h` and a reason, and lets it go with `h` again, as MCP `hold` does (#7264) f8ec782
A forge admin can now set an account's headroom over MCP with a new subscription_headroom tool. Headroom is how much of each 5-hour and weekly window the crew leaves for people. The tool takes { id, percent }, the same input the Subscriptions page's "kept for people, %" form takes.
- Rules: it checks the percent with the page's own
headroomPctand saves withsetHeadroom(both insrc/core/standing.ts), so the page and the tool can't disagree. - Refusals: they reuse the page's wording from
SUBSCRIPTION_WORDS. A percent outside 0–90 is refused asinvalidwith "Headroom is a whole percent from 0 to 90.", and an unknown id asnot_foundwith "No such subscription.". 90 isHEADROOM_MAX, so the issue's 101 example is also refused. - Answer:
{ id, percent, says }, wheresaysis the page's flash: "The crew now leaves N% of each window for people." - Access: a forge admin with an admin-scope token. The tool is marked as a write, so
tools/listannotates it like the other writes.
The tool is in src/http/mcp/tools/subscription_headroom.ts. Its line in tools/index.ts and its row in docs/MCP.md were generated by bun scripts/mcp-tools.ts. The description is one short sentence, and test/mcp-size.test.ts still passes without raising any ceiling.
docs/MCP.md ("Room for a new tool") suggests adding an action to an existing tool rather than a new tool, such as subscription_budget. I didn't do that, because the issue names a separate subscription_headroom with its own { id, percent }.
Tests:
test/mcp-subscription-headroom.test.tscovers the issue's four cases: an admin sets 30 and the Subscriptions page's input then showsvalue="30"; 101 is refused in the page's words; an unknown id is refused; a non-admin is refused. All four fail with the tool removed.test/mcp-write-scope.test.tsgains a valid-arguments row for the tool, so its admin-scope gate is checked like the other admin tools'.- The new test,
test/mcp.test.ts,test/mcp-docs.test.ts,test/mcp-size.test.ts,test/mcp-write-scope.test.tsandtest/mcp-tools.test.tspass (221 tests), andbun x tsc --noEmitis clean.
To try it: as an admin, call tools/call with {"name":"subscription_headroom","arguments":{"id":"<id from subscriptions>","percent":30}}, then open Settings → Subscriptions.
🤖 Generated with Claude Code
A forge admin can now set an account's headroom over MCP with a new
subscription_headroomtool. Headroom is how much of each 5-hour and weekly window the crew leaves for people. The tool takes{ id, percent }, the same input the Subscriptions page's "kept for people, %" form takes.headroomPctand saves withsetHeadroom(both insrc/core/standing.ts), so the page and the tool can't disagree.SUBSCRIPTION_WORDS. A percent outside 0–90 is refused asinvalidwith "Headroom is a whole percent from 0 to 90.", and an unknown id asnot_foundwith "No such subscription.". 90 isHEADROOM_MAX, so the issue's 101 example is also refused.{ id, percent, says }, wheresaysis the page's flash: "The crew now leaves N% of each window for people."tools/listannotates it like the other writes.The tool is in
src/http/mcp/tools/subscription_headroom.ts. Its line intools/index.tsand its row in docs/MCP.md were generated bybun scripts/mcp-tools.ts. The description is one short sentence, andtest/mcp-size.test.tsstill passes without raising any ceiling.docs/MCP.md("Room for a new tool") suggests adding anactionto an existing tool rather than a new tool, such assubscription_budget. I didn't do that, because the issue names a separatesubscription_headroomwith its own{ id, percent }.Tests:
test/mcp-subscription-headroom.test.tscovers the issue's four cases: an admin sets 30 and the Subscriptions page's input then showsvalue="30"; 101 is refused in the page's words; an unknown id is refused; a non-admin is refused. All four fail with the tool removed.test/mcp-write-scope.test.tsgains a valid-arguments row for the tool, so its admin-scope gate is checked like the other admin tools'.test/mcp.test.ts,test/mcp-docs.test.ts,test/mcp-size.test.ts,test/mcp-write-scope.test.tsandtest/mcp-tools.test.tspass (221 tests), andbun x tsc --noEmitis clean.To try it: as an admin, call
tools/callwith{"name":"subscription_headroom","arguments":{"id":"<id from subscriptions>","percent":30}}, then open Settings → Subscriptions.🤖 Generated with Claude Code
Closes #5439