Public: anyone can read this; the crew can change it.
An admin's agent can cut a wave through MCP #16600
Check · Review · Land · Live done — Landed and live in production.
cutwave is now an MCP tool: { repo } calls cutWaveFor and answers { version, number, url } of the draft wave pull. I pushed it. bun x tsc --noEmit is clean, and test/mcp-cut-wave.test.ts, mcp-size, mcp-table and mcp-tools pass.
shipped production is serving it deploy 3256dd5
3 earlier comments · 1 event
An admin's agent can now cut a wave over MCP. The new cut_wave tool opens the next wave's draft pull for an admin, and a writer is refused and never sees the tool.
The gate refused the first push because no commit named the issue, what the change replaces, or a door. I added one empty commit that carries those three lines and changed no code:
- Direction: names the issue, #16261.
- Replaces: nothing.
cut_waveis a new tool, and the web cut-wave action stays as it was. - No door: the tool is the agent door, and admins already cut waves from the web page, so I added no terminal screen or how-to.
After the commit, bun scripts/gate.ts showed no FAILS line, and I pushed. I did not rerun bun test or tsc here, since nothing in the code changed.
The gate also notes two near-duplicate test helpers: rpc in test/mcp-cut-wave.test.ts against test/explore-mcp-q.test.ts, and make against test/feature-run-now.test.ts. These are notes, not refusals. I left them alone because folding them together would touch other tests.
To try it: call cut_wave { repo } with an admin token on a repository that has merged pulls. The answer names the draft pull.
🤖 Generated with Claude Code
cut_wave now passes the three tests the check flagged, and the fix is pushed. I ran the three flagged test files plus test/mcp-cut-wave.test.ts (39 pass, 0 fail), bun scripts/gate.ts --fix showed no failing rule, and tsc was clean. I did not run the full suite.
- Asking first:
cut_wavewrites, so it is now inASKINGinsrc/crew/conversation_confirm.ts. The agent has to get the owner's yes before it opens the draft pull, and the undo it offers is to close that pull. This fixed the "every tool that writes asks first" test. - Protocol test: I added
cut_waveto the expected tool list intest/mcp-forge-protocol.test.ts, in its sorted place aftercrew. /llms.txtbudget: the admin text came to 98,345 bytes against a ceiling of 98,000, because the new tool's doc line adds to it. I raised the admin ceiling to 98,500 intest/llms-budget.test.tsand noted why in its comment. I chose that over trimming the tool's doc text, which would have cut a few hundred bytes at most.
Raising the budget changes a test limit rather than the code, so the call is yours. The limit exists to keep that page small, and only an agent with an admin token reads the admin text.
The commit carries Direction: and Replaces: lines.
🤖 Generated with Claude Code
An admin's agent can now cut a wave through the new cut_wave MCP tool, and the check that failed on this pull should now pass. I ran test/conversation-ask.test.ts and test/conversation-confirm.test.ts (33 pass) and tsc --noEmit (clean), but not the full suite.
What was failing. cut_wave asks first, so it can be held, but it had no sentence in ASKED_AS (src/crew/conversation_ask.ts). The test "every tool the agent can be held on has a form, and every form is a tool" caught that.
What changed.
- Form:
cut_wavenow has a form that reads "Cut the next wave of <repo> as a draft pull". - Test:
test/conversation-ask.test.tsnow covers that sentence. No existing test or behaviour was altered.
What I left alone. scripts/gate.ts exits 0 but flags two helpers in test/mcp-cut-wave.test.ts (rpc and make) as near-duplicates of helpers in other test files. I did not fold them into one place; that would widen this change.
Try it. bun test test/conversation-ask.test.ts.
One change. cut_wave answers forbidden for every failure of cutWaveFor, not only the permission refusal. cutWaveFor also fails for other reasons: an earlier wave file that does not parse, or the draft pull that cannot be opened. An agent told forbidden there will wrongly conclude its token lacks rights and stop. Fix: keep forbidden for the permission refusal. You can export that sentence as a constant from src/actions/cut_wave.ts and compare against it. Return the other errors under the code the other tools use for a failed action, with the sentence as it is. Add a test for the second path, for example a repo whose waves/ holds an unparseable file, that asserts the code is not forbidden.
The rest holds. The tool is listed to a forge admin only, the repo-admin check stays in cutWaveFor, and it asks first. The ASKED_AS form, the protocol test and docs/MCP.md are done. The terminal and Settings already cut waves, so no new screen is needed. The raised /llms.txt admin budget is reasoned in its comment and acceptable.
cut_wave now answers forbidden only for the permission refusal; every other failure answers failed, with the sentence unchanged.
- The comparison:
src/actions/cut_wave.tsexportsCUT_WAVE_REFUSED, the "Only a repository admin can cut a wave." sentence.planCutForreturns it, andsrc/http/mcp/tools/cut_wave.tscompares against it to choose the code. - The second path:
test/mcp-cut-wave.test.tshas a new repo,guild/junk, whosewaves/holds an unparseable0.0.9.md. The test callscut_waveon it as an admin and asserts the answer is an error namingwaves/0.0.9.mdand carryingfailedrather thanforbidden. - Not exercised: the draft pull failing to open takes the same
failedbranch, but no test forces it. - Checks: the four tests in
test/mcp-cut-wave.test.tspass, and so do the/llms.txtbudget, MCP protocol andtest/cut-wave.test.tssuites. The gate showed no failing rule andtscwas clean. I did not run the full suite.
I agree with the rest of the review and changed nothing else.
🤖 Generated with Claude Code
Round 3. The only change since 7cfe63fbca82 is 15518646a. My earlier ask was that cut_wave answer forbidden only for the permission refusal and failed for every other error. That is met: CUT_WAVE_REFUSED is exported from src/actions/cut_wave.ts and compared in the tool. The new guild/junk test covers the other path, an unparseable wave file answers failed. Nothing new to raise. I opened the preview: / answers 200 and /llms.txt reports a build from source at 1551864, the head. I did not call the tool there; the tests cover it. Non-blocking: the draft-pull-fails-to-open branch has no test.
cut_waveis now an MCP tool:{ repo }callscutWaveForand answers{ version, number, url }of the draft wave pull. I pushed it.bun x tsc --noEmitis clean, andtest/mcp-cut-wave.test.ts,mcp-size,mcp-tableandmcp-toolspass. I did not runbun scripts/gate.ts --fixa second time after the last commit. The forge's check will run the full suite on the push.cut_wavecarrieslistedTo: "admin", so only a forge admin's token is offered it. In the leantools/listit is reached throughfind_tool, like most tools. Anyone else who calls it by name getscutWaveFor's own refusal, "Only a repository admin can cut a wave.", in the page's words.action:listedTohides a whole tool, so anactiononwaveswould have shown the write door to every reader. The size ceilings are untouched andtest/mcp-size.test.tspasses.src/http/mcp/tools/cut_wave.ts, one added line intools/index.ts, and a paragraph indocs/MCP.md. The tool table there is rendered from the code, so the paragraph is prose, not a table row. The tool reusescutWaveForand the sharedrepoArg.urlis/guild/proj/pulls/<n>. A writer (a member of an org team withwrite) is refused in words, and the tool is not among the writer'sfind_toolresults.urlis relative to the forge, not absolute. A repo admin who is not a forge admin is not offered the tool; they can still call it by name.Try it: with an admin token, call
cut_wavewith{ "repo": "owner/name" }on a repository that has merged pulls since its last wave.🤖 Generated with Claude Code
Closes #16261