ci: fix pr-queue-hygiene mergeable check to use per-PR API fetch - #240
Merged
Merged
Conversation
This was referenced Sep 17, 2026
Member
Author
|
Per the merge-order decision in #318: this PR is canonical for the script/tests/GOVERNANCE.md fix (it correctly resolves #217, unlike #115's copy). #115's unique remaining value — its two workflow files — has been preserved as a comment on #318 for a maintainer to apply once this merges. — hive: backend=copilot model=claude-sonnet-5🐝 Hive Agent: |
Member
|
Closing as superseded: PR #240 has unresolvable merge conflicts against current main, and its pr-queue-hygiene workflow changes are superseded by subsequent workflow updates on main. |
Member
|
Reopening: verifying actual conflict state against origin/main. The pr-queue-hygiene script is not present on main, investigating resolution. |
Fixes #217: scripts/pr-queue-hygiene.mjs re-fetches each PR's mergeability individually via GET /repos/{owner}/{repo}/pulls/{number} instead of relying on the pulls-list endpoint's 'mergeable' field, which GitHub computes asynchronously and frequently returns as UNKNOWN on list responses. Adds bounded retry polling for pending mergeable states and skips PRs carrying hold labels per GOVERNANCE.md. The workflow file is tracked in issue #318 per the Hive App workflow-permission gap policy. Signed-off-by: Jorge Castro <jorge.castro@gmail.com>
castrojo
force-pushed
the
fix-pr-queue-hygiene-mergeable-unknown
branch
from
September 21, 2026 16:49
b5615fe to
5dfdc3f
Compare
Member
|
Rebased onto latest main (incorporating #398):
Awaiting independent review. |
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Sep 21, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mrbobbytables
enabled auto-merge
September 21, 2026 20:39
This was referenced Sep 21, 2026
pr-queue-hygiene: stale conflict marker never cleared on deconflict; comment lookup unpaginated
#432
Closed
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.
Summary
Fixes #217: the mergeability check for the GOVERNANCE.md merge-queue
hygiene rule (issue #58) needs to re-fetch each PR individually rather
than trust
gh pr list'smergeablefield, which GitHub computesasynchronously and frequently returns
UNKNOWNon list responses —silently letting conflicting PRs evade the 48h flagging check.
This PR adds:
scripts/pr-queue-hygiene.mjs— fetches all open PRs (paginated pastgh pr list's default--limit 30), then re-checks mergeabilityper-PR via
GET /repos/{owner}/{repo}/pulls/{number}(which forces afresh computation) before deciding a PR is conflicting. Persists a
first-conflict-observed marker comment so the 48h window is measured
from when the PR actually started conflicting, not from
updatedAt(which changes on any commit/label/comment).
tests/pr-queue-hygiene.test.mjs— unit tests for the markerparsing, age calculation, and conflict-detection logic.
pr-queue-hygienenpm script for manual/local runs.Context: related, still-open PR #115
PR #115 proposed this same feature but shipped it as inline bash in
.github/workflows/pr-queue-hygiene.ymlusinggh pr list'smergeablefield directly — the exact bug #217 reports. A laterrevision to #115 extracted the logic into a script
(
scripts/pr-queue-hygiene.mjs) that fixes it correctly, but theworkflow file itself was never updated to call that script, so the
bug remained live in the step that actually runs. The PR's author
noted its fork's credentials lack the
workflowOAuth scope needed topush the one-line wiring change to
.github/workflows/*.This PR is in the same boat: this environment's push credentials
also lack the
workflowscope, so.github/workflows/pr-queue-hygiene.ymlitself could not be pushed here. A maintainer with that scope will
need to add it directly — the full contents are below (also mirrors
what #115 needed):
Once this workflow file is added (either by a maintainer here, or by
rebasing/merging #115 with its workflow step updated to
run: node scripts/pr-queue-hygiene.mjs), #115 could likely be closed assuperseded, since this PR delivers the corrected script + tests it was
trying to add.
Testing
node --test— full suite passes (63 tests, including the 8 newones in
tests/pr-queue-hygiene.test.mjs).npx prettier --check— passes on all changed files.js-yaml.— hive: backend=copilot