Nerudo

Revert a merged pull request from the web app or the remote MCP server

A person signed in to a repository can now revert a merged pull request from its page, and agents on the remote MCP server get the unland tool.

Scripted demonstration

Nerudo could already take back a merged pull request through POST unland on the agent API, the unland tool of the local nerudo mcp, or nerudo unland, all from a terminal. With T-327, which landed as commit 8111bcd in PR #429, a person signed in to a repository can revert from the merged pull request's page, and agents connected to the remote MCP server get the same unland tool.

All four figures come from local runs with fixture data; none shows production. Figures 1 to 3 are a scripted local render of the web app's own pull request view (ChangeDetail) in jsdom, as tests/revert.test.tsx renders it, saved with the app's stylesheet and shot in headless Chromium. Figure 4 is a terminal capture of the remote MCP server's tool code run in Node against a stub Worker that records each request and answers with a fixture receipt. The repository, the person alice and the agent builder are fixtures.

Revert from the pull request page

Merged PR #41 with the Revert this pull request form open: a reason typed, the issue T-9 filled in, and an Open the revert button
Scripted local render of the web app's PR view in jsdom with fixture data, shot headless. Not production.

Figure 1 shows merged PR #41 as alice sees it, signed in. Its Merged box now has "Revert this pull request…". The form says what will happen: the revert is a pull request that merges like any other, CI runs on its batch, it needs the approvals the reverted change needed, and a conflict with later work closes it. It asks why, and for an issue. The issue is already T-9, an open production-signal issue that lists #41, and a hint says so. The Worker chooses that default (signal_task_of in signals.rs): the latest open signal thread that lists the PR. Only open issues are suggested, and the submit button stayed disabled until a reason was typed.

"Open the revert" posts the PR, the reason and the issue to the app API's POST unland as the signed-in person. The Worker builds the revert commit itself, with the person as author, and sends it as PR unland-<seq> from the person's own fork, which it makes on the spot if they have none. It checks the issue, a frozen repository and storage before it writes anything to trunk. A repository that requires signed commits, or a read-only mirror of another provider, shows a sentence saying why instead of the form: the sequencer cannot sign for the person.

Queued revert PR #42 whose Reverts box links #41 and the commit it merged as
Scripted local render of the web app's PR view in jsdom with fixture data, shot headless. Not production.

Figure 2 is the revert's own page, #42, while it waits in the queue. The Reverts box in the sidebar links #41 and names the commit it merged as and its seq. The description follows the commit body that nerudo-core's unland::message writes.

The Merged box of PR #41 while its revert waits, after it closed, and after it merged
Scripted local render of the web app's PR view in jsdom with fixture data, three states stacked; the uppercase headings are capture labels. Not production.

Figure 3 stacks the Merged box of #41 in three later states; the uppercase headings are labels added for the capture. While the revert waits, the box says "Being reverted by #42" and offers no second form. Once the revert has closed, after a conflict or a failed CI run, it says so and offers "Send the revert again…". After the revert merged, it reads "Reverted by #42, merged at #9."

Sending again works differently now. Before, only the fork that sent a revert's first revision could send the next. Now anyone who may revert sends it from their own fork: the sequencer builds the commit, so the first fork owns nothing in it. To keep that safe, land refuses the change id unland-<n> unless it comes from POST unland, and an in-memory lock lets one request at a time build a landing's revert. Each revision's commit sits on trunk under refs/heads/nerudo-unland/<seq>-<rev>; that ref is now deleted when the revision closes, lands or is refused.

The same tool on the remote MCP server

Terminal output of the remote MCP server's unland tool called as a person and as an agent, with the requests it sent
Terminal capture of the remote MCP server's tool code run locally in Node against a stub Worker with a fixture receipt. Not production.

Figure 4 runs the unland handler of cf/nerudo-mcp, the server agents reach by URL. Its tool list now carries unland with the arguments of the local tool except wait_s (an agent follows the revert with receipt), plus the repo every remote tool takes. Its annotations mark it as not read-only, not destructive and not idempotent. Signed in as a person, the tool checks access, then posts to the app API with the person's headers and no as. Signed in as an agent, it posts to the agent API with as set to the agent. Both answers name the landing, the revert PR and its commit, then the receipt. A call naming both a seq and a PR is refused before any request.

Limits

No Worker ran for these figures. The receipts and page data are fixtures, so the figures show what the web app and the MCP server do with the Worker's answers, not the answers themselves. The Worker side is described from its code: building the commit, making the person's fork, cleaning up refs, and the lines it adds to the reverted PR's timeline, which no figure shows. Its runtime suite, scripts/test-unland-runtime.mjs, needs a Rust build of the Worker that this capture could not make; the commit message reports it passing, and it was not rerun here. The app's revert tests (6) and the MCP server's suite (67) passed locally.

The opener line on a person's revert still carries the "agent" tag, as the page shows for every opener. The Revert action is on the pull request page only; this change adds none to the activity and history views. A revert deploys nothing: deploying the reverted main is still a separate step.

Walkthrough details

Local runs with fixture data (repository shop, person alice, agent builder); nothing from production. The web app's ChangeDetail view rendered in jsdom as tests/revert.test.tsx renders it, saved as static pages with the app's stylesheet and shot in headless Chromium. The remote MCP server's tool code run in Node against a stub Worker that records requests and answers with a fixture receipt, captured in a clean terminal session. No Worker ran: the Worker's side is described from its code.

  1. Render merged PR #41 for signed-in fixture person alice, open Revert this pull request, and type a reason; read the default issue and the submit button's state.
  2. Render PR #41 with its revert queued, closed and merged, and stack the three Merged boxes.
  3. Render the revert PR #42 with the reverts field and read its Reverts box.
  4. List the remote MCP server's tools and read the unland entry's arguments and annotations.
  5. Call unland as a person and as an agent against the stub Worker and record each request and answer; call it with both seq and change.

Captured · Product view · Verification source