Skip to content

fix: use 'mergeable' field for PR conflict detection#143

Merged
bborn merged 1 commit intomainfrom
task/286-task-should-reflect-pr-merge-conflicts-s
Jan 12, 2026
Merged

fix: use 'mergeable' field for PR conflict detection#143
bborn merged 1 commit intomainfrom
task/286-task-should-reflect-pr-merge-conflicts-s

Conversation

@bborn
Copy link
Copy Markdown
Owner

@bborn bborn commented Jan 12, 2026

Summary

  • Fixed PR merge conflict detection by using the correct GitHub API field
  • Tasks with PRs that have merge conflicts now properly display the conflict indicator

Problem

The merge conflict detection feature was implemented but not working because:

  • The code was querying GitHub's mergeStateStatus field (returns "DIRTY", "CLEAN", etc.)
  • But checking for the value "CONFLICTING" (which only appears in the mergeable field)
  • This meant PRs with conflicts were never detected

Solution

Updated all GitHub CLI queries to use the mergeable field instead of mergeStateStatus:

  • Single PR queries: gh pr view
  • Batch PR queries: gh pr list (both open and merged)
  • Updated both JSON struct definitions and parsing code

Testing

Changes

File: internal/github/pr.go

  • Updated ghPRResponse struct to use Mergeable field
  • Updated ghPRListResponse struct to use Mergeable field
  • Changed all 3 GitHub CLI queries to request mergeable instead of mergeStateStatus
  • Updated response parsing to use resp.Mergeable instead of resp.MergeStateStatus

User Impact

Users will now see:

  • Red "C" badge on tasks with PRs that have merge conflicts
  • "Has conflicts" status description in both Kanban board and detail view
  • This status updates every 30 seconds with the PR refresh cycle

🤖 Generated with Claude Code

…ict detection

The GitHub API was returning "DIRTY" in the mergeStateStatus field for PRs
with merge conflicts, but the code was checking for "CONFLICTING".

GitHub has two separate fields:
- mergeStateStatus: returns "DIRTY", "CLEAN", "UNSTABLE", etc.
- mergeable: returns "CONFLICTING", "MERGEABLE", "UNKNOWN"

Updated all GitHub CLI queries to use the 'mergeable' field instead of
'mergeStateStatus' to correctly detect merge conflicts.

This fixes the issue where tasks with PRs that have merge conflicts were
not showing the conflict indicator (red "C" badge with "Has conflicts" text).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openhands-ai
Copy link
Copy Markdown

openhands-ai bot commented Jan 12, 2026

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • CI

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #143 at branch `task/286-task-should-reflect-pr-merge-conflicts-s`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@bborn bborn merged commit 6967eb6 into main Jan 12, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant