feat(delivery): add the verify stage: delivery-operator and delivery-verify

delivery-operator (opus; no Edit, Write, NotebookEdit or Agent) is the
verify-stage lead. After a human approves and merges, it reads the
delivery doc at the merge commit's first parent, proves its kubeconfig
cannot write (four auth can-i probes), loads the routed tool skills and
runs delivery-verify. It posts the operator report as its own comment,
then the final Handoff (Next command none on pass).

delivery-verify:
- stops first if the change was already reverted;
- waits for Flux through flux-diagnose's Applied check (15-minute cap)
  and reads post-merge CI per workflow through delivery-ci-checks
  (45-minute cap), accepting a later cumulative run as cover;
- checks the PR's post-merge assertions with Read-tier commands only;
- ties a failure to the change only when that is established, and
  otherwise stops. A tied failure opens a revert PR (Ready for Human,
  built in a temporary worktree); it never reverts on its own.
For Flux the guarantee is bounded: the merge commit applied and the
inventory HelmReleases are Ready. The assertions prove a values or chart
change took effect.

The delivery doc format gains a seventh parsed section, Post-merge
checks (glob -> push-event status names, or none when Flux pulls the
change), so delivery-repo-doc goes to 0.2.0. delivery-ci-checks takes a
caller check list and wait cap; delivery-handoff carries the verify
stops.

delivery 0.6.0.

Refs: #194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-24 20:35:04 +00:00
1 parent 277d6f5826
commit 5081206c45
19 files changed
+788 -34

No files matched your search

