Skip to content

fix(ci): give the guard's long steps their own timeouts and declare gate refusals - #1721

Merged
c-vigo merged 8 commits into
devfrom
bugfix/1712-guard-step-timeouts
Sep 25, 2026
Merged

c-vigo merged 8 commits into
devfrom
bugfix/1712-guard-step-timeouts

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

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
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • 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 fix(ci): rewrite the guard verdict on gate failure or unlabel #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)
    • 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

  • Tests pass locally (just test)
  • 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

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • 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

Three failing shape tests for the release-neutral guard's timeout hole.

A job `timeout-minutes` expiry cancels the job, so the step that hung
reports `cancelled` and gate 6 — which runs under `!cancelled()` — is
skipped, leaving the last positive verdict standing over a run that
proved nothing. The tests pin the fix: the three long steps (`setup`,
`gate2`, `vulnix`) carry their own integer budgets whose sum stays
strictly below the job's, so a hang fails the STEP and the job lives on;
gate 6's scan selects the first outcome that is neither `success` nor
`skipped` rather than matching the literal `failure`; and a `cancelled`
outcome takes the infrastructure wording whichever step it was.

Refs: #1712
The assertion sliced from the word `cancelled`, which sits AFTER the
`$outcome` the same line reads, so the recorded-outcome check could never
match a correct implementation. Slice from the start of that line
instead. Still red: gate 6 does not test the outcome at all yet.

Refs: #1712
… verdict scan

A job `timeout-minutes` expiry CANCELS the job: the step that hung
reports `cancelled`, and gate 6 runs under `!cancelled()`, so a run that
timed out skipped the verdict entirely and left the last positive one
standing over a run that proved nothing. A label-event run cannot even be
superseded, so nothing else was going to rewrite it.

Closed from the step side. `setup` (10), `gate2` (10) and `vulnix` (60)
each carry their own budget, summing to 80 — under the job's 90 — so a
hang fails the STEP while the job lives on and gate 6 still runs. Measured
on the one `.vulnixignore` lane run to date, those steps take 41 s, 32 s
and 129 s: hang detectors, not tight budgets. The cancellations left are a
manual cancel and a lost runner, for which skipping the verdict is
correct — neither reached a conclusion.

The outcome scan now selects the first entry that is neither `success` nor
`skipped`, rather than matching the literal `failure` which read a
`cancelled` step as green, and a `cancelled` outcome takes the
infrastructure wording ("timed out or was cancelled before completing")
whichever step it was — including gate 2, whose failure is the lane's
central refusal. The per-step wording is unchanged for real failures.

The step `if:` conditions are deliberately NOT widened: `!cancelled()`
stays as #1705 wrote it. Letting a cancelled run post would also let a
manually cancelled or runner-lost label run overwrite a real verdict with
a refusal it never reached.

Refs: #1712
One sentence beside the gate 6 paragraph in the release-cycle doc, and a
`Fixed` changelog entry (mirrored into the scaffold copy by the
`sync-manifest` hook): a job timeout is a cancellation, so the long steps
carry their own budgets under the job's and the verdict scan reads any
non-green outcome.

Refs: #1712
…s one

A step killed by its own `timeout-minutes` exits `failure`, not
`cancelled`: the runner writes "The action '…' has timed out after N
minutes." and fails the step, while `cancelled` belongs to the
job-cancellation path — and a cancelled job never reaches gate 6 through
`!cancelled()`. So a `failure` outcome covers both "gate 2 refused this
change" and "gate 2 never finished", and the branch keyed on `cancelled`
is near-unreachable while the per-step wording libels a change nothing
examined.

The tests pin the rule instead: each of the five gates writes
`refused=true` to `$GITHUB_OUTPUT` where it states its refusal (the
vulnix extra exactly once, in the `vulnix-gate` branch — its scan-failure
exit is infrastructure), gate 6 reads those five declarations through a
`REFUSED` env and nothing for the checkout or the set-up, and the
per-gate refusal wording sits behind the declared flag so a failure
without one — a timeout, a crash, an unknown outcome — is reported as
infrastructure. Also replaces the now-vacuous ordering assertion in the
#1705 test and corrects the scan test's docstring.

Refs: #1712
A step killed by its own `timeout-minutes` exits `failure`, not
`cancelled`: the runner writes "The action '…' has timed out after N
minutes." and fails the step, while `cancelled` is the job-cancellation
path — and a cancelled job never reaches gate 6 through `!cancelled()`.
So the previous `cancelled` branch was near-unreachable, and a gate 2 or
vulnix step whose budget expired fell into the per-step `case` and was
reported as "This change is NOT release-neutral … gate 2 refused it": the
false refusal that branch existed to prevent, and the mirror image of the
defect #1705 fixed.

An outcome cannot say WHY a step is non-green, so the gates say it
themselves. Each of the five gates writes `refused=true` to
`$GITHUB_OUTPUT` on the path where it states its refusal — the vulnix
extra only in the `vulnix-gate` branch, since a scan that failed three
attempts says nothing about the register — and gate 6 reads those five
declarations through a new `REFUSED` env. The per-gate refusal wording is
now reachable only with a declaration; every other non-green outcome
(a failure without one, `cancelled`, an unrecognised or empty value) takes
the infrastructure wording, naming the step and asking for a rerun. The
checkout and the toolchain set-up keep their existing phrasing and are
given no flag: they have nothing to refuse.

Erring this way costs a rerun. Erring the other way tells a reviewer a
gate refused a change it never examined.

Refs: #1712
The changelog entry and the release-cycle sentence described the step
budgets as turning a hang into a `cancelled` step. The runner reports a
step that exhausts its own budget as `failure`, which is why gate 6 now
reads a declared `refused=true` rather than inferring a refusal from the
outcome. Both copies say that instead; the scaffold mirror is regenerated
by the `sync-manifest` hook.

Refs: #1712
Gates 3 and 5 wrote `refused=true` after listing the offending paths;
under `pipefail` a hiccup in that listing would have turned a real
refusal into an infrastructure failure. Declare first, then explain.

Refs: #1712
@c-vigo
c-vigo merged commit 69bc175 into dev Sep 25, 2026
15 checks passed
@c-vigo
c-vigo deleted the bugfix/1712-guard-step-timeouts branch September 25, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant