Skip to content

[Fix] has-conflicts label flaps off while GitHub recomputes mergeability - #2048

Merged
edelauna merged 2 commits into
mainfrom
fix/label-workflow-unknown-mergeability-05i384vf8nepd
Oct 17, 2026
Merged

edelauna merged 2 commits into
mainfrom
fix/label-workflow-unknown-mergeability-05i384vf8nepd

Conversation

@zoomote

@zoomote zoomote Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

Closes: #2045

Description

The label workflow removed has-conflicts from PRs that still had merge conflicts. This happened when GitHub transiently reported mergeable: null / mergeable_state: "unknown" while it recomputed mergeability after a push. Unknown mergeability was only handled in the CI-pending/CI-failed branch (#2028) and in the awaiting-maintainer refetch. When CI passed with any other result, reconcileLabels(pr, desiredLabel) stripped has-conflicts. The label came back on a later run, so it flapped.

How this PR fixes it:

  • Unknown mergeability is now handled once, right after the early conflict check and ahead of every branch that reconciles labels. When mergeability is unknown and the PR already has has-conflicts, the label is kept. It is never added when absent.
  • reconcileLabels accepts a keepLabels parameter. The final reconcile passes has-conflicts through it when mergeability is unknown.
  • The duplicate computation in the CI-pending/CI-failed branch is removed. That branch now uses the hoisted values.
  • The decision log line now includes mergeable and mergeable_state, so the next case names its cause.

One deliberate deviation from the issue's proposed fix, step 2: the awaiting-maintainer branch keeps its refetch-time unknown-mergeability handling ("mergeability pending"). That guard is not redundant. It protects the maintainer handoff from a head change between the shard's first fetch and labeling, and existing tests depend on it (#1584). Only the truly duplicated computation was removed.

Test Procedure

  • New regression test: keeps has-conflicts while mergeability is unknown and required CI passes (#2045) in src/services/__tests__/pr-review-state-workflow.test.ts. Verified it fails against the pre-fix workflow and passes with the fix.
  • Full workflow suite: pnpm exec vitest run services/__tests__/pr-review-state-workflow.test.ts — 202/202 tests pass, including the [Fix] Label workflow strips has-conflicts when mergeability is unknown #2028 tests.
  • pnpm run check-types (tsc --noEmit) passes.
  • ESLint passes on the changed test file; the pre-commit hook ran Prettier and the full turbo lint with no errors.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): Not applicable. No UI changes.
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

Visual Snapshots

Not applicable. This PR changes a GitHub Actions workflow and its test harness. There is no rendered UI.

Videos (interaction / animation only)

Not applicable. No interaction or animation changes.

Documentation Updates

  • No documentation updates are required. (The docs repository does not document this internal label workflow.)
  • Yes, documentation updates are required. (Describe what to update, or link to a PR in the docs repository).

Additional Notes

Behavior notes for reviewers:

  • Unknown mergeability with no existing has-conflicts label is unchanged: the workflow proceeds as before.
  • When the awaiting-maintainer refetch later reports known-clean mergeability, a kept has-conflicts label self-corrects on the next reconciliation.

Get in Touch

Roomote on Discord (thread linked above), on behalf of the issue author @edelauna.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8384ce09-bd64-48bc-90c8-70344b1a9514

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.

Current step: Required CI passed. Waiting for automated review of the latest commit.

If automated review does not start, a maintainer must restart it.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review October 17, 2026 01:33
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 17, 2026
@edelauna
edelauna added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit cb698be Oct 17, 2026
29 of 30 checks passed
@edelauna
edelauna deleted the fix/label-workflow-unknown-mergeability-05i384vf8nepd branch October 17, 2026 02:26
edelauna added a commit that referenced this pull request Oct 17, 2026
…ity (#2048)

* fix: keep has-conflicts label while mergeability is unknown and CI passes (#2045)

* test: cover unknown-mergeability operands and clean control

---------

Co-authored-by: Roomote <roomote@roomote.dev>
Co-authored-by: Elliott de Launay <edelauna@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Label workflow removes has-conflicts on unknown mergeability when CI passes

2 participants