feat(delivery): add the delivery-handoff stage protocol skill #213

Merged
Defame1297 merged 5 commits from feat/delivery-handoff into main 2026-11-23 18:07:48 +00:00
6 changed files with 53 additions and 28 deletions
Showing only changes of commit d4226e152b - Show all commits

No files matched your search

+11
View File
@@ -140,6 +140,17 @@ the pointer the next stage starts from, open questions, and the command that lau
stage. The next stage reads it first.
_Avoid_: summary, status update
**Step mode**:
How v1 runs the delivery flow: a human launches each **Stage** session by hand, from the previous
**Handoff comment**'s Next command. The launch itself is the human's approval.
_Avoid_: manual mode, interactive mode
**Run mode**:
The later way the delivery flow runs: Gitea Actions workflows launch the next **Stage** on **Gate**
events, and the launcher checks the event's sender against the repo's human allowlist before
starting an agent.
_Avoid_: auto mode, autopilot
**Acceptance check**:
What the test author writes before any implementation, from a ticket's acceptance criteria: a
failing test where a test can express the criterion, otherwise a post-merge assertion about the
@@ -55,11 +55,11 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later
`tofu plan`;
- 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;
state only: the stage's gate label, if it has one, 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
@@ -17,8 +17,10 @@ metadata:
- `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.
- 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:
Gitea would then drop the gate label when you add Ready for Human. Never re-add it yourself.
## Step 1 — Read the repo's delivery doc
@@ -32,10 +34,8 @@ File missing, first line not `# Delivery`, or the allowlist section missing or e
## 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). A Handoff comment carries six `##` headings: `## Decisions`, `## Rejected`, `## Evidence`,
`## Next pointer`, `## Open questions`, `## Next command`. Read `references/gates.md` now: its
§Inbound Handoff comment says which one is yours, or when to stop. Read it before anything else on
the item. The rule there says stop → **Stop**.
fields). Find the latest Handoff comment and apply `references/gates.md` §Inbound Handoff comment;
if it says stop → **Stop**.
## Step 3 — Check the gate
@@ -57,6 +57,10 @@ with the Next command filled for your stage, and post it where its Rules say. Th
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 `<name>`". Next command
relaunches your own stage, filled per that file's stop row.
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. The latest real Handoff comment stays the pointer, and nothing
relaunches you: a relaunch must come from that pointer, or the inbound rule is bypassed.
- **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>`".
@@ -8,21 +8,28 @@ and PR fields and reviews through `gitea-prs`. Every check reads tracker state o
| 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 | 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` | — | — | Not defined yet: defined in slice 4 with the planner |
| spec, tickets | `delivery-planner` | — | — | None in v1: the planner stops at the inbound check (below); gates come in slice 4 |
## Inbound Handoff comment
Look at the latest Handoff comment on the issue or PR you were pointed at:
A Handoff comment is a comment whose `##` headings are exactly the six listed in
`references/handoff-comment.md` §Rules, in that order. Ignore every other comment: a quote of one,
a plain stop comment, a partial one. Find the latest Handoff comment on the item you were pointed
at:
- Its `## Next command` launches your stage's agent → it is your inbound comment. A stop's own
comment relaunches the stage that stopped, so a relaunch after the human resolves it lands here.
A relaunch does not bypass the gate: every gate check in your row still runs. Gate labels stay
the human's to re-add or remove.
- 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.
- Its `## Next command` launches your stage's agent → it is your inbound comment. A stop after this
check passed posts a Handoff comment relaunching the stopped stage, so its relaunch lands here and
runs every gate check in your row again.
- There is none → proceed only if your row says Optional; otherwise stop with "no inbound Handoff
comment".
- It launches a different agent, or its Next command is `none` (the final stage) → stop with
"latest Handoff comment does not launch `<your agent>`".
Every stop in this section posts a plain comment, not a Handoff comment (`SKILL.md` §Stop). The
human removes `Status/Ready for Human` before relaunching; the agent does not check it.
## Verify: review conditions
Read the PR's reviews (`pull_request_read`, method `get_reviews`). A review counts only when all of
@@ -35,13 +42,11 @@ these hold:
## Stop reasons
Quote the failed check as the Open questions reason. Typical wordings:
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"
- any stage: "latest Handoff comment does not launch `<your agent>`"
- review, verify: "no inbound Handoff comment"
- review: "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>` stage in v1"
- a stage lead not in the table: "no stage defined for agent `<name>`"
@@ -1,6 +1,7 @@
# The Handoff comment
One comment ends every stage, on success or on a stop. The next stage reads it first, and run mode
One comment ends every stage, on success or on a stop after the inbound check passed; a stop before
it posts a plain comment instead (`SKILL.md` §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
@@ -13,7 +14,8 @@ will later parse it, so the shape is fixed even though nothing validates it yet.
issue. On a stop, it is the item you were pointed at.
- **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 on the item you were pointed at.
comments are issue comments. On a stop, post it — or the plain stop comment — on the item you
were pointed at.
## Template
@@ -57,7 +59,7 @@ Fill `<agent>`, `<stage>` and `<url>` with real values; `<url>` is the Next poin
| 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 |
| verify | — | — | Last stage: the section is `none` |
| any stage, on a stop | 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 |
`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.
@@ -106,7 +108,7 @@ A review stage stopping on that PR ends its comment with:
````markdown
## Open questions
- missing skill `code-review`
- missing skill `delivery-review`
## Next command
@@ -158,3 +158,6 @@ The values in the skeleton are illustrative only; every real value comes from th
- [ ] 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.