fix(delivery): keep inbound-rule stops out of the handoff trail

Why: every Stop posted a Handoff comment whose Next command relaunched the
stopping agent, including stops raised by the inbound rule itself. A second
launch then passed the inbound check, and a wrong-agent stop buried the
correct pointer.

Implementation Notes:
- Stops before the inbound check passed (Steps 1-2) post a plain comment;
  later stops keep the relaunching Handoff comment.
- gates.md defines a Handoff comment strictly and owns the inbound stop
  wordings; the planner stops at the inbound check in v1.
- Heading names and where-to-post live once, in handoff-comment.md.
- Gotcha and delivery-repo-doc checklist item: the two Status labels must
  not share an exclusive scope.
- GLOSSARY gains Step mode and Run mode; ADR-0032 scopes the gate-label
  check to stages that have one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-23 17:21:51 +00:00
1 parent fc09f77fb3
commit d4226e152b
6 files changed
+53 -28

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. stage. The next stage reads it first.
_Avoid_: summary, status update _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**: **Acceptance check**:
What the test author writes before any implementation, from a ticket's acceptance criteria: a 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 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 it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later
`tofu plan`; `tofu plan`;
- in step mode (v1) the human launching a stage is the approval, and stage leads check gate - 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, state only: the stage's gate label, if it has one, is present, and for verify the PR is
non-dismissed approval by a user on the human allowlist in `docs/agents/delivery.md`. The merged with a non-stale, non-dismissed approval by a user on the human allowlist in
who-set-the-label check moves to the run-mode launcher, which checks the triggering event's `docs/agents/delivery.md`. The who-set-the-label check moves to the run-mode launcher, which
sender against the allowlist before starting an agent; it is deterministic, so it belongs in checks the triggering event's sender against the allowlist before starting an agent; it is
the workflow, not an agent; 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 - 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, (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 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 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, `Status/Ready for Agent`, a PR approval — is human-only: never set, add or remove a gate label,
and never approve a PR. and never approve a PR.
- Check gate *state*, not who set it. In step mode the human launching your stage is the approval; - 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. 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 ## 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 ## 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 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`, fields). Find the latest Handoff comment and apply `references/gates.md` §Inbound Handoff comment;
`## Next pointer`, `## Open questions`, `## Next command`. Read `references/gates.md` now: its if it says stop → **Stop**.
§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**.
## Step 3 — Check the gate ## 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: 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`. 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 2. Post one comment where `references/handoff-comment.md` §Rules says a stop posts:
reason; for a missing skill use the format's wording, "missing skill `<name>`". Next command - **Before the inbound check passed** (Step 1 or Step 2) → a plain comment stating the reason,
relaunches your own stage, filled per that file's stop row. 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` | | 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:` | | 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 | | 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 ## 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 - You are `delivery-planner` → stop with "no gate defined for the spec or tickets stage in v1":
comment relaunches the stage that stopped, so a relaunch after the human resolves it lands here. there is no stage to relaunch into in v1.
A relaunch does not bypass the gate: every gate check in your row still runs. Gate labels stay - Its `## Next command` launches your stage's agent → it is your inbound comment. A stop after this
the human's to re-add or remove. 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 - There is none → proceed only if your row says Optional; otherwise stop with "no inbound Handoff
comment". comment".
- It launches a different agent, or its Next command is `none` (the final stage) → stop with - It launches a different agent, or its Next command is `none` (the final stage) → stop with
"latest Handoff comment does not launch `<your agent>`". "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 ## Verify: review conditions
Read the PR's reviews (`pull_request_read`, method `get_reviews`). A review counts only when all of 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 ## 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" - 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:`" - review: "PR title still starts `WIP:`"
- verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor - verify: "PR not merged"; "no approval from an allowlisted human that is neither stale nor
dismissed" 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>`" - a stage lead not in the table: "no stage defined for agent `<name>`"
@@ -1,6 +1,7 @@
# The Handoff comment # 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. will later parse it, so the shape is fixed even though nothing validates it yet.
## Rules ## 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. issue. On a stop, it is the item you were pointed at.
- **Open questions** carries the stop reason on a stop. - **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 - 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 ## Template
@@ -57,7 +59,7 @@ Fill `<agent>`, `<stage>` and `<url>` with real values; `<url>` is the Next poin
| implement | `delivery-reviewer` | review | — | | 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 | `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` | | 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` 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. `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 ````markdown
## Open questions ## Open questions
- missing skill `code-review` - missing skill `delivery-review`
## Next command ## 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 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. - [ ] Section 5 holds paths and markdown links, no secret values.
- [ ] Root `AGENTS.md` carries the pointer line exactly once. - [ ] 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.