Skip to content

guardrails: block-unresolved-pr-merge counts a superseded cancelled run as failing #8255

Closed

Description

@kyle-sexton

Problem

The guardrails hook block-unresolved-pr-merge refused a guarded merge of #8247 and reported failing checks. The newest ci-status run on the head had passed (run 39137521225). The checks it counted came from an older run on the same head, 39137509879, whose jobs were cancelled when the newer run superseded it. Re-running the cancelled run (gh run rerun 39137509879) made it pass, and the merge then went through.

Expected: a cancelled check run is superseded by a newer completed run of the same check on the same head, so the merge is not blocked. The supersede logic is meant to do this (plugins/guardrails/hooks/block-unresolved-pr-merge.sh:536-562, #7549). Either a case slips past that logic, or the matrix-leg rule (<name> (<leg>)) does not match how this repository's CI names its legs (test-bash (0), test-python (0)).

The rerun replaced the cancelled run's original job data, so the exact check-run set that tripped the hook is no longer visible on 39137509879. The fix needs a fixture rebuilt from the check-runs API shape: a cancelled run in one check suite, plus a newer successful run of the same workflow in another check suite with matrix legs.

Fix

Find the check-run shape that the jq at block-unresolved-pr-merge.sh:552-562 leaves counted as cancelled, and supersede it with the newer successful run of the same check.

Verification

Workaround until fixed: re-run the cancelled run, then retry the merge.

Activity

  1. added
    needs-triage
    on Oct 18, 2026
  2. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    Thanks for the report. Automated triage handed this issue to a maintainer.

    Proposed work class: work-class: scoped
    Basis: automated intake triage; a maintainer confirms or changes it.

    Automated triage. A maintainer reviews it.

  3. added
    needs-human
    and removed
    needs-triage
    on Oct 18, 2026
  4. added
    status: confirmed
    and removed
    needs-human
    on Oct 19, 2026
  5. kyle-sexton commented on Oct 19, 2026

    @kyle-sexton
    MemberAuthor

    Moved here from #8401, a duplicate of this issue under a different name. It has the check-run set this issue says is no longer visible.

    PR #8397, head fcdfcf0f4185f05d50264ed9d64b0572ac1f025c (guardrails 0.52.0), check runs on the head (GET commits/<sha>/check-runs):

    started_at name conclusion
    05:42:12Z test-bash cancelled
    05:42:12Z test-python cancelled
    05:42:12Z ci-status cancelled
    05:42:42Z test-bash (0) success
    05:42:42Z test-python (0) success
    05:45:43Z ci-status success

    The hook blocked with Failing checks: test-bash, test-python. The cancelled runs use the bare names, and the runs that replaced them use the (<leg>) names. That points at the second hypothesis above: the supersede logic doesn't match a bare-name cancelled run to its newer (0) leg. The fixture for the stay-quiet test is this table.

  6. kyle-sexton commented on Oct 19, 2026

    @kyle-sexton
    MemberAuthor

    A second case of this bug, from #8401, which is being closed as a duplicate of this issue: the replacement checks carry a different name from the cancelled ones. On PR #8397 (head fcdfcf0f4185f05d50264ed9d64b0572ac1f025c), the hook refused a guarded merge with "Failing checks: test-bash, test-python". Those check runs had been cancelled and replaced by successful runs under different names. The current supersede logic (block-unresolved-pr-merge.sh:540-561) matches only the same name or a "name (...)" pattern. A fix must cover both cases, with a stay-quiet test for each.

  7. kyle-sexton commented on Oct 20, 2026

    @kyle-sexton
    MemberAuthor

    Closing as fixed by #7823, which shipped in guardrails 0.53.0. Checked against main:

    • plugins/guardrails/hooks/block-unresolved-pr-merge.sh:637-639: a cancelled run counts as superseded when a newer successful run of the same app, in another check suite, is named <name> (...). A matrix job cancelled before it expanded reports under its bare name.
    • The fix(pr-pipeline): skip a write lane the broker refuses for a workflow file the PR changes #8247 case (run 39137509879, cancelled bare test-bash/test-python, then run 39137521225 with test-bash (0)/test-python (0) passing) is the matrix-cancelled-then-legs fixture in block-unresolved-pr-merge.test.sh:144, asserted green at :299.
    • A newer run under a truly different name is still blocked on purpose (matrix-other-name). Same-name cancelled checks are cleared by the newest-by-id rule.
    • 0.53.0 shipped before this issue was filed. The guardrails: block-unresolved-pr-merge counts cancelled, superseded check runs as failing #8401 data recorded the installed hook as 0.52.0 on 2026-10-19, so the install lagged the release.

    Reopen if it recurs on guardrails 0.53.0 or later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmed

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions