From 42301cf38ed45f95568dfffc748b9d6493bdd7dd Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Wed, 25 Nov 2026 09:22:36 +0000 Subject: [PATCH] fix(delivery): close the skipped-gate hole in dry-run-gated A gated workflow whose job-level label condition is unmet posts skipped, and a later label event on the same SHA posts a newer skipped that would mask an earlier gated failure. delivery-ci-checks now ignores skipped statuses for a dry-run-gated check and takes the latest of the rest, reading none as awaiting-gate. The format exempts dry-run-gated from the skipped-passes rule and requires the workflow to run only on its named gate label; the gatherer confirms that filter and takes a gated check's name from the forge or lists it as open. The review's awaiting-gate finding links the PR's files view, the implement lead and delivery-handoff name the gated dry run's label as human-only, and qa's and the lead's restatements are trimmed. Refs: #218 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi --- .../agents/delivery-implement-lead.agent.md | 10 +++++----- .../delivery/.apm/agents/delivery-qa.agent.md | 8 ++++---- .../delivery-ci-checks/references/statuses.md | 18 +++++++++++------- .../.apm/skills/delivery-handoff/SKILL.md | 6 +++--- .../delivery-repo-doc/references/format.md | 9 +++++---- .../delivery-repo-doc/references/gathering.md | 10 +++++++--- .../delivery-review/references/checklist.md | 3 ++- 7 files changed, 37 insertions(+), 27 deletions(-) diff --git a/plugins/delivery/.apm/agents/delivery-implement-lead.agent.md b/plugins/delivery/.apm/agents/delivery-implement-lead.agent.md index e7fc4fe..38b6ef4 100644 --- a/plugins/delivery/.apm/agents/delivery-implement-lead.agent.md +++ b/plugins/delivery/.apm/agents/delivery-implement-lead.agent.md @@ -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 @@ -113,8 +114,7 @@ with blocking findings. On a PR, the issue is the one its body's `Closes #` 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. An `awaiting-gate` name is never a fail and never - counts toward this limit. + "QA failed 3 rounds" and the last findings. - `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 diff --git a/plugins/delivery/.apm/agents/delivery-qa.agent.md b/plugins/delivery/.apm/agents/delivery-qa.agent.md index cd457d6..5dad0e4 100644 --- a/plugins/delivery/.apm/agents/delivery-qa.agent.md +++ b/plugins/delivery/.apm/agents/delivery-qa.agent.md @@ -34,9 +34,8 @@ 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: ` → `stop`, because - 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. + 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. @@ -47,7 +46,8 @@ the tool skill names. 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 diff --git a/plugins/delivery/.apm/skills/delivery-ci-checks/references/statuses.md b/plugins/delivery/.apm/skills/delivery-ci-checks/references/statuses.md index c636753..597e330 100644 --- a/plugins/delivery/.apm/skills/delivery-ci-checks/references/statuses.md +++ b/plugins/delivery/.apm/skills/delivery-ci-checks/references/statuses.md @@ -31,18 +31,22 @@ | 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 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. +- `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. Adding, removing or - re-adding it is the human's act, never yours. + 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 diff --git a/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md b/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md index 2b053f2..2c69930 100644 --- a/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md +++ b/plugins/delivery/.apm/skills/delivery-handoff/SKILL.md @@ -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: diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md index 251fa3d..a8861b6 100644 --- a/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/format.md @@ -54,10 +54,11 @@ syntax. A format change is an edit here, plus every consumer's restatement. - `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. + 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 diff --git a/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md index 691cda2..aa0479a 100644 --- a/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md +++ b/plugins/delivery/.apm/skills/delivery-repo-doc/references/gathering.md @@ -35,6 +35,9 @@ repo; facts only a human holds come from the human. A value with no source stays `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 @@ -74,9 +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 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. +- 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". diff --git a/plugins/delivery/.apm/skills/delivery-review/references/checklist.md b/plugins/delivery/.apm/skills/delivery-review/references/checklist.md index 0ea9a7c..61c0700 100644 --- a/plugins/delivery/.apm/skills/delivery-review/references/checklist.md +++ b/plugins/delivery/.apm/skills/delivery-review/references/checklist.md @@ -140,7 +140,8 @@ be encrypted and is not is itself the finding. 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 `` has not run yet; the approver judges its output once it does", with no job link. +run `` has not run yet; the approver judges its output once it does", linking +`/files`. `success` → read its job log: ```text