Repository navigation
🐛 ci gate: ignore held runs whose workflow already passed on the head and name same-repo bot PRs - #13822
Conversation
… and name same-repo bot PRs A GITHUB_TOKEN-opened same-repo PR (hivecommons/docs#428) had its pull_request runs held action_required while the opener dispatched the same workflows by workflow_dispatch on the same head, all green. The gate counted the held runs as red with a fork-PR message although the PR is not from a fork and the repo's approval policy is already at its minimum. A held run whose workflow has a successful run on the same head is now reported as ignored and does not gate; without such a twin, the reason distinguishes a fork PR from a same-repo PR opened by a bot token. Fixes #13818 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Changelog fragment in the wrong directoryFragments live in git mv src/changelog.d/fixed-13818-ci-gate-held-twin-runs.md changelog.d/fixed-13818-ci-gate-held-twin-runs.md
git commit -s -m "changelog: move fragment to repo-root changelog.d/"See |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this repository have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 94cf9ff. |
There was a problem hiding this comment.
Logic looks correct to me; one concrete blocker — the changelog fragment is in the wrong directory, which is why changelog-fragment-guard is red.
Blocker (medium — CI):
src/changelog.d/fixed-13818-ci-gate-held-twin-runs.md— fragments live in repo-rootchangelog.d/(310 files onv5); files undersrc/changelog.d/are never compiled intoCHANGELOG.mdand the guard fails on them (job 120542887969: "Changelog fragment in the wrong directory").git mv src/changelog.d/fixed-13818-ci-gate-held-twin-runs.md changelog.d/fixes the check. The filename itself is valid.
What I verified in the tree at 94cf9ff:
merge_ci_gate.go:366-382—succeededis computed from the samelatestslice (one run per workflow×event) and keyed byWorkflowID, so apull_requestrun can only be waived by a success of the same workflow on the same head;TestMergeCIGate_HeldRunStillBlocksWhenOnlyOtherWorkflowSucceededpins the negative case. Required check-run evaluation is untouched, so the twin's check runs still gate.merge_failure_alert.go:202-213— the existing fork case matches on"fork pr workflow runs are awaiting…"; the new same-repo reason string (merge_ci_gate.go:491) does not contain that substring, so the new case is reachable and not shadowed. Reusing keyfork-run-approvalkeeps the existing revalidation path.merge_ci_gate.go:481-484—pullRequestIsFromForkreturns false whenhead.repois null (deleted fork). That yields the same-repo wording for a PR whose fork was deleted; such a PR cannot merge anyway, so this is cosmetic (info).
Note on the body: it lists "pullRequestIsFromFork cases" under Tests, but the five changed files contain only the three new TestMergeCIGate_* tests; the helper is exercised indirectly via …SameRepoRunNamesBotTokenCause and the pre-existing fork-alert test. Not a defect — just so the description matches.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
The code looks correct to me; the one red check is the fragment's location, not the code.
Blocker (why changelog-fragment-guard is red): src/changelog.d/fixed-13818-ci-gate-held-twin-runs.md is under src/. Fragments live at the repository root — src/changelog.d/README.md:1-6 says so and names this check. Fix: git mv src/changelog.d/fixed-13818-ci-gate-held-twin-runs.md changelog.d/. (Same slip as #13821.)
What I verified in the tree (94cf9ff):
src/pkg/github/merge_ci_gate.go:355-356lists runs withHeadSHA: sha, soworkflowsWithSuccessfulRun(:468-476) can only be satisfied by a twin on the same head — aworkflow_dispatchsuccess on an older commit cannot excuse a heldpull_requestrun. The twin check is keyed onWorkflowID, soTestMergeCIGate_HeldRunStillBlocksWhenOnlyOtherWorkflowSucceededcorrectly keeps a different workflow's success from counting.:372-383thecontinuefor held-but-verified runs skips thepending/actionRequiredbookkeeping only; required-check evidence still comes from check runs, so a held run with no successful twin still lands inactionRequiredand blocks (:244).pullRequestIsFromFork(:483-486) compares head/base repo full names case-insensitively and treats missing names as not-fork, which only changes the wording of the refusal, never whether it refuses.src/pkg/github/merge_failure_alert.go:201-213: the newsame-repo pr workflow runs are awaiting maintainer approvalcase cannot be captured by the earlierfork pr workflow runs are awaiting maintainer approvalcase (different leading words), and reusing keyfork-run-approvalmeans the existing revalidation clears it the same way.- Body matches the diff. For what it's worth, this is exactly the state of hivecommons/docs#428 right now:
pull_requestruns held,workflow_dispatchtwins green.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Fixes #13818
What
Banner
Merge blocked for hivecommons/docs: fork PR workflow runs are awaiting maintainer approval…is about hivecommons/docs#428 — a same-repo PR opened daily bygithub-actions[bot](GITHUB_TOKEN,peter-evans/create-pull-request). GitHub holds its fourpull_requestrunsaction_required; the opener workflow dispatches the same four workflows byworkflow_dispatchon the same head, allsuccess. The repo's approval policy is alreadyfirst_time_contributors_new_to_github(the minimum), so the banner's advice cannot be followed.opaqueWorkflowRuns: anaction_requiredrun whose workflow already has a completedsuccessrun on the same head (any event) goes toheldButVerified— reported in the green reason asheld run(s) … ignored, not counted as gating. The verdict is on the head through the twin's check runs.pullRequestIsFromFork), andclassifyMergeFailureForOperatormaps the new wording to the samefork-run-approvalalert key so the existing 5-minute revalidation clears both.The hive still never calls the workflow-run approval API.
Tests
merge_ci_gate_test.go: held runs with successful workflow_dispatch twins → green with the ignored list; held run without a twin on a same-repo PR → red with the same-repo wording; fork PR wording preserved;pullRequestIsFromForkcases. Notime.Sleepadded.Docs:
hive-merge.md, changelog fragment.Verified
go build ./... && go vet ./pkg/github/ && go test ./pkg/github/.