# Opening the revert PR For the caller, only on `action: revert`. Step 2 is Read tier, every other step Propose. The revert PR is a proposal: a human decides whether to merge it or fix forward, so never merge or approve it, and never commit to the default branch directly. `` is the merged PR's number; `` is the default branch, the merged PR's base. The `rtk git` commands below are the ones `git-worktrees`, `git-commits` and `git-remotes` run: load those skills for their rules and run these commands as written. The PR steps go through `gitea-prs`. Any step failing → stop with the step and its error; leave a half-made branch for the human, but always remove the worktree (step 8). Start with `rtk git fetch origin`: every step below reads `origin/` and the merge commit from the local history. 1. **Earlier revert PR.** List PRs in every state whose head branch is `revert/pr-`: - open → a relaunch already opened it: skip to step 7; - merged → stop with "already reverted by ": the delivery chain ends there; - closed unmerged, and the `revert/pr-` branch still exists on the remote → stop with "closed revert PR left branch `revert/pr-`"; - none, and `revert/pr-` exists on the remote → stop with "branch `revert/pr-` exists with no revert PR"; - otherwise → go on. "Exists on the remote" is `rtk git ls-remote --heads origin revert/pr-` printing a line; never a local tracking ref, which a plain fetch does not prune. 2. **Shape.** `rtk git rev-list --parents -n 1 `: two parents → a merge commit, revert with `-m 1`; one parent → a squash, revert without `-m`. `delivery-verify` already stopped on a several-commit squash or rebase merge. 3. **Worktree.** Add a temporary worktree outside the operator's checkout on branch `revert/pr-` from `origin/`. A local `revert/pr-` with no remote branch is a stopped earlier run's leftover, never pushed: recreate it with `-B`, not `-b`. Never switch the operator's own checkout. Every git command below runs in the worktree (`rtk git -C …`). 4. **Revert.** `rtk git -C revert [-m 1] --no-commit `. A conflict → `rtk git -C revert --abort`, stop with "revert of `` conflicts with the default branch". 5. **Commit**, the message through a quoted heredoc so no backtick or `$` in the title is expanded; never `-m`: ```bash rtk git -C commit -F - <<'EOF' revert: (#) Reverts merge commit : delivery verify failed. Refs: # EOF ``` No `Delivery-Stage` trailer: the test-path check then has nothing to judge. Hooks run; a hook failure is a stop, never `--no-verify` or `SKIP=`. 6. **Push** `revert/pr-` with upstream tracking, then open the PR: title `Revert ""`, base ``, body naming PR #, the merge commit and the tied failures in one line each, then: - "Merging this re-runs only the workflows whose path filters its diff matches. A workflow that applies the whole tree (an Ansible Provision run, for example) may not re-run, so check the live state after merging." - "The verify report is on #. Merge this only after deciding against a fix forward." No `Closes`: the issue stays closed. 7. **Label** the revert PR `Status/Ready for Human`. Post no Handoff comment on it: it leaves the delivery chain, and its own CI (the dry run included) runs as on any PR. 8. **Clean up.** Remove the worktree, whether the steps above finished or stopped. The branch stays. Return the revert PR's URL; it goes in the report's Output links.