feat(delivery): add the review stage and the review hand-back loop

delivery-reviewer (opus; no Bash, Edit, Write or NotebookEdit) is the
review-stage lead. It judges the PR through the new delivery-review
skill and posts one COMMENT review per round. Gitea refuses
REQUEST_CHANGES from a PR's own poster, and the reviewer runs as the bot
that opened the PR. The review opens with `Delivery review: round <n> —
blocking|clear`, and each blocking finding is tagged with the role that
must fix it: [test-author] (with its dispute key), [implementer] or
[human].

Routing: a [human] finding, or a 3rd blocking round, stops with Ready
for Human. Other blocking rounds post the Handoff and put `WIP:` back,
handing the PR to delivery-implement-lead. A clear round hands on to
delivery-operator. A relaunch finishes a crashed routing, using whether
a later Handoff links the review.

delivery-review checks the change against the acceptance criteria and
re-judges every test-path change itself, because a dispute round moves
the CI freeze boundary. It also judges post-merge assertion reasons,
security and the dry run. It reads the delivery doc at the PR's base
ref, and a PR that changes the test-path rules is a [human] finding.

Hand-back: delivery-handoff lets the implement stage take a PR, with
the inbound Handoff required and the gate checked on the issue it
closes. The implement lead first sends [test-author] findings through
delivery-test-first's dispute flow, which now takes review findings,
then gives the implementer the rest. Dispute verdicts are one keyed
`- Dispute verdict:` line copied into every Handoff comment, so later
sessions never re-judge an item or re-dispute a settled test.

delivery-repo-doc, delivery-test-author, delivery-implementer and
delivery-qa are aligned with these contracts. Package bumped to 0.5.0,
with the marketplace allow key and manifest.

Refs: #193

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-23 22:44:18 +00:00
1 parent 5221b9ecd5
commit 0258cff316
22 files changed
+666 -129

No files matched your search

