Public: anyone can read this; the crew can change it.

MCP make_it_yours undo is a real write: it plans without dryRun:false, and an agent cannot undo #14928

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

MCP makeityours with undo: true now only plans unless dryRun is false, and an agent can no longer undo (#14912, a finding from #14769). Before this, the tool was marked dryByDefault, so the MCP layer treated undo: true without dryRun: false as a read. The undo still deleted the copy.

Notes

shipped production is serving it deploy 6b7374e

opened this

MCP make_it_yours with undo: true now only plans unless dryRun is false, and an agent can no longer undo (#14912, a finding from #14769). Before this, the tool was marked dryByDefault, so the MCP layer treated undo: true without dryRun: false as a read. The undo still deleted the copy. That let a read-only token remove a repository and skipped the confirm fence.

  • src/actions/make_it_yours.ts: undoMakeItYours takes { dryRun }. It checks every refusal it already had (the copy has its own commits, or a pull was sent from it), then returns { dryRun: true, repo, says } and removes nothing unless dryRun is false. It now refuses an agent with invalid, matching makeItYours. The new plan wording is undoPlanWords.
  • src/http/mcp/tools/make_it_yours.ts: passes dryRun: args.dryRun !== false. A real removal is now treated as a write, so a read-only token gets the standard read-only refusal and the confirm fence applies. The tool's doc string and size are unchanged.
  • Page and terminal (src/web/studio/make_it_yours.ts, src/tui/screens/yours.ts): these already ask the person to confirm, so they pass dryRun: false and show the agent refusal's message.

Tests. Both of these fail on the unchanged source:

  • test/make-it-yours.test.ts: an agent's undo of its own fork is refused and the fork is kept; a person's undo plans by default and removes the copy only with dryRun: false.
  • test/explorer-make-it-yours.test.ts: the MCP undo plans and the copy stays; a read-only token gets the plan but is refused the removal. The existing undo calls in this file now pass dryRun: false, because without it they now get a plan; the old tests weren't wrong.

These pass: those two files, test/tui-make-it-yours.test.ts, test/tui-working-yours.test.ts, test/mcp-size.test.ts, test/data-move.test.ts, test/conversation-confirm.test.ts and test/mcp-find-tool-queries.test.ts. The gate, bun x tsc --noEmit and the design lint are clean. scripts/fast.ts named 2282 test files, too broad to run here, so the full suite is left to the forge's check. The explorer test logs one [following] … closed database error while still passing.

Not done. I didn't tick the box on #14769 or keep a plan on this issue: the keep_plan tool wasn't available in this run.

To try: call MCP make_it_yours with { repo, undo: true } on a copy you made. It answers a plan and the copy stays; add dryRun: false to remove it.

[{"go":"/explore?q=kind:app","look":"Make it yours on someone else's app, then Undo on the receipt","expect":"the copy is removed and a flash says it is removed and the original was not touched"}]

🤖 Generated with Claude Code

Closes #14912

3 earlier comments
commented

MCP make_it_yours with undo: true now only plans unless dryRun is false, and an agent can no longer undo (#14912, a finding from #14769). Before this, the tool was marked dryByDefault, so the MCP layer treated undo: true without dryRun: false as a read. The undo still deleted the copy. That let a read-only token remove a repository and skipped the confirm fence.

  • src/actions/make_it_yours.ts: undoMakeItYours takes { dryRun }. It checks every refusal it already had (the copy has its own commits, or a pull was sent from it), then returns { dryRun: true, repo, says } and removes nothing unless dryRun is false. It now refuses an agent with invalid, matching makeItYours. The new plan wording is undoPlanWords.
  • src/http/mcp/tools/make_it_yours.ts: passes dryRun: args.dryRun !== false. A real removal is now treated as a write, so a read-only token gets the standard read-only refusal and the confirm fence applies. The tool's doc string and size are unchanged.
  • Page and terminal (src/web/studio/make_it_yours.ts, src/tui/screens/yours.ts): these already ask the person to confirm, so they pass dryRun: false and show the agent refusal's message.

Tests. Both of these fail on the unchanged source:

  • test/make-it-yours.test.ts: an agent's undo of its own fork is refused and the fork is kept; a person's undo plans by default and removes the copy only with dryRun: false.
  • test/explorer-make-it-yours.test.ts: the MCP undo plans and the copy stays; a read-only token gets the plan but is refused the removal. The existing undo calls in this file now pass dryRun: false, because without it they now get a plan; the old tests weren't wrong.

These pass: those two files, test/tui-make-it-yours.test.ts, test/tui-working-yours.test.ts, test/mcp-size.test.ts, test/data-move.test.ts, test/conversation-confirm.test.ts and test/mcp-find-tool-queries.test.ts. The gate, bun x tsc --noEmit and the design lint are clean. scripts/fast.ts named 2282 test files, too broad to run here, so the full suite is left to the forge's check. The explorer test logs one [following] … closed database error while still passing.

Not done. I didn't tick the box on #14769 or keep a plan on this issue: the keep_plan tool wasn't available in this run.

To try: call MCP make_it_yours with { repo, undo: true } on a copy you made. It answers a plan and the copy stays; add dryRun: false to remove it.

[{"go":"/explore?q=kind:app","look":"Make it yours on someone else's app, then Undo on the receipt","expect":"the copy is removed and a flash says it is removed and the original was not touched"}]

🤖 Generated with Claude Code

commented

The MCP tool make_it_yours called with { repo, undo: true } now returns a plan and removes nothing. The copy is only removed when the call adds dryRun: false. An agent cannot undo at all. This merges main, where #14823 rewrote the same undo function in src/actions/make_it_yours.ts. The conflict is resolved to keep what both sides meant.

  • From main: ownOf decides when a copy holds something of its own and so is kept. That covers branches or tags the original doesn't have, a pull sent from the copy, forks of it, its own issues or secrets, and app variables or a domain. If the delete fails, the copy's app is turned back on under its old name.
  • From this branch: all of ownOf's refusals are checked first. Then, unless dryRun is false, the call stops and returns the plan before the app is switched off. The result also says whether it was a plan.
  • Test change: two cases in the new test/undo-make-it-yours.test.ts from main were written before undo planned by default. They expect a real removal ("a copy with nothing of its own is removed" and "a delete that fails leaves the copy with its app, under its name"), so they now pass { dryRun: false }. The test was out of date, not the code; the refusal cases are unchanged.

bun x tsc --noEmit and bun scripts/gate.ts --fix pass. scripts/fast.ts named 3,363 test files because the merge brings in all of main's changes, so I ran the 18 test files that call make-it-yours instead: 280 pass. Two were not run here:

  • test/quotas-storage.test.ts also fails on this branch before the merge, with "Cannot use a closed database" while copying from a test origin. It doesn't touch undo and is left to the forge's check.
  • test/helpers/cell-looks-e2e.ts is a helper file, not a suite.

To try it: call make_it_yours with { repo, undo: true } on a copy you made. It answers with a plan and the copy stays. Add dryRun: false to remove it.

🤖 Generated with Claude Code

commented

<!-- look-pages 09488df8b7f7 --> Look pages for 09488df, from the gate:

  • look pages (none): this pull changes src/web/studio/make_it_yours.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The MCP tool make_it_yours called with { repo, undo: true } now returns a plan and removes nothing. The copy is only removed when the call adds dryRun: false. An agent cannot undo at all.

Before deleting, undo checks everything a copy can hold of its own, using ownOf from main (#14823): branches or tags the original doesn't have, a pull sent from the copy, forks of it, its own issues or secrets, and app variables or a domain. Any of these keeps the copy. The plan-only answer is returned only after those checks pass, before the app is switched off. If the delete fails, the copy's app is turned back on under its old name.

The undo button on the web page still removes the copy straight away. Its POST handler in src/web/studio/make_it_yours.ts now passes dryRun: false explicitly. A refusal for bad input now shows its own message in the flash instead of "There is nothing to undo."

Two cases in test/undo-make-it-yours.test.ts (from main) were written before undo planned by default and expected a real removal. They now pass { dryRun: false }. The test was out of date, not the code.

The latest commit (97ee2addf) adds a No look: line for the gate's look-pages note. The form and /explore render as before; only the handler and one flash message changed, so there is no page to picture.

Checks: bun x tsc --noEmit and bun scripts/gate.ts --fix pass, and the 18 test files that cover make-it-yours pass (280 tests). Two were not run here:

  • test/quotas-storage.test.ts also fails on this branch before the merge with main, with "Cannot use a closed database" while copying from a test origin. It doesn't touch undo and is left to the forge's check.
  • test/helpers/cell-looks-e2e.ts is a helper file, not a test suite.

To try it: call make_it_yours with { repo, undo: true } on a copy you made. It answers with a plan and the copy stays. Add dryRun: false to remove it.

🤖 Generated with Claude Code

Approved

Undo now plans unless dryRun is false. It is refused for an agent (kind invalid), and a read-only token can ask for the plan but not the removal. The other two callers, the page handler and the TUI screen, pass dryRun: false explicitly. The new tests cover each case, and the pull is green. No markup changed, so the design principles are not touched. One small nit, not blocking: the tool doc string still says undo removes the copy, without saying that it plans first.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs