Repository navigation
fix(ci): add merge-conflict labels again on jq 1.6 runners - #14136
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify on one real sweep that [DESIGN-REVIEWED] 60c76cb |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify on real GitHub that a bare re-list returns computed mergeability after 60s — the stub proves the flow, not GitHub's lazy-compute behaviour. Not justified as shipped
The one remaining sibling, What this change shipsInventory (7 items) — 6 justifiedIntent: FIX — conflicted PRs get the "merge conflict" label again, at far fewer API calls per sweep; defect reproduced by tests that fail on base.
[FIRST-PRINCIPLES-REVIEWED] 60c76cb |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
876fe00 to
4f97430
Compare
Disposition: accepted. The rename is the same one-line jq 1.6 keyword fix in the only other label workflow with that line; the static test pins both files. Kept in this PR on purpose. |
Disposition: accepted. The re-list replaces per-PR |
4f97430 to
db81b2f
Compare
Disposition: accepted. Same one-line jq 1.6 keyword fix in the only other label workflow with that line; pinned by the static test. pr-readiness.yml is owned by another in-flight change and is left untouched. |
Disposition: accepted. Settling known PRs before the wait is what makes the new wait safe under cancel-in-progress; pinned by the call-order assertion in the re-list test. |
Disposition: accepted. One consumer, same idiom as PR_LIST_LIMIT, and the tests need it set to 0 to run without a real sleep. |
Disposition: accepted. Same leave-for-next-sweep rule the old per-PR view used on error; pinned by test_failed_relist_keeps_first_pass_and_exits_clean. |
db81b2f to
5a5ffb5
Compare
Disposition: rebutted with a measurement. Right after main moved (7b2da39 -> 1354188), |
Disposition: not changed. The re-list is the same query 60s after the first, which already warns at the ceiling; today's count is 681 of 900. A second warning would repeat the first. |
Disposition: accepted. Same one-line jq 1.6 keyword fix in the only other label workflow with that line; pinned by the static test. pr-readiness.yml is owned by another in-flight change. |
Disposition: accepted. Measured on production after a push to main: 585 of 681 PRs UNKNOWN on the first list, 0 UNKNOWN on a list 60s later, with no per-PR views between (see the earlier comment on this PR). |
Disposition: accepted. It makes the wait safe under cancel-in-progress; pinned by the call-order assertion in the re-list test. |
Disposition: accepted. Same leave-for-next-sweep rule as before; pinned by test_failed_relist_keeps_first_pass_and_exits_clean. |
5a5ffb5 to
b421cc3
Compare
Disposition: accepted. Measured after a push to main: 585 of 681 PRs UNKNOWN on the first list, 0 UNKNOWN on a list 60s later, with no per-PR views. |
Disposition: accepted. A merge inside the 60s cancels this run, but the run the merge starts lists again, so UNKNOWN PRs settle on that run. Known PRs are labelled before the wait, so nothing already known is lost. |
Disposition: accepted-and-deferred. That job runs on ubuntu-latest (jq 1.7), so it works today, and another in-flight change owns pr-readiness.yml. The static test can widen to every workflow once that line is fixed. |
add_label() bound the label name as `jq --arg label`. `label` is a jq keyword; jq 1.7 tolerates it as a variable name but jq 1.6 (the CodeBuild fleet's jq since #11880) rejects it, so the POST body was empty, the API answered 422, and the sweep step failed. Rename the binding to `name` here and in fork-pr-label.yml. The sweep also spent one `gh pr view` per UNKNOWN PR, which after a push to main is most of ~500 open PRs. Replace that with a single wait-and-re-list; anything still UNKNOWN is left for the next sweep, as before.
b421cc3 to
60c76cb
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed on behalf of the maintainers (sweep 2026-09-27): readiness passed, required checks green on 60c76cb, no blocking review threads, security posture unchanged. Approving and merging.
Problem / Motivation
Goal: conflicted PRs get the "merge conflict" label again, using far fewer API calls per sweep.
The "merge conflict" label is never added any more. The
Sync merge-conflict labelstep fails on the first conflicted PR it meets (for example run 36223713979) withjq: error: syntax error, unexpected label, thenHTTP 422.Why it matters
Reviewers scanning the /pulls list cannot see which green-looking PRs are unmergeable. Because the step dies at the first add, stale labels on resolved PRs are not removed either. The sweep is also one of the heavier users of the shared
GITHUB_TOKENpool.Not a goal
Fixing the same jq line in
pr-readiness.yml, or changing when the sweep runs.What changed (motivation → approach → change)
jq --arg labelfails on jq 1.6jq --arg nameworks on 1.6 and 1.7gh pr viewper UNKNOWN PRadd_label()built its POST body withjq -n --arg label "$LABEL" '{labels: [$label]}'.labelis a jq keyword. jq 1.7 accepts it as a variable name, but jq 1.6 does not, and the CodeBuild fleet that push runs moved to in #11880 ships jq 1.6. So jq printed nothing,gh apiposted an empty body, and GitHub answered 422. The binding is nowname..github/workflows/fork-pr-label.ymlhas the same line; it runs onubuntu-latesttoday so it works, but it gets the same rename.GitHub computes mergeability lazily, so right after main moves almost every open PR lists as UNKNOWN. The sweep used to re-ask each of them with
gh pr view. Now it first settles every PR whose state is already known. Then it waitsRECHECK_DELAY_SECONDS(60) once and lists open PRs again, acting only on the ones that were UNKNOWN. Settling first means a push that cancels the run during the wait loses nothing. A PR still UNKNOWN, or a failed re-list, is left for the next sweep, the same rule as before. Only CONFLICTING adds the label and only MERGEABLE removes it.Backwards compatibility
Compatible: the label name, triggers, and add/remove rules are unchanged; only how often GitHub is asked changed.
Tests
test/test_pr_merge_conflict_label_workflow.pyruns the workflow's own script with a stubbedgh. It checks that CONFLICTING adds the label with body{"labels": ["merge conflict"]}and MERGEABLE removes it. It checks that known PRs are labelled before the second listing, that UNKNOWN costs exactly one re-list and nogh pr view, that a PR still UNKNOWN is left alone, and that a failed re-list keeps the first pass and exits 0. A static test fails if either label workflow binds a jq 1.6 keyword with--arg, so it catches the bug even where the local jq is 1.7. Onorigin/mainfour of the five tests fail (local jq is 1.6, which reproduces the exact CI error).Manual verification
jq -n --arg label x '{labels: [$label]}'on jq 1.6 prints the CI error;jq -n --arg name x '{labels: [$name]}'prints{"labels":["x"]}. The routing, fleet-parity, scheduled-failure-watch, workflow-security and workflow-permissions test files still pass.Related Issues
No linked issue: regression from #11880 (CodeBuild migration), found in run 36223713979.
.github/workflows/pr-readiness.ymlhas the same--arg labelline (~L1497). Its job runs onubuntu-latest, so it works today; it is owned by another in-flight change and is left untouched here.Pattern harvest
Rule candidate: lint
Pattern: jq
--arg/--argjsonbound to a jq keyword (label,if,end, ...), which jq 1.7 accepts and jq 1.6 rejectsChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)