@@ -9,7 +9,7 @@ compatibility: Requires a Gitea forge reached through the Gitea MCP server (via
allowed-tools: Read mcp__gitea__issue_read mcp__gitea__issue_write mcp__gitea__pull_request_read
metadata:
category: delivery
version: "0.1.0"
version: "0.2.0"
---
## Gotchas
@@ -50,7 +50,8 @@ not installed, a question only the human can answer — → **Stop**.
## Step 5 — Exit
Read `references/handoff-comment.md` now and write exactly one Handoff comment from its template,
with the Next command filled for your stage, and post it where its Rules say. Then end the session.
with the Next command filled for your stage, and post it where its Rules say. Then run any step
your agent puts after the Handoff comment (the `WIP:` title edit), and end the session.
## Stop
@@ -60,7 +61,8 @@ Used by every step. Do both, then end the session without further work:
2. Post one comment where `references/handoff-comment.md` §Rules says a stop posts:
- **Before the inbound check passed** (Step 1 or Step 2) → a plain comment stating the reason,
not a Handoff comment, so the inbound rule is never bypassed. A relaunch comes from the latest
real Handoff comment, or from scratch where your row's inbound is Optional.
real Handoff comment, or from scratch where your row's inbound is Optional for the item you
were pointed at.
- **After it passed** (Steps 3–4) → a Handoff comment from `references/handoff-comment.md`,
filled per its stop row. Open questions states the reason; for a missing skill use the
format's wording, "missing skill `<name>`".
@@ -5,7 +5,7 @@ and PR fields and reviews through `gitea-prs`. Every check reads tracker state o
| Stage | Stage lead | Pointed at | Inbound Handoff comment | Gate checks |
|---|---|---|---|---|
| implement | `delivery-implement-lead` | issue | Optional: a human-written ticket has none | The issue carries the label `Status/Ready for Agent` |
| implement | `delivery-implement-lead` | issue, or a PR on a review hand-back | Optional on an issue: a human-written ticket has none. Required on a PR | The issue carries the label `Status/Ready for Agent` — for a PR, the issue its body's `Closes #<n>` names |
| review | `delivery-reviewer` | PR | Required | No human gate. The PR title does not start with `WIP:` |
| verify | `delivery-operator` | PR | Required | The PR is merged (`merged` is true) **and** has at least one review meeting every review condition below |
| spec, tickets | `delivery-planner` | — | — | None in v1: the planner stops at the inbound check (below); gates come in slice 4 |
@@ -19,8 +19,9 @@ a plain stop comment, a partial one. Run these in order, stopping at the first t
- Your agent has no row in the table above → stop with "no stage defined for agent `<name>`".
- You are `delivery-planner` → stop with "no gate defined for the spec or tickets stage in v1":
there is no stage to relaunch into in v1.
- The item you were pointed at is not the kind your row's "Pointed at" column names → stop
with "pointed at an `<issue|PR>`, expected an `<issue|PR>`".
- The item you were pointed at is not a kind your row's "Pointed at" column names → stop
with "pointed at an `<issue|PR>`, expected an `<issue|PR>`". Implement accepts either kind; its
Optional or Required inbound depends on which you were pointed at.
Then find the latest Handoff comment, newest by creation time, on that item:
@@ -50,7 +51,8 @@ these hold:
Quote the failed check as the Open questions reason. Inbound-check wordings are in §Inbound Handoff
comment above. Typical gate-check wordings:
- implement: "gate not set: `Status/Ready for Agent` missing"
- implement: "gate not set: `Status/Ready for Agent` missing"; on a PR, "PR names no issue" when
its body has no `Closes #<n>`
- review: "PR title still starts `WIP:`"
- verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor
dismissed"
@@ -11,11 +11,13 @@ will later parse it, so the shape is fixed even though nothing validates it yet.
- Every section is present. An empty one holds the single word `none`.
- **Evidence** is links — CI runs, commits, the PR — never pasted logs.
- **Next pointer** is the URL the next stage starts from: the PR once one exists, otherwise the
issue. On a stop, it is the item you were pointed at.
issue. On a stop, it is the item you were pointed at, except a stop that redirects to another
item (an implement lead launched on the issue while a hand-back is pending on the PR): its Next
pointer, and so the Next command's `<url>`, is that other item, the PR.
- **Open questions** carries the stop reason on a stop.
- Post the comment on the Next pointer's item via `gitea-issues` — a Gitea PR's conversation
comments are issue comments. On a stop, post it — or the plain stop comment — on the item you
were pointed at.
were pointed at, even when its Next pointer redirects elsewhere.
## Template
@@ -57,9 +59,15 @@ Fill `<agent>`, `<stage>` and `<url>` with real values; `<url>` is the Next poin
| Your stage | `<agent>` | `<stage>` | Note |
|---|---|---|---|
| implement | `delivery-reviewer` | review | — |
| review | `delivery-operator` | verify | Put "Run after a human approves and merges the PR:" on the line above the fenced block |
| review, no blocking findings | `delivery-operator` | verify | Put "Run after a human approves and merges the PR:" on the line above the fenced block |
| review, blocking findings | `delivery-implement-lead` | implement | — |
| verify | — | — | Last stage: the section is `none` |
| any stage, on a stop after the inbound check | your own | your own | Put "After resolving the Open questions above:" on the line above the fenced block |
| any stage, on a stop after the inbound check | your own | your own | Put "After resolving the Open questions above:" on the line above the fenced block; a redirecting stop's `<url>` is the item it redirects to (§Rules) |
The review stage picks its row by the outcome of its own review: blocking findings hand the PR back
to implement, none send it on to verify.
A blocking review at the round cap, or on a relaunch past it, never hands back: it is a stop and
takes the stop row.
`none` means only "final stage, nothing follows": a stop never uses it. When the section is
`none`, drop the fenced block and the "untested" note below it.
@@ -9,15 +9,11 @@ compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server
allowed-tools: Bash Read Write Edit
metadata:
category: delivery
version: "0.1.3"
version: "0.1.4"
---
## Gotchas
- A glob with no installed tool skill is left out, never mapped to the closest-sounding skill: a
guess stalls every consumer stage.
- A status-check name derived from a workflow file is a candidate; the forge's reported string is
what consumers match, character for character.
- Commit authors, CODEOWNERS and collaborator lists are not sources for the allowlist or bot user:
they name who *can* act, not who is *allowed* to.
- The git remote's owner casing can differ from the forge's. Take user and owner names from the
@@ -28,9 +24,9 @@ metadata:
## Step 1 — Locate
Work in the consuming repo's checkout, on its default branch, fast-forward pulled via
`git-branches`. On a dirty working tree, stop and report it. Identify the forge from
the `origin` remote (Gitea or GitHub). If `docs/agents/delivery.md` exists, this run is an
**update**; otherwise a **draft**.
`git-remotes`. On a dirty working tree, stop and report it. Identify the forge from the `origin`
remote (Gitea or GitHub). If `docs/agents/delivery.md` exists, this run is an **update**;
otherwise a **draft**.
Read `references/format.md` now; it is the only definition of the file's syntax.
@@ -56,8 +52,8 @@ as open.
drifted items. Leave every confirmed item byte-for-byte.
Then the pointer line: if the root `AGENTS.md` lacks the exact line from `references/format.md`,
add it where that file's placement rule says. If the repo has no root `AGENTS.md`, invoke `agentsmd-author` to create one carrying that
line, and edit nothing else in it.
add it where that file's placement rule says. If the repo has no root `AGENTS.md`, invoke
`agentsmd-author` to create one carrying that line, and edit nothing else in it.
Run the format's validation checklist. Every box ticked is the completion bar.
@@ -1,9 +1,12 @@
# The `docs/agents/delivery.md` format
This file is the single source of truth for the format. `delivery-handoff`, `delivery-ci-checks`,
`delivery-test-first`, `delivery-qa` and `delivery-operator` cite it as "`delivery-repo-doc`'s `references/format.md`" and
restate only the minimum they parse — `delivery-handoff`, for example, restates the first line and
section 4's syntax. A format change is an edit here, plus every consumer's restatement.
This file is the single source of truth for the format. These files read `docs/agents/delivery.md`:
the skills `delivery-handoff`, `delivery-ci-checks`, `delivery-test-first` and `delivery-review`,
and the agents `delivery-reviewer`, `delivery-implement-lead`, `delivery-implementer`,
`delivery-test-author` and `delivery-qa`. Those that parse a section cite this file as
"`delivery-repo-doc`'s `references/format.md`" and restate only the minimum they parse —
`delivery-handoff`, for example, restates the first line and section 4's syntax. A format change is
an edit here, plus every consumer's restatement.
## File rules
@@ -46,8 +49,8 @@ section 4's syntax. A format change is an edit here, plus every consumer's resta
- `<status check name>` is the exact string the forge shows on a PR's head commit.
- `<role>` is exactly one of: `dry-run`, `test-path`, `test`, `lint`, `build`, `other`.
- `dry-run` appears on exactly one item. `test-path` appears on at most one item, and on exactly
one when the repo has a test-path check.
- `dry-run` appears on exactly one item unless the section is `- none`. `test-path` appears on at
most one item, and on exactly one when the repo has a test-path check.
- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow
whose paths did not match) as passing.
@@ -153,11 +156,12 @@ The values in the skeleton are illustrative only; every real value comes from th
- [ ] Sections 1–4 hold only items in the syntax above, or `- none`.
- [ ] Every skill in section 1 is installed. A listed skill that is not installed makes every
consumer hard-stop on any change matching its glob.
- [ ] Section 2: exactly one `dry-run`; one `test-path` if the repo has that check.
- [ ] Section 2: `dry-run` on exactly one item unless the section is `- none`; one `test-path` if
the repo has that check.
- [ ] Section 3 is the `globs file:` pointer whenever a test-path check reads a globs file.
- [ ] Section 4 is non-empty and every name came from the human or a source they named.
- [ ] Section 5 holds paths and markdown links, no secret values.
- [ ] Root `AGENTS.md` carries the pointer line exactly once.
- [ ] On Gitea, the repo's `Status/Ready for Agent` and `Status/Ready for Human` labels are not in an
exclusive scope (read via `gitea-labels-milestones`); otherwise adding Ready for Human silently
removes the gate label. If they are, name it as open in the PR body.
- [ ] On Gitea, the repo's `Status/Ready for Agent` and `Status/Ready for Human` labels are not
in an exclusive scope (read via `gitea-labels-milestones`), or the PR body names it as open;
otherwise adding Ready for Human silently removes the gate label.
@@ -29,7 +29,8 @@ repo; facts only a human holds come from the human. A value with no source stays
3. Confirm each candidate against the statuses the forge reports on the head commit of a recent PR
where that check reported at least once. Gitea: `gitea-prs` → `pull_request_read` method
`get_status`, or `commit_read` status on the head SHA; GitHub: `gh pr checks <number>`. The
forge's string wins over the derived one. With no PR to read, keep the derived name and say so in the PR body.
forge's string wins over the derived one. With no PR to read, keep the derived name and say so
in the PR body.
4. Assign roles. `test-path` is the check that fails when a commit after the
`Delivery-Stage: test-author` commit touches the test globs. `dry-run` comes from the human.
@@ -37,8 +38,8 @@ repo; facts only a human holds come from the human. A value with no source stays
1. Read the test-path check's workflow and find the file it reads its globs from (for example
`.gitea/test-paths`). If one exists, the section is the `globs file:` pointer.
2. Otherwise list the globs where the repo's tests live (Molecule scenarios, `tests/`, policy tests).
Confirm them with the human in the Step 3 question.
2. Otherwise list the globs where the repo's tests live (Molecule scenarios, `tests/`, policy
tests). Confirm them with the human in the Step 3 question.
### Conventions
@@ -53,5 +54,7 @@ SKILL.md Step 3 asks for these:
- Bot user the agents act as.
- Read-only kubeconfig path, or "no cluster".
- Branch-protection status: in place, or pending with the tracking link.
- Which CI check is the dry run.
- Which CI check is the dry run. A repo with PR checks but no dry-run check is not ready for the
delivery team: say so in the PR body as open and stop.
- Test-path globs, when no globs file exists (confirm the derived list).
- Accepted risks: the ADR or issue links, or "none".
@@ -0,0 +1,95 @@
---
name: delivery-review
description: >
Use when the delivery review stage must judge a PR against its ticket and Acceptance checks.
Owns the review checklist and the review-body format. Not posting the review -> `gitea-prs`.
Not the CI verdict alone -> `delivery-ci-checks`.
compatibility: Requires a Gitea forge with Actions reached through the Gitea MCP server, and a
consuming repo carrying docs/agents/delivery.md.
allowed-tools: Read mcp__gitea__pull_request_read mcp__gitea__issue_read mcp__gitea__commit_read mcp__gitea__actions_run_read mcp__gitea__get_file_contents
metadata:
category: delivery
version: "0.1.0"
---
## Gotchas
- A green CI is not test integrity. The test-path freeze takes the *newest*
`Delivery-Stage: test-author` commit as its boundary, so a dispute round's amend commit un-checks
implementer commits made before it. Judge every test-path change on the PR yourself.
## Common gates
Apply on every step:
- Read-only. Never post, comment, label or edit anything: return findings; the caller posts them.
- Never run tests, linters or dry runs locally, and never re-run CI. CI output is the evidence.
- Evidence is a link (job, issue, PR file view), never pasted log text.
- Never read or decrypt secret material (vault files, private keys, `.tfstate`, Secret objects) to
check it; judge from the diff alone.
- A stop ends the run at once: return `result: stop: <reason>` and nothing else.
## Step 1 — Read the inputs
The caller passes the PR URL, the issue URL and the tool skills it loaded.
- PR: `mcp__gitea__pull_request_read` `get` (head SHA, base ref, body, `html_url`), `get_files`,
`get_diff`, `get_commits`, reading every page.
- Handoff comments: `mcp__gitea__issue_read` `get_comments` on the PR and on the issue, every page
of each (a first run that stopped before the PR existed posted its Handoff on the issue). Keep
every `- Dispute verdict:` line; `references/checklist.md` §Keys and verdicts uses them.
- Issue: `mcp__gitea__issue_read` `get`. No acceptance criteria, or contradictory ones → one
blocking `[human]` finding, "issue has no usable acceptance criteria", linking the issue; skip
checklist checks 2 and 3, which judge against the criteria, and run the rest.
- `docs/agents/delivery.md` and any globs file it names, both read with
`mcp__gitea__get_file_contents` at the PR's **base** ref, never the head: a PR must not loosen the
rules it is judged by. Its format is owned by `delivery-repo-doc`'s `references/format.md`; parse
only `## Test paths`: either the single item `` - globs file: `<path>` `` (read the globs, one per
line, from that file) or one `` - `<glob>` `` per line. Missing or unparseable → stop with
"`docs/agents/delivery.md` <problem>". `- none` → stop: "no test paths in
docs/agents/delivery.md".
## Step 2 — Count the rounds
Read `references/review-body.md` §Round counting and compute `round` and `blocking-rounds-before`.
## Step 3 — CI
Invoke `delivery-ci-checks` on the PR. Keep its `Commit:` SHA as `commit` and its table for Step 4.
| Verdict | Action |
|---|---|
| `fail` | one blocking finding per failed check: its cause, linking its job; owner per `references/checklist.md` §Owners |
| `pending` | stop: "CI still running" |
| `missing` | stop: "CI check missing: `<names>`" |
| `malformed: <reason>` | stop: `<reason>` |
| `pass` | no finding |
## Step 4 — Judge the change
Read `references/checklist.md` and apply checks 2–7 in order, recording each finding as blocking
or non-blocking by its definitions, and each blocking finding's owner by §Owners. Apply the loaded
tool skills' conventions where they cover a changed file.
## Step 5 — Return
Output format, the run's only output:
```text
result: findings
round: <n>
blocking-rounds-before: <k>
commit: <full SHA from delivery-ci-checks' Commit:>
blocking:
- [test-author] <key> — <path>:<line> — <finding> — <link>
- [test-author] — <finding> — <link>
- [<owner>] <path>:<line> — <finding> — <link>
non-blocking:
- <path>:<line> — <finding> — <link>
```
`<owner>` is `implementer` or `human`, or `test-author` for that keyless finding: check 3's missing
`## Acceptance checks` block. Every other `[test-author]` finding carries its `<key>`
(`references/checklist.md` §Keys and verdicts) so the dispute round matches on it, never
re-derives it. An empty list is `- none`. Omit `<path>:<line> — ` for a finding with no line. The
caller posts the review per `references/review-body.md` §Body and §Inline comments.
@@ -0,0 +1,151 @@
# The review checklist
Check 1 is CI, run in `SKILL.md` Step 3. Apply checks 2–7 below in order. Every check runs, even
after a blocking finding: one round reports everything, so each owner fixes theirs in one pass.
## Blocking and non-blocking
- **Blocking** — the PR must not merge as is: a failing listed CI check, an unmet acceptance
criterion, an unexplained out-of-scope change, a PR body with no `## Acceptance checks` block, a
criterion with no check, a named test the diff does not touch, an unjustified `post-merge:` check,
an unjustified test weakening, a test-path change outside a test-author commit, a change to the
test-path rules, a security issue, a dry run doing something the ticket did not ask for, or an
issue with no usable acceptance criteria. This list is a summary: each check's own verdict below
wins.
- **Non-blocking** — everything else worth saying: naming, clarity, small simplifications,
follow-up work. Never escalate a style preference to blocking.
A finding is one line: what is wrong, where, and the link that shows it. Link a changed line as
`<PR html_url>/files`, a criterion as the issue link, a CI result as its job link.
## Owners
Every blocking finding is tagged with who must fix it; non-blocking findings carry no owner.
- `test-author` — anything in the acceptance checks or the test paths: a criterion with no check or
an `open question` line, a test that would pass without the change, a weakened, skipped or
deleted test, an unjustified `post-merge:` reason, a security issue in a test path, a failing CI
check other than `test-path` whose error is in a test-path file itself (a syntax, import or
fixture error).
- `implementer` — the change itself: an unmet criterion whose check is adequate, any other failing
CI check (a test's assertion failure included: the test stands, the change must meet it), a
security issue outside the test paths, a dry run doing something unintended, an out-of-scope
change.
- `human` — what no agent may fix: a commit touching a test path without the test-author trailer
(fixing it rewrites history), a failing `test-path` CI check (the same cause), a change to the
test-path rules (check 5), an issue that is contradictory or has no acceptance criteria, a
re-raised finding whose key already has a verdict (§Keys and verdicts).
## Keys and verdicts
Every `[test-author]` finding carries a key, in the form the `Dispute verdict:` lines of `SKILL.md`
Step 1 use:
- `` `<file>::<test>` `` — a test;
- `"<criterion>"` — verbatim from the issue, for a criterion's Acceptance checks line;
- `` `<file>` `` — a file under the test paths that is not a test, e.g. a fixture with a credential.
The missing-block finding of check 3 carries no key: it never gets a verdict, because its answer is
the block itself.
A finding whose key already has a verdict, of any kind, was judged once and the test author can
never judge it again, so re-raising it is the human's call:
- `upheld` — re-raise it only when the finding text answers that verdict's reason, as blocking
`[human]`; otherwise it is non-blocking.
- `amended` or `escalate` — re-raise it as blocking `[human]`.
- A `→ open question` line whose key has any verdict is blocking `[human]`: only a human can answer
it.
A failing listed CI check is never downgraded: CI red blocks the merge whatever was judged before,
so when its key already has a verdict of any kind it is blocking `[human]`.
## 2. Right change
- Every acceptance criterion in the issue is met by the diff. Read the criterion, then the changed
code that claims to meet it. Unmet or only partly met → blocking `[implementer]`, quoting the
criterion; when its check is also inadequate, check 3 or 4 adds the `[test-author]` finding.
- Nothing outside the ticket's scope changed without a reason stated in the PR body or a commit
message. Unexplained out-of-scope change → blocking `[implementer]`; explained but arguably
separate work → non-blocking, suggesting a follow-up.
## 3. Acceptance checks
Find the `## Acceptance checks` block in the PR body. No block → one blocking finding, "PR body has
no Acceptance checks block", and skip the rest of this check. Each line has one of these forms
(`delivery-test-first`'s `references/output-template.md` owns them):
```markdown
- "<criterion, verbatim>" → `<test file>::<test name>`; `<test file>::<test name>`
- "<criterion, verbatim>" → post-merge: <statement> — reason: <reason>
- "<criterion, verbatim>" → `<test file>::<test name>`; post-merge: <statement> — reason: <reason>
- "<criterion, verbatim>" → open question
```
Every finding here is blocking `[test-author]`, a missing block too, subject to §Keys and verdicts.
- Every issue criterion appears exactly once. Missing, or `→ open question` → blocking.
- Each named test is added or changed in the PR's diff. A test the diff does not touch existed
before the change, so it was never red for this ticket → blocking.
- Each `post-merge:` reason: if a test under the repo's test paths could exercise the criterion
before merge (a render, a unit test, a molecule or `--check` run, a schema check) → blocking,
naming the test that could. Accept the reason only when the behavior exists solely in a live
environment (real DNS, a running cluster, an external service). On a mixed line, judge the reason
only against the part of the criterion its named tests do not cover.
## 4. Test strength and weakening
From `get_files`, take every changed file matching a test-path glob. For each, read its diff and
compare it with the Acceptance checks:
Every finding here is blocking `[test-author]`, subject to §Keys and verdicts.
- An assertion weakened, loosened, skipped, marked expected-to-fail, or deleted, or a test file
deleted → blocking, unless an amended Acceptance checks line justifies it (the test was renamed
or changed by a dispute verdict, and the line names the new test).
- A named test whose assertions do not exercise its criterion — it would pass without the change,
or tests a private name instead of the observable behavior → blocking.
- Do this whatever the `test-path` CI check says: the freeze can miss commits.
## 5. Test-path authorship
From `get_commits`, read each commit's message (`mcp__gitea__commit_read` `get`, with
`include_diff` when its file list is needed). A commit without the trailer
`Delivery-Stage: test-author` that touches a test path → blocking `[human]`, naming the commit SHA
and path, wherever it sits relative to the trailer commits. This backstops CI's freeze.
A change in the diff to `docs/agents/delivery.md`, to the test-path globs file it names, or to the
CI workflow file that runs the `test-path` check → blocking `[human]`, naming the file, with the
text "this change must go in a separate human PR (via `delivery-repo-doc`), not this one": these set
the rules this review and the freeze enforce, so no agent may change them in its own PR.
## 6. Security
Read the diff for:
- secrets or secret material committed: tokens, passwords, private keys, unencrypted vault content,
connection strings with credentials, `.tfstate`;
- plaintext credentials in config or code, including test fixtures;
- injection: unquoted shell interpolation, string-built SQL or templates from untrusted input;
- overly broad permissions or RBAC: wildcards, cluster-admin, `0777`, public buckets;
- disabled verification: TLS verify off, signature or checksum checks skipped, `--insecure`.
Any of these → blocking: `[test-author]` in a test path (keyed by the test, or by the file when it
is not a test), `[implementer]` elsewhere. Never quote a secret value in a finding: name the file
and line only. Never decrypt or open secret material to confirm; a file that looks like it should
be encrypted and is not is itself the finding.
## 7. Dry run
Take the `dry-run` row from the `delivery-ci-checks` table. No such row (its CI checks are
`- none`) → add nothing. `failure` is already a blocking finding from check 1. `skipped` → no
output to judge; add nothing. `success` → read its job log:
```text
mcp__gitea__actions_run_read method get_job_log_preview, job_id <id from the Run link>,
tail_lines 200
```
Judge that the rendered diff, plan or `--check` output changes what the ticket meant, and nothing
more: an unexpected resource, host, namespace or deletion → blocking `[implementer]`, linking the
job. Log unreadable → non-blocking, "dry-run log unavailable", linking the job.
@@ -0,0 +1,65 @@
# The review body and round counting
This file owns the round marker. The reviewer posts the body; this skill only defines it and
counts rounds from it.
Every delivery review is posted with state `COMMENT`. Gitea refuses `REQUEST_CHANGES` and
`APPROVED` from the PR's poster, and the reviewer runs as the bot user that opened the PR, so the
marker, not the review state, carries the outcome.
## Round marker
The review body's first line is exactly one of these, with nothing before or after it:
```text
Delivery review: round <n> — blocking
Delivery review: round <n> — clear
```
`<n>` is the round from §Round counting, as a bare integer. `— blocking` when the blocking list
holds at least one finding, `— clear` otherwise. The line is the only thing that identifies a
delivery review, so never reword it, translate it, or add a prefix or emoji.
## Body
```markdown
Delivery review: round <n> — <blocking|clear>
<summary line>
- **blocking** [test-author] <key> — `<path>:<line>` — <finding> — [evidence](<link>)
- **blocking** [test-author] — <finding> — [evidence](<link>)
- **blocking** [<owner>] — `<path>:<line>` — <finding> — [evidence](<link>)
- **non-blocking** — `<path>:<line>` — <finding> — [evidence](<link>)
```
- Summary line: `<b> blocking, <m> non-blocking.` When `<b>` is 0, write
`No blocking findings.` followed by ` <m> non-blocking.` if `<m>` > 0.
- One list item per finding, blocking items first, each in the order the skill returned them.
Each blocking item carries its owner tag as returned, and a `[test-author]` item its key, copied
verbatim: the implement lead and the test author match on that key, never re-derive it. The one
keyless `[test-author]` item is check 3's missing `## Acceptance checks` block, in the second
shape above; `<owner>` is `implementer` or `human`, or `test-author` for that keyless finding.
Drop `` `<path>:<line>` — `` from any item for a finding with no line.
- No findings at all: the marker line and `No blocking findings.` only.
- Never paste log text or secret values; evidence is the link.
## Inline comments
Each finding with a `<path>:<line>` is also posted as an inline comment on the same review:
`path` the repo-relative path, `new_line_num` the line in the PR head's version of the file, and
body `**blocking** [test-author] <key> — <finding>`, `**blocking** [<owner>] — <finding>` or
`**non-blocking** — <finding>`. A finding about a removed line has no line in the new file, so it
stays in the body only, as does the keyless `**blocking** [test-author] — <finding>` (a missing
block has no line).
## Round counting
Read every page of `mcp__gitea__pull_request_read` method `get_reviews` on the PR. A review is
marked when its body's first line matches `^Delivery review: round [0-9]+ — (blocking|clear)$`.
- `round` = 1 + the number of marked reviews.
- `blocking-rounds-before` = the number of marked reviews whose first line ends `— blocking`.
A human's review never carries the marker, so it never counts. Do not trust the `<n>` in earlier
markers; the count is what decides `round`.
@@ -2,20 +2,21 @@
name: delivery-test-first
description: >
Use when a delivery ticket's acceptance criteria must become Acceptance checks before any
implementation exists, or a disputed one must be judged. Not interactive red-green-refactor
-> `tdd`.
implementation exists, or a disputed check or review finding must be judged. Not interactive
red-green-refactor -> `tdd`.
compatibility: Requires git with push access to the work branch, and a consuming repo carrying
docs/agents/delivery.md. Running the new tests needs the repo's test runner on PATH.
allowed-tools: Read Write Edit Bash
metadata:
category: delivery
version: "0.1.0"
version: "0.2.0"
---
## Gotchas
- A new test that passes before the change is vacuous; one that fails on a syntax or import error
proves nothing. Only an assertion failure counts as red.
proves nothing unless the missing import is the change itself. Otherwise only an assertion
failure counts as red.
- Test what the criterion names, observable from outside. A test pinned to a private name or call
sequence becomes a dispute the moment the implementer picks another design.
@@ -48,7 +49,7 @@ File missing, or either section missing or unparseable → stop: "`docs/agents/d
| Condition | Flow | Reference |
|---|---|---|
| Caller passed a ticket and no dispute | First run | `references/first-run.md` |
| Caller passed an implementer's dispute of named tests | Dispute run | `references/dispute.md` |
| Caller passed an implementer's dispute of named tests, or a review round's `[test-author]` findings | Dispute run | `references/dispute.md` |
Read only the matched flow's reference — each is self-contained.
@@ -68,7 +69,7 @@ rtk git commit -m "test: <subject>" --trailer "Delivery-Stage: test-author"
rtk git push
```
Nothing staged — only post-merge assertions, or every disputed test upheld — → still commit, with
Nothing staged — only post-merge assertions, or every disputed item upheld — → still commit, with
`--allow-empty`. CI's test-path check takes the newest trailer commit as the freeze boundary and
passes at once when there is none, so a skipped commit leaves the tests unfrozen. A pre-commit
hook you cannot satisfy by fixing the test → stop with its output quoted.
@@ -1,25 +1,60 @@
# Dispute run — judging a disputed test
# Dispute run — judging disputed tests or review findings
Input from your caller: the work branch, the issue, and the implementer's dispute — the disputed
tests by `file::test name`, each with the implementer's reason. The implementation may already be
on the branch. Return to `SKILL.md` Step 3 when the last step here is done.
Input from your caller: the work branch, the issue, the current `## Acceptance checks` block (on a
review source, the PR body's), and one source of disputes:
- **Implementer** — the disputed tests by `file::test name`, each with the implementer's reason.
- **Review** — the `[test-author]` findings from a review round, each as the review states it,
with the key the review line carries right after the tag: a criterion with no check or an
`open question` line, a test that would pass without the change, a weakened, skipped or deleted
test, an unjustified `post-merge:` reason, a security issue in a test path, a failing CI check
whose error is in a test-path file (syntax, import or fixture), or a PR body with no
`## Acceptance checks` block. The missing block carries no key and gets no verdict line: return
the full Part 1 of `references/output-template.md`, and the lead inserts it into the PR body.
The caller also passes every earlier verdict, from this session or recorded in the Handoff comments
of the PR and of the issue it closes, each one line:
```text
- Dispute verdict: <key> — source: implementer | review — amended | upheld | escalate — <reason>
```
`<key>` is `` `<file>::<test>` `` for a test, `"<criterion>"` verbatim from the issue for a
criterion with no test or its Acceptance checks line, or `` `<file>` `` for a file under the test
paths that is not a test (a fixture with a credential) — never the finding's wording. On a review
source, use the key the review line carries; never derive it.
The implementation may already be on the branch. Return to `SKILL.md` Step 3 when the last step
here is done.
## Step 1 — Check the round
Each test gets one dispute round. A disputed test the caller marks as already judged once → do not
judge it again; return it as `escalate` with the earlier verdict, and the lead escalates to the
human.
Each test, criterion or file gets one judgement across the whole PR, whichever session or source
raised it, so each disputed item gets one verdict line — except the missing-block finding, which
gets none. An item is already judged when a verdict with the same `<key>` exists:
## Step 2 — Judge each disputed test
- review source — any recorded verdict with the same key; the lead has already removed findings
answered after the review;
- implementer source — earlier in this session, or in any earlier Handoff comment.
Reread the criterion the test checks (the issue, quoted in your earlier report) and decide:
Already judged → do not judge it again; return it as `escalate` with the earlier verdict as the
reason, and the lead escalates to the human.
| The dispute shows | Verdict |
## Step 2 — Judge each item
Reread the criterion the item concerns (the issue, quoted in the Acceptance checks block) and
decide:
| The dispute or finding shows | Verdict |
|---|---|
| The test asserts an implementation detail the criterion does not name | Amend |
| The test misreads the criterion, or asserts something the criterion does not require | Amend |
| The test is wrong in itself: bad fixture, wrong expected value, flaky setup | Amend |
| A criterion has no check, or a check that would pass without the change | Amend |
| A `post-merge:` reason fails because a pre-merge test could exercise the criterion | Amend |
| A security issue in a test path (a committed secret, a plaintext credential in a fixture) | Amend |
| The implementation does not meet the criterion, or the implementer prefers a different behaviour | Uphold |
| A review finding misreads the criterion or the check, and the check stands | Uphold |
| The criterion itself is ambiguous and both readings are defensible | Uphold, and add it to Open questions |
Do not weaken a test to make the current implementation pass. An amendment must still check the
@@ -27,17 +62,31 @@ behaviour the criterion names.
## Step 3 — Amend
Edit the test under the test paths only. An amended test must still fail without the
implementation: when a runner is available, run it against the branch's merge-base with the default
branch in a temporary worktree, and apply the same red-for-the-right-reason table as a first run —
assertion failure counts, a pass is vacuous, a syntax or import error is fixed. Runner not on PATH
→ record "not run: <reason>". Also run it once on the branch head and record pass or fail; that
result goes to the implementer and does not change the verdict.
An amendment may change a test, add a test, or rewrite the item's `## Acceptance checks` line (a
new test name, a test in place of `post-merge:`, a sharper post-merge reason). Write tests under
the test paths only. A new or amended test must still fail without the implementation: run it
against the branch's merge-base with the default branch, in a temporary worktree outside the repo
checkout, with the runner the tool skill names (for Ansible, a placeholder vault password as in
`references/first-run.md` Step 5), and judge the result:
| Result | Action |
|---|---|
| Fails on an assertion about the named behaviour | Correct — record it as red |
| Passes | Vacuous: the behaviour already exists or the assertion is too weak. Strengthen it until it fails; if the behaviour truly already exists, add the criterion to Open questions |
| Fails on syntax, import, collection or fixture errors | Fix the test and rerun — except an import of a module the change itself creates, which is expected: make the failure an assertion where the framework allows, or say so in the record |
| Runner not on PATH, or needs credentials you must not hold | Do not fake a result; record "not run: <reason>" for that test |
Then remove the worktree (`git worktree remove`). Also run each new or amended test once on the
branch head and record pass or fail; that result goes to the implementer and does not change the
verdict.
All amendments of the run land in the single commit of `SKILL.md` Step 3.
## Step 4 — Uphold
Leave the test unchanged and write a one-line reason that names the criterion it enforces, e.g.
"upheld: criterion 2 requires the 404 on an unknown id; the implementation returns 500".
Leave the test and its line unchanged and write a one-line reason that names the criterion it
enforces, e.g. "upheld: criterion 2 requires the 404 on an unknown id; the implementation returns
500". On a review finding, the reviewer re-judges the upheld item in the next round.
The commit in `SKILL.md` Step 3 still happens — empty when every test was upheld — so this run
The commit in `SKILL.md` Step 3 still happens — empty when every item was upheld — so this run
ends like every other one.
@@ -68,7 +68,7 @@ For each assertion-classified criterion, write one line holding:
- one **observable statement** about the applied state, concrete enough for `delivery-operator`
to check with read-only commands — resource kind, name, field and expected value;
- a **reason** no pre-merge test applies, which `delivery-reviewer` judges.
- a **reason** no pre-merge test applies, which `delivery-review` judges (its checklist check 3).
Example: `HelmRelease gotify Ready at chart 1.2.3` — reason: a version bump has no testable logic
before reconcile.
@@ -15,15 +15,17 @@ them on its line, separated by `; `.
- "<criterion 2, verbatim>" → `<test file>::<test name>`; `<test file>::<test name>`
- "<criterion 3, verbatim>" → post-merge: <observable statement> — reason: <why no pre-merge test applies>
- "<criterion 4, verbatim>" → `<test file>::<test name>`; post-merge: <statement> — reason: <reason>
- "<criterion 5, verbatim>" → open question
```
Rules:
- `<test file>` is repo-relative. `<test name>` is the name the runner reports, with any class or
describe prefix the runner needs to select it (`tests/test_api.py::TestUsers::test_unknown_id_404`).
- Every criterion appears exactly once. A criterion left unchecked because its test cannot live
under a test path still appears, as `→ open question`, and is listed in Part 2.
- On a dispute run, return the whole block with amended test names updated, not only the changed
- Every criterion appears exactly once. Any criterion added to Open questions appears as
`→ open question` — e.g. a test that cannot live under a test path — except an item a
dispute upheld: it keeps its line, and the ambiguity goes only in Part 2's `Open questions:`.
- On a dispute run, return the whole block with every amended line updated, not only the changed
lines.
## Part 2 — Run notes
@@ -32,13 +34,23 @@ Rules:
Commit: <sha> (Delivery-Stage: test-author) pushed to <branch>
Red run:
<test file>::<test name>: red (assertion) | not run: <reason>
Head run: (dispute run only; omit otherwise)
<test file>::<test name>: pass | fail | not run: <reason>
Dispute verdicts: (dispute run only; omit otherwise)
<test file>::<test name>: amended — <what changed> | upheld — <one-line reason> | escalate — <earlier verdict>
- Dispute verdict: <key> — source: implementer | review — amended | upheld | escalate — <reason>
Open questions:
- <criterion or test, quoted>: <the question> | none
Stop: (only when the run stopped; omit otherwise)
<reason, with the criterion or skill name quoted>
```
Each dispute verdict is exactly that one line, one per disputed item except a missing-block
finding (its answer is Part 1), so the lead copies it verbatim into its Handoff comment. `<key>` is
`` `<test file>::<test name>` `` for a test, `"<criterion, verbatim>"` for a criterion with no test
or its Acceptance checks line, or `` `<file>` `` for a file under the test paths that is not a test
— on a review source, the key the review line carries — never the finding's wording, so a later
round can match it. `<reason>` is what changed (amended), the one-line reason (upheld), or the
earlier verdict (escalate).
A stopped run returns Part 2 with only `Stop:` filled and no commit; the caller runs
`delivery-handoff`'s Stop with that reason.