Skip to content

T8246: Conflict check workflow fix by detecting Mergify backport PRs with committed conflict markers#108

Merged
dmbaturin merged 2 commits intocurrentfrom
T8246-backport-conflict-check
Feb 16, 2026
Merged

T8246: Conflict check workflow fix by detecting Mergify backport PRs with committed conflict markers#108
dmbaturin merged 2 commits intocurrentfrom
T8246-backport-conflict-check

Conversation

@kumvijaya
Copy link
Contributor

@kumvijaya kumvijaya commented Feb 9, 2026

Change Summary

Mergify backport PRs with cherry-pick conflicts contain committed conflict markers (<<<<<<<, =======, >>>>>>>). GitHub's API treats these as valid changes and marks the PR as "mergeable", causing the script to incorrectly remove conflict labels and allow unsafe merges.

Solution
Added diff-based conflict detection to identify committed conflict markers alongside GitHub's native mergeability checks.

Changes
get_pr_diff() - Fetches PR diffs using gh pr diff CLI
has_conflict_markers() - Scans diff for git conflict markers using regex
has_conflicts() - Updated to return True if GitHub detects conflicts OR markers found
process_pr() - Enhanced to check diff content and log marker detection
Imports - Added subprocess and re
Benefits
✅ Detects Mergify backport PRs with committed conflicts
✅ Prevents unsafe merges of conflicted PRs
✅ Maintains backward compatibility
✅ Graceful degradation if gh CLI unavailable
✅ Enhanced logging for debugging

Validation
Validated with https://github.com/VyOS-Networks/gh-action-test-vyos-1x/actions/runs/21835978019/job/63007028032

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Other (please describe):

Related Task(s)

https://vyos.dev/T8246

Related PR(s)

Proposed changes

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PR conflict-labeling workflow to detect committed git conflict markers in PR diffs (a case where GitHub’s mergeability API can still report the PR as mergeable), improving safety for Mergify backport PRs.

Changes:

  • Add gh pr diff retrieval to fetch PR diffs for additional conflict detection.
  • Implement regex-based scanning for committed conflict markers in added lines.
  • Extend conflict determination and PR processing to incorporate marker detection and logging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@evgsentrium evgsentrium requested review from asklymenko and removed request for evgsentrium February 16, 2026 11:15
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks at least superficially correct to me. Let's give it a try.

@dmbaturin dmbaturin merged commit 2e97aef into current Feb 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants