Repository navigation
fix(ci): rewrite the guard verdict on gate failure or unlabel - #1713
Merged
Merged
Conversation
Gate 6 runs under a bare `if: env.ACTIVE == 'true'`, whose implicit
`success()` skips it after any gate failure and on the `unlabeled`
payload. Since the verdict comment became sticky, the last positive
verdict is then the pull request's single permanent verdict.
Six shape assertions: the `!cancelled()` condition (not `always()`, and
in the `${{ }}` form), the DEACTIVATED discriminator read from
`github.event.label` because ACTIVE and LABELLED are both false by then,
an `id` on every gated step with its outcome read by gate 6, the
positive wording behind the outcome test, the infrastructure/refusal
distinction, and a deactivation branch that only ever PATCHes and never
touches the worktree.
Refs: #1705
Gate 6 ran under a bare `if: env.ACTIVE == 'true'`, whose implicit `success()` skipped it after any gate failure and on the `unlabeled` payload — so the last positive verdict stood as the pull request's single, permanent verdict text. It now runs on `!cancelled() && (ACTIVE || DEACTIVATED)` and writes one of three bodies: the unchanged verdict, a refusal naming the first failing step (distinguishing a gate refusal from an infrastructure failure), or an inactive stub once the lane label is removed. Every gated step gained an `id`, the checkout and `setup-env` included, since a failure there leaves the gates `skipped` rather than `failure`. `DEACTIVATED` is a third discriminator read from `github.event.label`: the `unlabeled` payload has already dropped the label from `pull_request.labels`, so ACTIVE and LABELLED are both false there. Not `always()`, which would let a run cancelled by a superseding head overwrite the comment with a refusal it never reached. The two non-green bodies never read the worktree — a deactivated run checks nothing out and a failed gate 2 leaves the tree on the base ref — and deactivation only PATCHes, so a pull request labelled and unlabelled without a verdict gets no comment. `GH_REPO` is set for the `gh pr comment` fallback, which can now run without a checkout. The shape test's gated-step scan compares steps from one parse, not two. Refs: #1705
The gate 6 row in RELEASE_CYCLE.md named only the sticky-comment upsert, which read as one verdict body. It now names all three and the paragraph after the table says why `!cancelled()` rather than `always()` and why a skipped gate is not a passing one. Changelog entry under Unreleased/Fixed, mirrored into the scaffold copy. Refs: #1705
c-vigo
added a commit
that referenced
this pull request
Sep 25, 2026
…ate refusals (#1721) ## Description #1705 made gate 6 of `release-neutral-guard.yml` run on `!cancelled()` so a gate failure or an unlabel rewrites the sticky verdict. One residual of the same class stayed: the job's `timeout-minutes: 90` expiry *cancels* the job, so gate 6 is skipped and the last positive verdict stands over a run that proved nothing. Worse, the in-flight step's outcome under a timeout is `cancelled`, not `failure` — so even the `if:` widening the issue proposed would have fallen through to the **green** body, because the scan matched the literal `failure`. Three changes, and one deliberate non-change: - **Step budgets.** `setup` 10, `gate2` 10, `vulnix` 60 minutes — summing to 80, under the job's 90 — so a hang fails the *step* while the job lives on to reach gate 6 under the untouched `!cancelled()`. Measured on the one `.vulnixignore` lane run so far (set-up 41 s, gate 2 32 s, the extra 129 s), these are hang detectors, not tight budgets; the 60 leaves room for a cold-NVD rebuild of `main`'s closure. - **Declared refusals.** The runner reports a step that exhausted its own budget as `failure` — indistinguishable from a gate refusing the change, so gate 6 would have called a gate 2 timeout "**gate 2** refused it". A refusal is now something a gate **declares**: each of the five gates writes `refused=true` to `$GITHUB_OUTPUT` on the path where it states its refusal (the vulnix extra only in its `vulnix-gate` branch, never in the scan-failure branch), and gate 6 reads them through a `REFUSED` env. The per-gate refusal wording is used only when the flag is set; every other non-green outcome — a failure with no declaration, a cancellation, an unrecognised value — is worded as infrastructure ("failed or timed out … before reaching a verdict"), naming the step and asking for a rerun. Erring that way costs a rerun; erring the other way tells a reviewer a gate refused a change it never examined. - **Non-green scan.** Gate 6 now takes the first outcome that is neither `success` nor `skipped` (the two green outcomes are enumerated), so an unexpected outcome can no longer fall through to the positive verdict. - **The `if:` is not widened.** With step budgets in place the only cancels left are a manual cancel and a lost runner, and for those skipping gate 6 is correct: a label run cancelled by hand must not have its real verdict overwritten by a refusal it never reached. Declined explicitly so the issue's proposal does not read as half-done. ## Type of Change - [ ] `feat` -- New feature - [x] `fix` -- Bug fix - [ ] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [x] `test` -- Adding or updating tests - [x] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made `.github/workflows/release-neutral-guard.yml` - `timeout-minutes` on the `setup`, `gate2` and `vulnix` steps with a STEP BUDGETS comment; job budget unchanged - Gates 1, 3, 5, 2 and the vulnix extra write `refused=true` to `$GITHUB_OUTPUT` on their refusal path - Gate 6: `REFUSED` env over the five gates; scan `case "${entry#*=}" in success | skipped) continue ;; esac`; refusal wording only behind `"$refused" = true`, else infrastructure; the `# Residual (#1712)` note from #1713 replaced by the resolution `tests/test_workflow_release_neutral.py` - `test_long_steps_carry_their_own_timeout` (integer budgets on the three ids, sum strictly below the job budget — the load-bearing assertion), `test_verdict_scan_treats_any_non_green_outcome_as_non_green`, `test_every_gate_declares_its_refusal`, `test_the_vulnix_extra_declares_only_its_own_refusal` (exactly once, after the `vulnix-gate` call), `test_verdict_reads_every_gate_s_refusal_flag`, `test_verdict_words_an_undeclared_failure_as_infrastructure` (and `cancelled` absent from the verdict code); the pre-existing `test_gate_6_refuses_instead_of_repeating_the_positive_verdict` now pins the refusal wording behind the flag. All RED before their implementation commits `docs/RELEASE_CYCLE.md`, `CHANGELOG.md`, `assets/workspace/.devcontainer/CHANGELOG.md` - One sentence in the gate 6 paragraph; `### Fixed` entry, mirror regenerated by the `sync-manifest` hook ## Changelog Entry ### Fixed - **A hung release-neutral guard no longer leaves its last positive verdict standing** ([#1712](#1712)) - The job's `timeout-minutes` expiry *cancels* the job, so gate 6 — which runs on `!cancelled()` — was skipped: a run that proved nothing left the previous "This change is release-neutral" comment as the pull request's only verdict, and a label-event run cannot even be superseded, so nothing else would rewrite it. The toolchain set-up, gate 2 and the `.vulnixignore` extra now carry their own step budgets (10, 10 and 60 minutes, summing to less than the job's 90), so a hang expires a *step's* budget first and the job survives to report it. - Which raises the opposite hazard, since the runner reports a step that exhausted its own budget as `failure` — indistinguishable from a gate refusing the change, and gate 6 would have called it "**gate 2** refused it". A refusal is now something a gate **declares**: each of the five gates writes `refused=true` where it states its refusal, and gate 6 words a refusal only where one was declared. Every other non-green outcome — a failure with no declaration, a cancellation, an unrecognised value — is reported as infrastructure, naming the step and asking for a rerun. The outcome scan also no longer selects on the literal `failure`, so an unexpected outcome can no longer fall through to the positive verdict. ## Testing - [x] Tests pass locally (`just test`) - [x] Manual testing performed (describe below) ### Manual Testing Details - Gate 6's bash extracted and run against a stubbed `gh` for eight cases: `gate2=failure` with and without the flag (refusal vs "failed or timed out … before reaching a verdict"), `vulnix=failure` with and without, `gate1=failure` + flag, `checkout=failure`, `gate2=cancelled`, all-green (unchanged verdict + table + file list); all rc=0. The all-empty `REFUSED` string the folded scalar produces was exercised too - `actionlint` clean; `uv run pytest tests/test_workflow_release_neutral.py tests/test_workflow_zizmor_baseline.py -q` → 53 passed; adjacent changelog/docs suites → 90 passed - `prek run --all-files` → 55 hooks passed ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published ## Additional Notes - The timeout path cannot be exercised live; the stubbed-`gh` run and the shape tests are the evidence. The declaration relies on a failed step's `$GITHUB_OUTPUT` writes still being exposed as `steps.<id>.outputs` (standard runner behaviour); the next lane PR that trips gate 1 or 3 confirms it live. - The reviewer's first pass caught that a step killed by its own `timeout-minutes` reports `failure`, not `cancelled` — the first version of this branch keyed the infrastructure wording on `cancelled` and would have mis-worded a gate 2 timeout as a refusal. The declared-refusal rule replaced it. - The `setup` step is a `uses:` of a local composite action. GitHub does not support `timeout-minutes` on steps *inside* a composite; at the caller level it applies to the whole step, which is what is set here. The two steps that could realistically hang (`gate2`, `vulnix`) are plain `run:` steps. Refs: #1712
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Gate 6 of
release-neutral-guard.yml— the sticky verdict comment (#1698) — ran under a bareif: env.ACTIVE == 'true', whose implicitsuccess()skipped it after any gate failure and on theunlabeledevent. The last positive verdict then stood as the PR's single, permanent verdict: a reviewer read "This change is release-neutral" after a gate-2 refusal, or after the label had been pulled. The guard is not a required check onmain, so nothing else contradicted it.The issue's proposed
if: always() && (env.ACTIVE == 'true' || env.LABELLED == 'true')cannot fire on the unlabel it targets: on anunlabeledpayload the label is already gone frompull_request.labels, soACTIVEandLABELLEDare both false. This adds a third discriminator,DEACTIVATED, read fromgithub.event.label, and runs gate 6 on!cancelled()(neveralways(): a run cancelled by a superseding head reached no conclusion and must not overwrite the comment).Gate 6 now writes one of three bodies:
skipped— andskippedis notfailure);<head sha>, any verdict that stood here is withdrawn", PATCH-or-nothing, so a PR labelled and unlabelled without being judged gets no comment.Both non-green bodies are tree-free by design: a deactivated run never checked anything out, and a failed gate 2 or vulnix extra leaves the worktree parked on the base ref because the
git checkout -q -restore comes after the failing command. The marker lookup, PATCH-before-create order and prune-all-but-newest convergence from #1698 are unchanged.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
.github/workflows/release-neutral-guard.ymlDEACTIVATED: github.event.action == 'unlabeled' && github.event.label.name == 'release-neutral'id:on everyACTIVE-gated step (checkout,gate1,gate3,gate5,setup,gate2,vulnix)if: ${{ !cancelled() && (env.ACTIVE == 'true' || env.DEACTIVATED == 'true') }},continue-on-error: truekept; step envOUTCOMESlists every gated step's.outcomein run order,HEAD_SHAis the PR head (not the merge commit),GH_REPOlets thegh pr commentfallback work without a checkoutfailureinOUTCOMES, else the existing verdict; the create is gated onmay_create, which deactivation clearstests/test_workflow_release_neutral.pyif(hascancelled(), noalways(),${{ }}form, both env clauses,continue-on-error);DEACTIVATEDkeyed onunlabeled+ the lane label; every gated step has an id whose outcome gate 6 reads; positive wording sits behind the outcome test; infrastructure vs refusal distinction; deactivation is PATCH-only and neither non-green branch containsgit. RED: 6 failed / 35 passed; GREEN: 41 passed. Shape rule 1 (test_guard_job_has_no_job_level_if) untoucheddocs/RELEASE_CYCLE.md!cancelled(), the outcome reads and the edit-only stub (not a generated doc)CHANGELOG.md,assets/workspace/.devcontainer/CHANGELOG.md### Fixedentry under## Unreleased, identical in bothChangelog Entry
Fixed
(#1705)
if: env.ACTIVE == 'true', whoseimplicit
success()skipped it after any gate failure and on theunlabeledevent. Since the verdict became a single sticky comment, the last positive
verdict then stood as the pull request's only — and permanent — verdict: a
reviewer read "This change is release-neutral" after a gate-2 refusal, or
after the label had been pulled. The guard is not a required check, so
nothing else contradicted it.
!cancelled()— neveralways(), since a run cancelledby a superseding head reached no conclusion — and writes one of three bodies:
the unchanged verdict, a refusal naming the first failing step and saying
whether that was a gate refusal or an infrastructure failure, or an
"inactive" stub when the lane label is removed. Every gated step carries an
idso gate 6 can read its outcome, the checkout and the toolchain set-upincluded: a failure there skips the gates, and
skippedis notfailure.github.event.label, because theunlabeledpayload has already dropped thelabel from the pull request's label set. It only ever edits an existing
verdict, so a pull request labelled and unlabelled without being judged gets
no comment at all; and neither non-green body reads the worktree, which after
a failed gate 2 is still parked on the base ref.
Testing
just test)Manual Testing Details
uv run pytest tests/test_workflow_release_neutral.py tests/test_workflow_zizmor_baseline.py tests/test_workflow_summary_gate.py -q→ 106 passed; whole Python suite minus image/integration/bats → 1192 passed, 1 skippedghfor six scenarios — deactivated with and without an existing marker comment, gate2 failure, setup failure, checkout failure, green — each produced the expected body and API calls (PATCH / create / nothing), all rc=0, including from a directory that is not a git repositoryactionlint .github/workflows/release-neutral-guard.ymlclean (it caught one SC2016 on the way, fixed)prek run --all-files→ all 53 hooks passedmain-targeting PR that fails a gate or drops the labelChecklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Triage with the failure-mode analysis is on the issue. The one residual of the same class — a job timeout is also a cancellation, so a timed-out label-event run would still leave the previous verdict standing — is filed as #1712 rather than widened into this fix. The fix protects
main-targeting PRs once it is on the PR's merge ref, i.e. after it reachesmainwith the next train or via the lane itself.Refs: #1705