You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Label workflow removes has-conflicts on unknown mergeability when CI passes #2045
The label workflow removes has-conflicts from a PR that still has merge conflicts. The label comes back on a later run, so it flaps.
Context
GitHub returns mergeable: null and mergeable_state: "unknown" for a short time after each push to main. #2028 keeps has-conflicts for unknown mergeability only inside the CI-pending and CI-failed branch. Other paths do not handle it.
The early conflict check matches only mergeable === false && mergeable_state === 'dirty'. Unknown mergeability passes it.
When CI passes, the workflow checks mergeability again only if desiredLabel === 'awaiting-maintainer'.
For any other result (awaiting-coderabbit, awaiting-author, no label), nothing handles unknown. reconcileLabels(pr, desiredLabel) removes every state label that is not the desired one. has-conflicts is in that list.
Evidence from production: after #1739 and #2028, has-conflicts fell from 85 to 47 in about two hours and recovered to 76. 28 of the 41 PRs that lost it still conflict with main (tested with git merge-tree). The log for #1597 at 2026-10-13 01:36 UTC ends with CI passing, reviews=1, coderabbit=pending, maintainer=pending, blockers=0 → (none) and has no "mergeability pending" line. #1597 was labeled and unlabeled four times in two hours.
GitHub documents that mergeable is null while a background job computes it.
Reproduction steps
Use the workflow test harness on origin/main.
Run runWorkflow({ mergeable: null, mergeableState: "unknown", labels: ["has-conflicts"] }). CI passes by default.
Read the label calls.
Expected result
The PR keeps has-conflicts while mergeability is unknown.
Actual result
has-conflicts is removed. awaiting-coderabbit and coderabbit-review-active are added. The log line is PR #1437: CI passing, reviews=0, coderabbit=pending, maintainer=pending, blockers=0 → awaiting-coderabbit.
Proposed fix
Handle unknown mergeability once, before the CI branch and before the final reconcileLabels. When mergeability is unknown and the PR has has-conflicts, keep it. Do not add it.
Remove the duplicate unknown handling in the CI branch and in the awaiting-maintainer branch.
Activity
[Fix] has-conflicts label flaps off while GitHub recomputes mergeabil…
[Fix] has-conflicts label flaps off while GitHub recomputes mergeabil…