feat(delivery): add the dry-run-gated role and allow several dry runs

A repo's CI checks may now list one or more dry-run checks and any
number of dry-run-gated ones: a dry run that posts its status only
after an allowlisted human adds a label. delivery-ci-checks classifies
a gated check with no status on the pinned SHA as awaiting-gate, which
passes the verdict, is never waited on, and is reported on its own
Awaiting gate line. qa never fails on it, the implement lead notes it
in the Handoff's Open questions, and the review records it as a
non-blocking finding for the approver. No agent sets the gate label.

Refs: #218

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-25 08:58:03 +00:00
1 parent d72afcd1bf
commit 6cb27a576d
11 files changed
+80 -47

No files matched your search

@@ -113,15 +113,17 @@ with blocking findings. On a PR, the issue is the one its body's `Closes #<n>` n
`## Acceptance checks` block and the skill names.
- `pass` → step 9.
- `fail` → back to step 7 with its findings. After the third `fail` this session → Stop with
"QA failed 3 rounds" and the last findings.
"QA failed 3 rounds" and the last findings. An `awaiting-gate` name is never a fail and never
counts toward this limit.
- `pending` → Stop with "CI still running".
- `stop` → Stop with its reason: a missing or malformed check is not the implementer's to fix.
9. Run `delivery-handoff` Step 5: one Handoff comment on the PR, Decisions and Rejected taken from
the role agents' reports and every step 6 and step 7 verdict, Evidence linking the PR, the
commits and the CI runs QA cited. Then remove the `WIP:` prefix from the PR title with
`gitea-prs`, which makes the PR eligible for the review stage. The comment goes first so a crash
between the two leaves a recorded hand-off on a PR still in `WIP:`, never a review-eligible PR
with no Handoff comment for the reviewer's Required inbound check.
commits and the CI runs QA cited, and Open questions one line "awaiting human gate: `<check>`"
per name on QA's last `awaiting-gate` line (else `none`). Then remove the `WIP:` prefix from
the PR title with `gitea-prs`, which makes the PR eligible for the review stage. The comment
goes first so a crash between the two leaves a recorded hand-off on a PR still in `WIP:`, never
a review-eligible PR with no Handoff comment for the reviewer's Required inbound check.
## Output
@@ -17,7 +17,8 @@ These hold whatever your caller's prompt says:
- You are read-only. Never create, edit or delete a file, by a file tool or through the shell.
- Never re-run CI, and never run the tests, linters or dry runs locally.
- Never approve, label, comment on or edit the PR or the issue.
- Never approve, label, comment on or edit the PR or the issue. A gated dry run's label is the
human's gate: never add, remove or re-add it.
- Never read secret material: vault and vault password files, private keys, `.tfstate`, Secret
objects.
- Evidence is links — CI runs, commits, files at a commit — never pasted logs.
@@ -33,12 +34,15 @@ the tool skill names.
2. Load each tool skill the lead named, then invoke `delivery-ci-checks` to read the head commit's
check results. Its verdict maps to yours: `pending` → `pending`; `fail` → `fail`, the failed
run linked; `missing` (a listed check never reported) or `malformed: <reason>` → `stop`, because
no implementer commit can fix either.
no implementer commit can fix either. An `awaiting-gate` row is a `dry-run-gated` check no human
has started yet: it is never a fail and never `missing`; list its name under `awaiting-gate` and
judge the rest. A gated check that ran is judged like any other row.
3. With CI green, judge against this checklist; each miss is a finding:
- Every acceptance criterion is met by a check that actually exercises it, not one that would
pass without the change.
- Edge cases the ticket implies that no check covers.
- The `dry-run` role check's diff or render does what the ticket meant — read its output.
- Every `dry-run` and `dry-run-gated` check that has output: its diff or render does what the
ticket meant — read it.
- Idempotence, and effects check mode cannot simulate, are covered or named as post-merge
assertions.
- No test was weakened, skipped or deleted since the test author's commit.
@@ -49,6 +53,7 @@ the tool skill names.
```text
verdict: pass | fail | pending | stop
awaiting-gate: <comma-separated check names> | none
findings:
- <what is wrong or uncovered> — <link>
```
@@ -20,8 +20,9 @@ These hold whatever your launch prompt says:
delete a file, and never commit or push.
- Every review you post has state `COMMENT`. Never request changes, approve or dismiss: Gitea
refuses a review state from the PR's poster, and you run as the user that opened the PR.
- Never merge a PR, and never set, add or remove a Gate label (`Status/Ready for Agent`). An
approval is the human gate the verify stage checks; an agent that sets one approves its own work.
- Never merge a PR, and never set, add or remove a Gate label (`Status/Ready for Agent`) or a
gated dry run's label. An approval is the human gate the verify stage checks; an agent that sets
one approves its own work.
- Set `Status/Ready for Human` only through `delivery-handoff` §Stop.
- Never run tests, linters or dry runs locally, and never re-run CI. Evidence is links, never
pasted logs.
@@ -9,7 +9,7 @@ compatibility: Requires a Gitea forge with Actions reached through the Gitea MCP
allowed-tools: Read mcp__gitea__pull_request_read mcp__gitea__commit_read mcp__gitea__actions_run_read
metadata:
category: delivery
version: "0.1.1"
version: "0.2.0"
---
## Gotchas
@@ -21,7 +21,8 @@ metadata:
- Match check names verbatim, event suffix included: `Lint / lint (push)` is not
`Lint / lint (pull_request)`. Never fuzzy-match or substitute a similar name.
- `skipped` counts as passing (path-filtered workflows report it). A listed check with no status on
the commit is `missing`, never passing.
the commit is never passing; only a `dry-run-gated` one is excused, as `awaiting-gate`.
- Never add, remove or re-add a dry run's gate label: it is the human gate.
## Step 1 — Read the listed checks
@@ -33,51 +34,52 @@ Otherwise read `docs/agents/delivery.md` at the consuming repo's root. Its forma
`delivery-repo-doc`'s `references/format.md`; you parse only section `## CI checks`:
- one item per line: `` - `<exact status name>`: <role> ``
- `<role>` is one of `dry-run`, `test-path`, `test`, `lint`, `build`, `other`; `dry-run` on exactly
one item
- `<role>` is one of `dry-run`, `dry-run-gated`, `test-path`, `test`, `lint`, `build`, `other`;
`dry-run` on one or more items
- `- none` as the only item means no checks: return verdict `pass` with an empty table and stop.
File missing, section missing, an item outside that syntax, an unknown role, or not exactly one
`dry-run` → return `malformed: <reason>` and no verdict. The caller stops with
`Status/Ready for Human` through `delivery-handoff`'s Stop; do not guess the list.
File missing, section missing, an item outside that syntax, an unknown role, or no `dry-run`
item → return `malformed: <reason>` and no verdict; never guess the list.
## Step 2 — Pin the commit
- **PR** → `mcp__gitea__pull_request_read` method `get`; take `head.sha` and the PR's `html_url`.
- **Commit** (e.g. post-merge on `main`) → use the SHA you were given.
Only statuses on this SHA count. A status from an older commit of the PR is stale and is ignored.
Only statuses on this SHA count; an older commit's are stale and ignored.
## Step 3 — Read statuses, with bounded waiting
Read `references/statuses.md` now. Read the pinned SHA's statuses with
`mcp__gitea__commit_read` method `get_status`, `ref` set to the SHA, and classify each listed
check as `success`, `failure`, `skipped`, `pending` or `missing` per its mapping.
check as `success`, `failure`, `skipped`, `pending`, `missing` or `awaiting-gate` per its
mapping and §Gated dry runs.
Re-read while any listed check is `pending`, or while no listed check has reported yet. With a
caller-supplied list, also re-read while any is `missing`: workflows on a fresh commit start
late. Each re-read passes `wait_seconds: 45`. For a PR, re-read `head.sha` first; if it moved, go
back to Step 2 with the new SHA. The hard cap, across all SHAs, is **20 reads, about 15
minutes**. A caller's wait cap in minutes replaces it: the caller's minutes, at most
⌈minutes×4/3⌉ reads, whichever comes first. At the cap, report what you have; never wait past it.
Re-read while any listed check is `pending`, or while no ungated listed check has reported yet;
never for an `awaiting-gate` check. With a caller-supplied list, also re-read while any is
`missing`: workflows on a fresh commit start late. Each re-read passes `wait_seconds: 45`. For a
PR, re-read `head.sha` first; if it moved, go back to Step 2 with the new SHA. The hard cap, across
all SHAs, is **20 reads, about 15 minutes**. A caller's wait cap in minutes replaces it: the
caller's minutes, at most ⌈minutes×4/3⌉ reads, whichever comes first. At the cap, report what you
have; never wait past it.
## Step 4 — Explain failures
For each `failure`, read the job's log as `references/statuses.md` §Failure cause says and write
the cause in one line. Link the job; never paste log text into the result.
For each `failure`, write its one-line cause per `references/statuses.md` §Failure cause.
## Step 5 — Return the result
Overall verdict, first match wins: any `failure` → `fail`; any `missing` → `missing`; any
`pending` → `pending`; else → `pass`.
`pending` → `pending`; else → `pass`. `awaiting-gate` passes like `skipped`.
Output format:
```text
Commit: <full SHA> Verdict: <pass|fail|pending|missing>
Awaiting gate: <comma-separated check names> | none
| Check | Role | State | Run | Cause |
```
One row per listed check, in the doc's or the caller's order. `Run` is the absolute job link, or
`none` for a skipped or missing check. `Cause` is the one-line failure cause, else empty. On `pending` or
`none` for a check with no job. `Cause` is the one-line failure cause, else empty. On `pending` or
`missing` the caller decides what follows; you do not.
@@ -28,17 +28,30 @@
| `skipped` | `skipped`, passing |
| `failure`, `error`, `warning` | `failure` |
| `pending` (Gitea Actions reports queued and running jobs as this), any other value | `pending` |
| no status whose `context` equals the listed name | `missing` |
| no status whose `context` equals the listed name, role `dry-run-gated` | `awaiting-gate`, passing |
| no status whose `context` equals the listed name, any other role | `missing` |
When two statuses share a `context`, use the one with the latest `updated_at`.
## Gated dry runs
- `awaiting-gate` is a `dry-run-gated` check with no status on the pinned SHA: no human has added
its label yet, and only a human can, so waiting for it is pointless. It is never `missing`.
- A gated check that has a status (`pending`, `failure`, `success`, `skipped`) is classified like
any other check.
- Only the delivery doc gives roles, so a caller-supplied list never yields `awaiting-gate`.
- A gated status on an older commit is stale like any other. The label is needed fresh per push,
so after a push the check is `awaiting-gate` again until a human re-adds it. Adding, removing or
re-adding it is the human's act, never yours.
- The `Awaiting gate:` line names every `awaiting-gate` row, else `none`.
## Links
Build the absolute link from the forge's origin, the scheme and host of the PR's `html_url` or of
the API `url` fields, plus `target_url`:
`https://git.example.org` + `/<owner>/<repo>/actions/runs/4872/jobs/5907`.
A skipped or missing check has no job, so its `Run` cell is `none`.
A skipped, missing or `awaiting-gate` check has no job, so its `Run` cell is `none`.
## Failure cause
@@ -9,7 +9,7 @@ compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server
allowed-tools: Bash Read Write Edit
metadata:
category: delivery
version: "0.2.0"
version: "0.3.0"
---
## Gotchas
@@ -49,9 +49,13 @@ syntax. A format change is an edit here, plus every consumer's restatement.
```
- `<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 unless the section is `- none`. `test-path` appears on at
- `<role>` is exactly one of: `dry-run`, `dry-run-gated`, `test-path`, `test`, `lint`, `build`,
`other`.
- `dry-run` appears on one or more items 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.
- `dry-run-gated` (zero or more items) is a dry run that posts its status only after a user on the
human allowlist adds a label to the PR. Until then its status is absent from the head commit, and
consumers read that as awaiting the human gate, not as missing.
- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow
whose paths did not match) as passing.
@@ -146,6 +150,7 @@ Placement only decides where the line sits; the line itself never changes:
## CI checks
- `ci / render-diff (pull_request)`: dry-run
- `ci / plan (pull_request_target)`: dry-run-gated
- `ci / test-paths (pull_request)`: test-path
- `ci / lint (pull_request)`: lint
@@ -182,8 +187,8 @@ The values in the skeleton are illustrative only; every real value comes from th
- [ ] Sections 1–4 and 7 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: `dry-run` on exactly one item unless the section is `- none`; one `test-path` if
the repo has that check.
- [ ] Section 2: `dry-run` on one or more items unless the section is `- none`; `dry-run-gated`
only on a dry run the human named as label-gated; 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.
@@ -18,9 +18,9 @@ repo; facts only a human holds come from the human. A value with no source stays
### CI checks
1. Read every workflow under `.gitea/workflows/` or `.github/workflows/` that runs on
`pull_request`. A path-filtered `pull_request` workflow still counts: Gitea reports it as
"skipped" when its paths don't match. List it, usually with role `test`. Workflows that run only
on push, schedule or dispatch are not PR checks; leave them out.
`pull_request` or `pull_request_target`. A path-filtered `pull_request` workflow still counts:
Gitea reports it as "skipped" when its paths don't match. List it, usually with role `test`.
Workflows that run only on push, schedule or dispatch are not PR checks; leave them out.
2. Derive each candidate name:
- Gitea Actions: `<workflow name> / <job name> (<event>)`. The workflow name is the file's
top-level `name:` (else the file name); the job name is the job's `name:` (else the job id).
@@ -32,7 +32,9 @@ repo; facts only a human holds come from the human. A value with no source stays
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.
`Delivery-Stage: test-author` commit touches the test globs. `dry-run` and `dry-run-gated`
come from the human: a dry run whose workflow waits for a label (a `labeled` trigger or a
label condition on the job) is a `dry-run-gated` candidate to confirm, never assigned unasked.
### Test paths
@@ -72,8 +74,9 @@ 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. 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.
- Which CI checks are dry runs, and which of those are label-gated: they post a status only after
an allowlisted human adds a label. A repo with PR checks but no ungated 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).
- Post-merge items for a push workflow with no path filter (confirm the derived directories).
- Accepted risks: the ADR or issue links, or "none".
@@ -9,7 +9,7 @@ compatibility: Requires a Gitea forge with Actions reached through the Gitea MCP
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"
version: "0.2.0"
---
## Gotchas
@@ -137,9 +137,11 @@ 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:
Apply this to every `dry-run` and `dry-run-gated` row in 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. `awaiting-gate` → non-blocking, "gated dry
run `<name>` has not run yet; the approver judges its output once it does", with no job link.
`success` → read its job log:
```text
mcp__gitea__actions_run_read method get_job_log_preview, job_id <id from the Run link>,
+1 -1
View File
@@ -1,5 +1,5 @@
name: delivery
version: 0.6.0
version: 0.7.0
description: Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.
author:
name: Mortis