diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index e156eb9..aaca211 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -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.2.0", + "version": "0.3.0", "category": "Developer Tools", "source": "./plugins/delivery" }, diff --git a/apm.yml b/apm.yml index 9bf54fb..0da8f0f 100644 --- a/apm.yml +++ b/apm.yml @@ -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.2.0: + delivery#0.3.0: hooks: true marketplace: diff --git a/docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md b/docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md index 23f3296..b6ea178 100644 --- a/docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md +++ b/docs/adr/0032-credentials-not-hooks-are-the-agent-safety-boundary.md @@ -54,8 +54,12 @@ running it in CI on a bot PR hands the bot those credentials. Decided in `flux diff` needs write RBAC, because Kubernetes authorises dry-run requests like real ones, so it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later `tofu plan`; - - stage leads start only when a user on the human allowlist in `docs/agents/delivery.md` set the - gate label, checked against the issue timeline; + - in step mode (v1) the human launching a stage is the approval, and stage leads check gate + state only: the gate label is present, and for verify the PR is merged with a non-stale, + non-dismissed approval by a user on the human allowlist in `docs/agents/delivery.md`. The + who-set-the-label check moves to the run-mode launcher, which checks the triggering event's + sender against the allowlist before starting an agent; it is deterministic, so it belongs in + the workflow, not an agent; - a CI test-path check, run from `main`'s copy, fails if a commit after the test author's (trailer `Delivery-Stage: test-author`) touches the globs in `.gitea/test-paths`; this check, not file protection, guards tests. The implementer hands disputed tests back instead of editing @@ -101,6 +105,10 @@ running it in CI on a bot PR hands the bot those credentials. Decided in cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating subcommand fails safe. Codex cannot ask, so odd jobs are denied there; an unrecognised runtime is treated the same way. +- *Amended 2026-11-23 ([delivery-handoff skill](https://git.rkdr.net/Mortis/Holocron/issues/191)): stage + leads check gate state only and the who-set-the-label check moved to the run-mode launcher, + because gitea-mcp v1.13.0 has no timeline method, the timeline needs a token on private repos, + and in step mode the human already launches each stage.* - *Amended 2026-11-23 ([delivery guard hook](https://git.rkdr.net/Mortis/Holocron/issues/190)): Copilot ask kept as an accepted risk; the guard covers file tools and uses read-verb allowlists.* - *Amended 2026-11-22 ([Credential boundary setup in ansible-homelab-mono](https://git.rkdr.net/Mortis/Holocron/issues/184)): test paths left diff --git a/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md b/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md new file mode 100644 index 0000000..febfd83 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md @@ -0,0 +1,63 @@ +--- +name: delivery-handoff +description: > + Use when a delivery Stage lead starts or finishes its stage. Checks the stage's gate and writes the + Handoff comment. Not a plain issue comment -> `gitea-issues`. Not writing the repo's delivery doc + -> `delivery-repo-doc`. +compatibility: Requires a Gitea forge reached through the Gitea MCP server (via the gitea-issues and + gitea-prs skills), and a consuming repo carrying docs/agents/delivery.md. +allowed-tools: Read +metadata: + category: delivery + version: "0.1.0" +--- + +## 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. +- Check gate *state*, not who set it. In step mode the human launching your stage is the approval; + the who-set-it check belongs to the run-mode launcher. Do not read the issue timeline. + +## Step 1 — Read the repo's delivery doc + +Before any other work, read `docs/agents/delivery.md` at the consuming repo's root. Its format is +owned by `delivery-repo-doc`'s `references/format.md`; you need only the Human allowlist: section +`## Human allowlist`, one `` - `` `` item per line, never empty. + +File missing, first line not `# Delivery`, or the allowlist section missing or empty → go to +**Stop** with the reason, e.g. "`docs/agents/delivery.md` missing". + +## Step 2 — Read the inbound Handoff comment + +Read the issue or PR you were pointed at via `gitea-issues` (or `gitea-prs` for the PR's own +fields). The inbound Handoff comment is the latest comment carrying the six Handoff headings; read +it before anything else on the item. Only the implement stage may start without one, on a +human-written ticket. Any other stage without one → **Stop**. + +## Step 3 — Check the gate + +Read `references/gates.md` now and run every check in your stage's row. Any check fails → **Stop**, +quoting the failed check as the reason. + +## Step 4 — Do the stage's work + +Run your stage's own flow. A blocker mid-stage — a skill named in `docs/agents/delivery.md` that is +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. Post it where the next stage starts: on the PR once one +exists, otherwise on the issue, via `gitea-issues` (a Gitea PR's conversation comments are issue +comments). Then end the session. + +## Stop + +Used by every step. Do both, then end the session without further work: + +1. Add the `Status/Ready for Human` label to the issue or PR you were pointed at, via `gitea-issues`. +2. Post a Handoff comment there from `references/handoff-comment.md`. Open questions states the + reason; for a missing skill use the format's wording, "missing skill ``". Next command is + `none`. diff --git a/plugins/delivery/.apm/skills/delivery-handoff/references/gates.md b/plugins/delivery/.apm/skills/delivery-handoff/references/gates.md new file mode 100644 index 0000000..aa98fe0 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-handoff/references/gates.md @@ -0,0 +1,32 @@ +# Stage gates + +Each stage lead runs the checks in its own row, in order. Read issue fields through `gitea-issues` +and PR fields and reviews through `gitea-prs`. Every check reads tracker state only; none sets it. + +| 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` | +| review | `delivery-reviewer` | PR | Required: the implement stage's | No human gate. The PR title does not start with `WIP:` | +| verify | `delivery-operator` | PR | Required: the review stage's | The PR is merged (`merged` is true) **and** has at least one review meeting every review condition below | +| spec, tickets | `delivery-planner` | — | — | Not defined yet: the planner is out of v1 scope | + +## Verify: review conditions + +Read the PR's reviews (`pull_request_read`, method `get_reviews`). A review counts only when all of +these hold: + +- `state` is `APPROVED`; +- its author's login is on the Human allowlist, compared against the forge's casing; +- `stale` is `false` — no push landed after it was submitted; +- `dismissed` is `false`. + +## Stop reasons + +Quote the failed check as the Open questions reason. Typical wordings: + +- implement: "gate not set: `Status/Ready for Agent` missing" +- review: "no inbound Handoff comment from the implement stage"; "PR title still starts `WIP:`" +- verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor + dismissed" +- spec, tickets: "no gate defined for the `` stage in v1" +- a stage lead not in the table: "no stage defined for agent ``" diff --git a/plugins/delivery/.apm/skills/delivery-handoff/references/handoff-comment.md b/plugins/delivery/.apm/skills/delivery-handoff/references/handoff-comment.md new file mode 100644 index 0000000..9ca0025 --- /dev/null +++ b/plugins/delivery/.apm/skills/delivery-handoff/references/handoff-comment.md @@ -0,0 +1,99 @@ +# The Handoff comment + +One comment ends every stage, on success or on a stop. The next stage reads it first, and run mode +will later parse it, so the shape is fixed even though nothing validates it yet. + +## Rules + +- Six `##` headings, verbatim and in this order: `## Decisions`, `## Rejected`, `## Evidence`, + `## Next pointer`, `## Open questions`, `## Next command`. No other `##` headings. +- 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. +- **Open questions** carries the stop reason on a stop. + +## Template + +````markdown +## Decisions + +- + +## Rejected + +-