Merge pull request 'feat(delivery): add the dry-run-gated role and allow several dry runs' (#221) from feat/delivery-dry-run-gated into main
Reviewed-on: #221 Reviewed-by: Defame1297 <[email protected]>
This commit was merged in pull request #221.
This commit is contained in:
commit
1f24556833
14 files changed
+101
-58
No files matched your search
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"name": "delivery",
|
||||
"description": "Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.",
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/delivery"
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ executables:
|
||||
bin: true
|
||||
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
|
||||
# version-in-key convention as above, kept by the same sync check.
|
||||
delivery#0.6.0:
|
||||
delivery#0.7.0:
|
||||
hooks: true
|
||||
|
||||
marketplace:
|
||||
|
||||
@@ -17,9 +17,10 @@ they do the work.
|
||||
|
||||
- Never edit, create or delete a file — not with a file tool and not through the shell (`>`, `tee`,
|
||||
`sed -i`, `git mv`, `git rm`). Every change to the repo is a role agent's commit.
|
||||
- Never set, add or remove a Gate label (`Status/Ready for Agent`), never approve or merge a PR, and
|
||||
never mark the PR ready except by removing `WIP:` after `delivery-qa` returns `pass`. Gates are
|
||||
human approval recorded in the tracker; an agent that sets one approves its own work.
|
||||
- Never set, add or remove a Gate label (`Status/Ready for Agent`) or a gated dry run's label, never
|
||||
approve or merge a PR, and never mark the PR ready except by removing `WIP:` after `delivery-qa`
|
||||
returns `pass`. Gates are human approval recorded in the tracker; an agent that sets one approves
|
||||
its own work.
|
||||
- Never tell a role agent to relax one of its rules. Your delegation prompt overrides its body, so a
|
||||
prompt that says "edit the test" or "skip the hook" removes the guard. Pass inputs, not policy.
|
||||
- Never run apply-by-merge, odd-job or Never-tier commands (ADR-0032), and never read secret
|
||||
@@ -118,10 +119,11 @@ with blocking findings. On a PR, the issue is the one its body's `Closes #<n>` n
|
||||
- `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,22 +34,26 @@ 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. `awaiting-gate` rows are never a fail: list them under
|
||||
`awaiting-gate` and judge the rest.
|
||||
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.
|
||||
- Every `skipped` status is legitimately path-filtered: its workflow's paths do not match the
|
||||
diff.
|
||||
diff. A gated check never reaches you as `skipped`; `delivery-ci-checks` reports it as
|
||||
`awaiting-gate`.
|
||||
|
||||
## Output
|
||||
|
||||
```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,9 +28,26 @@
|
||||
| `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`.
|
||||
When two statuses share a `context`, use the one with the latest `updated_at`. For role
|
||||
`dry-run-gated`, ignore its `skipped` statuses first and take the latest of the rest; none left →
|
||||
`awaiting-gate`. A gated job whose label condition is unmet posts `skipped`, and a later label
|
||||
event on the same SHA posts a newer `skipped` that would otherwise mask an earlier gated
|
||||
`failure`.
|
||||
|
||||
## Gated dry runs
|
||||
|
||||
- `awaiting-gate` is a `dry-run-gated` check with no non-`skipped` 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 `pending`, `failure` or `success` status 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.
|
||||
- The `Awaiting gate:` line names every `awaiting-gate` row, else `none`.
|
||||
|
||||
## Links
|
||||
|
||||
@@ -38,7 +55,7 @@ Build the absolute link from the forge's origin, the scheme and host of the PR's
|
||||
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,14 +9,14 @@ 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.2.1"
|
||||
version: "0.2.2"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
- `Status/Ready for Human` is a stop signal, not a Gate, so you may set it. Every real gate —
|
||||
`Status/Ready for Agent`, a PR approval — is human-only: never set, add or remove a gate label,
|
||||
and never approve a PR.
|
||||
`Status/Ready for Agent`, a gated dry run's label, a PR approval — is human-only: never set, add
|
||||
or remove a gate label, and never approve a PR.
|
||||
- Check gate *state*, not who set it: in step mode the human launching your stage is the approval.
|
||||
Do not read the issue timeline.
|
||||
- `Status/Ready for Agent` and `Status/Ready for Human` must not share an exclusive label scope:
|
||||
|
||||
@@ -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,11 +49,16 @@ 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.
|
||||
- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow
|
||||
whose paths did not match) as passing.
|
||||
- `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. Its workflow runs only on that one named gate label, so
|
||||
no other label event starts it. Until then its status is absent or `skipped` on the head commit,
|
||||
and consumers read either as awaiting the human gate, not as missing or passing.
|
||||
- Whatever its role, except `dry-run-gated`, a consumer treats a check reported as "skipped" (a
|
||||
path-filtered workflow whose paths did not match) as passing.
|
||||
|
||||
### 3. Test paths
|
||||
|
||||
@@ -146,6 +151,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 +188,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,12 @@ 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.
|
||||
A gated check's name must come from the forge, read on a PR where the gated job ran (step 3).
|
||||
With no such PR, list it as open in the PR body instead: a wrong name stays `awaiting-gate`
|
||||
forever and never blocks.
|
||||
|
||||
### Test paths
|
||||
|
||||
@@ -72,8 +77,10 @@ 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. For each gated one, confirm its workflow runs only on that one
|
||||
named label (the filter read from the workflow). 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,12 @@ 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", linking
|
||||
`<PR html_url>/files`.
|
||||
`success` → read its job log:
|
||||
|
||||
```text
|
||||
mcp__gitea__actions_run_read method get_job_log_preview, job_id <id from the Run link>,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user