@@ -0,0 +1,30 @@
# Checking for a revert
A merged revert undoes this change, so a pass read after it describes a state that no longer
holds, and a later commit that carries the revert shows nothing about this change. Run this check
in Step 1, before any waiting, and again where `references/apply-wait.md` and
`references/post-merge-ci.md` say so: a revert can land during a wait. `<n>` is the PR's number,
`<base>` its base branch.
1. **Revert PRs.** `mcp__gitea__list_pull_requests`, state `all`, every page. Keep those whose head
branch is `revert/pr-<n>`. A merged one is a revert; keep its URL. Remember any open one: a pass
names it so the human closes it (`references/report.md`).
2. **Revert commits.** `rtk git fetch origin`, then list the commits on the default branch after
the merge commit whose message reverts it, oldest first:
```bash
git log --reverse --format=%H -F --grep='Reverts merge commit <merge commit>' --grep='This reverts commit <merge commit>' <merge commit>..origin/<base> # ADR-0023: parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Full 40-character
SHA in both patterns. Not `--first-parent`: a revert PR merged with a merge commit puts the
revert on the second parent. The first SHA listed is the **revert commit**.
A merged revert PR or a revert commit → stop with "already reverted by <URL>": the PR's URL, else
the revert commit's (`<forge origin>/<owner>/<repo>/commit/<SHA>`).
## At or after a revert
A commit `<c>` is at or after the revert when `rtk git merge-base --is-ancestor <revert commit> <c>`
exits 0. Such a commit never covers a check and never counts as superseding the merge commit: it
carries the undo, not the change.
@@ -0,0 +1,105 @@
# Waiting for a pulled apply
A pulled path applies when Flux pulls the merge commit, not when CI runs. `flux-diagnose`'s
Applied check owns the wait: its reads, its pauses and its cap. This file only picks the
Kustomizations to ask about and maps the answers.
## Preconditions
Each of these is a stop with the quoted reason:
- The caller passed kubeconfig `none` → "no cluster access for pulled paths".
- `flux-diagnose` is not loaded (no loaded tool skill covers Flux) → "no tool skill loaded for
pulled paths: `flux-diagnose`".
- A tool skill reports no cluster access → "no cluster access: <its words>". Never look for
another kubeconfig or credential.
## Find the Kustomizations
1. `rtk git fetch origin`: the Applied check's ancestry test needs the merge commit and every
commit after it in the local history.
2. List the GitRepository sources with their URLs; `flux get sources git` does not print URLs:
```bash
KUBECONFIG=<path> kubectl get gitrepositories -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"|"}{.spec.url}{"\n"}{end}'
```
Keep those whose URL names this repo: same host, owner and name, ignoring case, scheme, user
and a trailing `.git` (`ssh://git@host/owner/name.git` and `git@host:owner/name` both match).
3. List the Kustomizations with their sources and paths:
```bash
KUBECONFIG=<path> kubectl get kustomizations -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"|"}{.spec.sourceRef.kind}{"|"}{.spec.sourceRef.namespace}{"|"}{.spec.sourceRef.name}{"|"}{.spec.path}{"\n"}{end}'
```
Keep those whose source is a `GitRepository` kept in step 2. An empty source namespace means
the Kustomization's own namespace. None kept → stop with "no Flux Kustomization sources this
repo".
4. Wait on the kept Kustomizations whose `spec.path` contains a changed path: the changed path
lies at or under it, after dropping a leading `./` and a trailing `/` (an empty path or `./`
is the repo root and contains every path). None matches → wait on every kept one: a
Kustomization can render files outside its own path through its `kustomization.yaml`.
## HelmRelease scope
Pass the Applied check no HelmRelease list, so it checks every HelmRelease in each waited
Kustomization's own inventory; the Kustomizations are already narrowed by changed path. A list
narrowed to releases whose manifest changed passed failures in releases whose values changed; an
unrelated release mid-upgrade now only causes a `pending` stop, which is safe. The check still
cannot see a change that reaches a release without a spec change: §No spec change catches some.
Which failing release is this change's is `references/attribution.md` §HelmRelease's job.
## Run the Applied check
For each Kustomization, one after another, invoke `flux-diagnose`'s Applied check with its name
and namespace, the full 40-character merge commit SHA, the kubeconfig path and a cap, and no
HelmRelease list. The cap is 15 minutes for the whole wait, shared: each call gets 15 minus the
pauses the earlier calls reported. A call reached with none left gets no cap, so it reads once.
| Applied check verdict | Result for that Kustomization |
|---|---|
| `applied` | applied at its applied revision; keep any "superseded by" note |
| `failed` | failed: its applied and attempted revisions, failing HelmReleases, diagnosis and any note, in one line |
| `pending: <why>` | stop with "not yet reconciled at `<merge commit>`" |
| `suspended`, `unverifiable: <why>`, `unknown: <why>` | stop: "Kustomization `<ns>/<name>`: <verdict>" |
A `pending` at the cap is never a failure: the change may still apply, so it is a stop, and the
caller's relaunch asks again from the start.
After the last call, run `references/already-reverted.md` again, then test each "superseded by
`<SHA>`" against its §At or after a revert. A revert, or a superseding SHA at or after one → stop
with "already reverted by <URL>": the cluster runs the undo, not this change.
## No spec change
The apply wait proves only the bounded Flux guarantee in `SKILL.md` Step 3. The Applied check
judges a HelmRelease by its generation, which moves only when its spec does, so a route that
changes what a release deploys without touching its spec leaves it Ready at its old generation. This check is a
best-effort catch for the routes it can link, not an exhaustive one: an overlay or base outside
`spec.path`, an object applied by another Kustomization and similar routes go undetected, and the
PR's post-merge assertions cover them. For each `applied` Kustomization, test each release on its
HelmReleases line with `references/attribution.md` §HelmRelease condition 1. One linked only
through these routes → stop with
`unverifiable: HelmRelease <ns>/<name> takes this change without a spec change; confirm its upgrade by hand`:
- its `spec.chart.spec.chart` path (an in-repo chart edit);
- an object its `spec.chartRef` names;
- a `spec.valuesFrom` object whose name does not change with its content: one defined in a changed
file, a generator with the name suffix disabled, or a hashed generator the release names by its
unhashed `<base>`.
A hashed generator is a spec change only when the live `valuesFrom` name carries the hash
(`<base>-` plus a 10-character suffix, matched by prefix). Kustomize writes that name into the
HelmRelease only when a `configurations:` nameReference for `kind: HelmRelease`,
`path: spec/valuesFrom/name` exists; then the generation moves and the Applied check already waits
on the upgrade.
## Result
First match wins:
1. Any stop above → stop with the first one's reason; name any `failed` Kustomizations after it.
2. Any `failed` → `failed`, with the failing Kustomizations, their attempted revisions, failing
HelmReleases and diagnoses. `references/attribution.md` decides which are this change's.
3. Every one applied → `applied`. Each applied revision is an applied commit for
`references/report.md`'s Applied commit rule.
@@ -0,0 +1,113 @@
# Attributing a failure
A revert PR undoes this change, so it is opened only when a failure is tied to this change. When
in doubt the failure is untied: a stop asks a human, a wrong revert PR asks them to undo the undo.
A failure is tied only when every condition below is established from what the run read; anything
not established, including a cause or an earlier state that cannot be read, is untied.
## Assertion
Tied only when its target was reached and the observed value contradicts the change: a service
answering with the old version, an object present with the wrong spec. Untied when an untied
failure below (a Kustomization already failing, another commit's failure) is what made it fail. A
connection error or timeout reaching the target is never a `fail`: it is
`unverifiable: <why>` (`SKILL.md` Step 5).
Untied when the state read may come from a commit after the merge commit: the Applied commit
(`references/report.md`) is not the merge commit, a waited Kustomization carries a
`superseded by` note, or a check passed only as "covered by" a later commit. A later commit may
have changed the target.
## CI check
Always untied, whatever file or component it names: a failure from an unreachable host, a
timeout, a cancelled run, a runner or registry error, or a refusal to run such as Provision's "not
tip of main". These say the run could not judge the change, not that the change is wrong.
Otherwise tied when both hold:
- **It names this change.** The cause from `delivery-ci-checks`, or the job log
(`mcp__gitea__actions_run_read` `get_job_log_preview`), names a file the PR changed, or names a
component whose files the PR changed. A component is a unit the repo's tooling runs by name:
an Ansible role or playbook, a Flux app, a Helm chart, a Terraform module. It maps to the
directory or file that defines it (`roles/<name>/`, `<playbook>.yml`, the app's or chart's
directory); the failure names the component and the PR changed a file under its directory.
- **It was passing before.** Walk the merge commit's first-parent history back to the nearest
ancestor carrying a status with the same name:
```bash
git log --first-parent --format=%H -n 50 <merge commit>^1 # ADR-0023: parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Read each SHA's
statuses with `mcp__gitea__commit_read` `get_status`, newest first. A `skipped` status ran
nothing, so pass over it, but only when every row of its workflow (the status name's prefix
before ` / `) on that commit is `success` or `skipped`; otherwise a failure there may have
skipped it, and the failure is untied. The first one found must be `success`. Anything else, or
none in the 50 commits → untied.
## Kustomization
Tied when all hold:
- Its attempted revision is the merge commit itself. One that strictly descends from it is
another commit's failure, not this change's: untied.
- Its diagnosis names a path the PR changed, or an object rendered from one.
- It was Ready at the revision before: its Ready message, `flux events` or `flux trace`, read
through `flux-diagnose`, show that. A Kustomization already failing is untied.
A Kustomization that is `failed` only through its HelmReleases, including a failed health check
on them, is judged under §HelmRelease alone.
## HelmRelease
The Applied check reports every failing HelmRelease in a waited Kustomization's inventory, so
most are not this change's. A failing one is tied only when all three hold:
1. **It is linked to this PR**, by one of these:
- Its manifest is in a changed file. Read each changed `.yaml` or `.yml` file the PR did not
delete with `mcp__gitea__get_file_contents`, `ref` the merge commit; a `HelmRelease`
document matches by name and namespace. One with no `metadata.namespace` matches by name
only when its Kustomization's `spec.path` contains that file.
- Its `spec.chartRef` or a `spec.valuesFrom` entry names, by kind, namespace and name, an
object defined in a changed file, or generated from one. A generator matches when a
`configMapGenerator` or `secretGenerator` in any `kustomization.yaml` under its
Kustomization's `spec.path` lists the changed file: a `files`, `envs` or `env` entry (the
path after any `key=`, `../` included) resolves, relative to that `kustomization.yaml`, to
the changed path. It generates `<base>-<hash>`, or `<base>` when it disables the name
suffix. A hashed generator matches a `valuesFrom` name that is `<base>-` plus a 10-character
suffix, by prefix, or the unhashed `<base>`: kustomize rewrites the name only when a
`configurations:` nameReference for `kind: HelmRelease`, `path: spec/valuesFrom/name`
exists. List the candidates and read each at the merge commit, with `.` for an empty
`spec.path` or `./`:
```bash
rtk git ls-tree -r --name-only <merge commit> -- <spec.path>
```
A `secretGenerator` matches by name only; never read the files it lists.
- Its `spec.chart.spec.sourceRef` is a `GitRepository` `references/apply-wait.md` step 2
kept, and its `spec.chart.spec.chart` path contains a changed path (that file's step 4
rule).
Read the references, names only, never values (an empty namespace is the release's own):
```bash
KUBECONFIG=<path> kubectl get helmrelease <hr> -n <hr-ns> -o jsonpath='{.spec.chartRef.kind}{"|"}{.spec.chartRef.namespace}{"|"}{.spec.chartRef.name}{"|"}{.spec.chart.spec.sourceRef.kind}{"|"}{.spec.chart.spec.sourceRef.namespace}{"|"}{.spec.chart.spec.sourceRef.name}{"|"}{.spec.chart.spec.chart}{"\n"}{range .spec.valuesFrom[*]}{.kind}{"|"}{.name}{"\n"}{end}'
```
2. **It was Ready before the change**, shown by its `flux events` or `flux trace` through
`flux-diagnose`: an upgrade from Ready to failing is this change's. A HelmRelease failing
before, or new in this PR with no earlier state, is untied.
3. **Its Kustomization reached the merge commit itself**: `applied` at it, or `failed` with its
attempted revision equal to it. The second covers `wait: true` or `healthChecks`: when a health
check on its HelmReleases fails, kustomize-controller is believed, not confirmed, to keep the
applied revision at the previous commit. A `superseded by` or `later revision … failing` note
on that Kustomization → untied: a later commit's chart or values may be what fails.
Anything else is untied: a stop, never a revert.
## Recording
Record each failure in the report's Verification line with `tied` or `untied` and the one-line
reason.
@@ -0,0 +1,20 @@
# Reading the inputs
Every read here comes before any waiting: each stop below would otherwise cost a 45-minute wait
first.
- PR: `mcp__gitea__pull_request_read` `get` (title, body, `html_url`, base branch, and
`merge_commit_sha`: the **merge commit**), `get_files` and `get_commits`, every page.
- Shape: `rtk git fetch origin`, then `rtk git rev-list --parents -n 1 <merge commit>`. One parent
and more than one PR commit → stop with "PR #<n> was squash- or rebase-merged from several
commits; verify and revert it by hand": a rebase leaves the merge commit as only the last
rebased commit, and equal file sets would not tell a squash from it.
- `docs/agents/delivery.md` at the merge commit's **first parent**, with
`mcp__gitea__get_file_contents` `ref` set to that SHA, never a branch: the rules as they stood
before this PR, so a PR cannot loosen its own post-merge checks. Format:
`delivery-repo-doc`'s `references/format.md`. Parse only `## Post-merge checks`: items
`` - `<glob>`: `<exact status name>`, … `` or `` - `<glob>`: none ``, or the single item
`- none`. Anything else → stop with "`docs/agents/delivery.md` <problem>".
- Assertions: every `post-merge: <statement> — reason: <reason>` in the PR body's
`## Acceptance checks` block, keeping its line's quoted criterion. No block → no assertions.
- Revert: read `references/already-reverted.md` and run its check.
@@ -0,0 +1,69 @@
# Reading post-merge CI
The wait cap is 45 minutes for this whole step, shared. Note the start time (`date +%s`); every
later wait gets what is left, in whole minutes.
Invoke `delivery-ci-checks` on the merge commit with the check list and the cap.
`malformed: <reason>` → stop with `<reason>`. Otherwise work from its table, one row per check.
## Cancelled runs
A cancelled run says nothing about the change, so it is never a `failure`. For each `failure`
row, read the merge commit's statuses with `mcp__gitea__commit_read` `get_status` and take that
check's raw `status` and `description`. The row is **cancelled** when the status is `error` or
`warning`, or the description mentions "cancel" in any case. How Gitea Actions reports a
cancelled job on a commit status is not certain: `delivery-ci-checks` maps `error` and `warning`
to `failure`, and a cancelled job may also read `failure` with a "Has been cancelled"
description, so both are treated as cancelled.
## Later commits
Section 7 lists only cumulative checks: a green run on a later default-branch commit re-applies
everything since its last success, this change included (`delivery-repo-doc`'s
`references/format.md` §7). So a later commit can settle a row the merge commit could not.
Settle checks per **workflow**: a status name's prefix before ` / ` (`Provision / apply (push)`
→ `Provision`). A workflow whose rows are all `success` or `skipped` passes as it stands. In any
other workflow a `skipped` row is **not run**: a failed or cancelled job before it may have
skipped it, so it says nothing about the change. Its not-run rows go through this section
together with its other rows not `success`.
For each such workflow, run `references/already-reverted.md` again (a revert → stop), then list
the default branch's first-parent commits after the merge commit, oldest first:
```bash
git log --first-parent --reverse --format=%H <merge commit>..origin/<default branch> # ADR-0023: parsed
```
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. That check's fetch
found no revert, so none of these is at or after one. Read each SHA's statuses with
`mcp__gitea__commit_read` `get_status`:
1. The first commit carrying every one of the workflow's checks, each `success` or `skipped`,
**covers** the workflow: each of its rows becomes `pass`, "covered by `<SHA>`", and that SHA
is a **covering commit**. One row green beside a failed one covers nothing: the failure may
have skipped this change's job.
2. None covers, and the newest commit carrying one of the workflow's checks reads `pending` on
it: a later run is under way. Invoke `delivery-ci-checks` on that SHA with the workflow's
checks and the minutes left; none left → it reads `pending`, unread. Every row `success` or
`skipped` → covered by that SHA, once `references/already-reverted.md` again finds no revert.
Still `pending`, at the cap or unread → the workflow's not-run and `pending` rows are
`pending`; and when each of its other rows not `success` is cancelled or a `failure`
`references/attribution.md` §CI check calls always untied (a refusal, a runner error), every
row of the workflow is `pending`. The later run may yet cover it, so that ends in the relaunch stop, not in an
unattributable one. Anything else leaves the rows as the merge commit had them.
A later run's `failure` never replaces the merge commit's row: it may be a later commit's.
## Verdict
Over the rows as they now stand, first match wins:
| Rows | Result |
|---|---|
| any `failure` | each failed check `fail`, with its cause and job link, each cancelled one `fail untied — run cancelled`, each not-run one `fail untied — never ran`, and each `pending` one `pending`; go on |
| any cancelled | stop: "post-merge CI cancelled at `<merge commit>`: `<names>`; re-run it, then relaunch" |
| any not run | stop: "post-merge CI never ran `<names>` for `<merge commit>`" |
| any `missing` | stop: "post-merge CI check missing at `<merge commit>`: `<names>`" |
| any `pending` | stop: "post-merge CI still pending at `<merge commit>`" |
| else | each check `pass` |
@@ -0,0 +1,58 @@
# The operator report
A plain comment on the merged PR, posted before the stage's Handoff comment. It has no `##`
headings, so the inbound check never mistakes it for a Handoff comment. Run mode may later parse
it, so the shape is fixed.
## Rules
- First line exactly `Delivery verify: pass`, `Delivery verify: fail` or
`Delivery verify: stopped`, matching the verdict. Nothing before it.
- Then the six bullets below, verbatim labels, in this order, each present. An empty one holds
`none`.
- **Applied commit** is the newest of the applied commits: the merge commit when a check passed
on it, each covering commit, and each Kustomization's applied revision. Newest means the one
the others are ancestors of (`rtk git merge-base --is-ancestor`). `none` when nothing applied
before a stop, or when no path needed applying.
- On `pass`, **Result** names every open `revert/pr-<n>` PR `references/already-reverted.md`
found, so the human closes it: "pass; close leftover revert PR <URL>".
- **Verification** has one nested line per post-merge check, per Kustomization waited on and per
assertion, each ending `pass`, `fail` or `unverifiable: <why>`, or `pending` for a check
still pending when the run ended. A `fail` adds `tied` or `untied` and its one-line reason. A
check passing only on a later commit adds "covered by `<short SHA>`". A Kustomization `pass`
claims only the bounded Flux guarantee in `SKILL.md` Step 3; whether a chart or values change
took effect is its assertion lines'.
- A check, Kustomization or assertion the run never reached (a stop came first) is left out of
Verification; `Result` names the stop.
- Links only, never pasted logs. Every link is absolute.
## Template
```markdown
Delivery verify: <pass|fail|stopped>
- Applied commit: [`<short SHA>`](<commit URL>) — <merge commit|covering commit|Flux applied revision> | none
- Trigger: <how it applied: "post-merge CI", "Flux pull", both, or "nothing to apply">
- Result: <one line: what happened, or the stop reason>
- Change summary: <one line from the PR title and its changed paths>
- Verification:
- check `<exact status name>`: <pass|pass — covered by `<short SHA>`|fail tied|fail untied — <reason>|pending> — [job](<URL>)
- Kustomization `<namespace>/<name>`: <pass|fail tied|fail untied — <reason>|unverifiable: <why>> at `<short SHA>`
- "<criterion>" — <statement>: <pass|fail tied|fail untied — <reason>|unverifiable: <why>>
- Output links: [PR #<n>](<URL>), [<run or job>](<URL>), [revert PR #<m>](<URL>)
```
## Example
```markdown
Delivery verify: fail
- Applied commit: [`9f3c2ab`](https://git.example.org/acme/infra/commit/9f3c2ab4d1e0) — merge commit
- Trigger: Flux pull
- Result: HelmRelease gotify not Ready after apply; revert PR opened
- Change summary: Bump gotify chart to 1.2.3 (`clusters/home/apps/gotify/`)
- Verification:
- Kustomization `flux-system/apps`: fail tied — HelmRelease gotify upgrade failed at `9f3c2ab`
- "Gotify runs the new chart" — HelmRelease gotify at chart 1.2.3: fail tied — Ready False
- Output links: [PR #42](https://git.example.org/acme/infra/pulls/42), [revert PR #43](https://git.example.org/acme/infra/pulls/43)
```
@@ -0,0 +1,67 @@
# 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. `<n>` is the merged PR's number; `<base>` 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/<base>` and the merge commit
from the local history.
1. **Earlier revert PR.** List PRs in every state whose head branch is `revert/pr-<n>`:
- open → a relaunch already opened it: skip to step 7;
- merged → stop with "already reverted by <PR URL>": the delivery chain ends there;
- closed unmerged, and the `revert/pr-<n>` branch still exists on the remote → stop with
"closed revert PR <PR URL> left branch `revert/pr-<n>`";
- none, and `revert/pr-<n>` exists on the remote → stop with "branch `revert/pr-<n>` exists
with no revert PR";
- otherwise → go on.
"Exists on the remote" is `rtk git ls-remote --heads origin revert/pr-<n>` printing a line;
never a local tracking ref, which a plain fetch does not prune.
2. **Shape.** `rtk git rev-list --parents -n 1 <merge commit>`: 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-<n>` from `origin/<base>`. A local `revert/pr-<n>` 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 <worktree> …`).
4. **Revert.** `rtk git -C <worktree> revert [-m 1] --no-commit <merge commit>`. A conflict →
`rtk git -C <worktree> revert --abort`, stop with "revert of `<merge commit>` 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 <worktree> commit -F - <<'EOF'
revert: <merged PR title> (#<n>)
Reverts merge commit <merge commit>: delivery verify failed.
Refs: #<n>
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-<n>` with upstream tracking, then open the PR: title `Revert "<merged PR
title>"`, base `<base>`, body naming PR #<n>, 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 #<n>. 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.
@@ -0,0 +1,18 @@
# Command tiers
The commands this skill runs itself, and those `references/revert.md` has its caller run,
classified by the action tiers of ADR-0032 (Holocron), which defines them. A command not in this
table is not run by this skill: nothing in this stage runs ADR-0032's Apply-by-merge, Odd-job or
Never tiers. Commands a loaded tool skill runs, `flux-diagnose`'s Applied check among them, are
in that skill's own tier table; only their Read-tier commands are used here.
`delivery-ci-checks` likewise keeps its own.
| Command | Tier | Used by | Use |
|---|---|---|---|
| `mcp__gitea__pull_request_read` `get`, `get_files`, `get_commits`; `mcp__gitea__list_pull_requests`; `mcp__gitea__get_file_contents` | Read | this skill | PR, changed paths, merge shape, revert PRs, delivery doc and HelmRelease files |
| `mcp__gitea__commit_read` `get_status`; `mcp__gitea__actions_run_read` `get_job_log_preview` | Read | this skill | covering commits, cancelled runs, the status before the merge, failure causes |
| `rtk git fetch origin`, `rtk git ls-remote --heads origin`, `rtk git rev-list --parents -n 1`, `rtk git merge-base --is-ancestor`, `git log --first-parent`, `git log --grep` | Read | this skill; the caller in `references/revert.md` | first-parent history, merge shape, revert commits |
| `rtk git ls-tree -r --name-only` | Read | this skill | generator candidates under a Kustomization's `spec.path` (`references/attribution.md`) |
| `kubectl get gitrepositories` / `kustomizations` / `helmreleases`, names and `-o jsonpath` fields only | Read | this skill | which Kustomizations to check, and which failing HelmReleases this PR links: sources, paths, inventories, chart and values references |
| `date +%s` | Read | this skill | the post-merge CI cap |
| `rtk git worktree add`/`remove`, `rtk git revert --no-commit`, `rtk git revert --abort`, `rtk git commit`, `rtk git push`; listing, opening and labelling the revert PR | Propose | the caller, through `references/revert.md` | the revert PR |