From d069de14c49c653d7fead61f254102c8cf163ada Mon Sep 17 00:00:00 2001 From: Bruno Bornsztein Date: Mon, 12 Jan 2026 17:47:51 -0600 Subject: [PATCH] fix: use 'mergeable' field instead of 'mergeStateStatus' for PR conflict 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 --- internal/github/pr.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/github/pr.go b/internal/github/pr.go index dc515cf4..36f16a24 100644 --- a/internal/github/pr.go +++ b/internal/github/pr.go @@ -49,7 +49,7 @@ type ghPRResponse struct { State string `json:"state"` IsDraft bool `json:"isDraft"` Title string `json:"title"` - MergeStateStatus string `json:"mergeStateStatus"` + Mergeable string `json:"mergeable"` StatusCheckRollup []ghCheck `json:"statusCheckRollup"` UpdatedAt string `json:"updatedAt"` } @@ -133,9 +133,9 @@ func fetchPRInfo(repoDir, branchName string) *PRInfo { defer cancel() // Query for PR associated with this branch - // gh pr view --json number,url,state,isDraft,title,mergeStateStatus,statusCheckRollup,updatedAt + // gh pr view --json number,url,state,isDraft,title,mergeable,statusCheckRollup,updatedAt cmd := exec.CommandContext(ctx, "gh", "pr", "view", branchName, - "--json", "number,url,state,isDraft,title,mergeStateStatus,statusCheckRollup,updatedAt") + "--json", "number,url,state,isDraft,title,mergeable,statusCheckRollup,updatedAt") cmd.Dir = repoDir output, err := cmd.Output() @@ -155,7 +155,7 @@ func fetchPRInfo(repoDir, branchName string) *PRInfo { URL: resp.URL, Title: resp.Title, IsDraft: resp.IsDraft, - Mergeable: resp.MergeStateStatus, + Mergeable: resp.Mergeable, } // Parse state @@ -295,7 +295,7 @@ type ghPRListResponse struct { IsDraft bool `json:"isDraft"` Title string `json:"title"` HeadRefName string `json:"headRefName"` - MergeStateStatus string `json:"mergeStateStatus"` + Mergeable string `json:"mergeable"` StatusCheckRollup []ghCheck `json:"statusCheckRollup"` UpdatedAt string `json:"updatedAt"` } @@ -316,7 +316,7 @@ func FetchAllPRsForRepo(repoDir string) map[string]*PRInfo { // Get all open PRs in one call cmd := exec.CommandContext(ctx, "gh", "pr", "list", "--state", "open", - "--json", "number,url,state,isDraft,title,headRefName,mergeStateStatus,statusCheckRollup,updatedAt", + "--json", "number,url,state,isDraft,title,headRefName,mergeable,statusCheckRollup,updatedAt", "--limit", "100") cmd.Dir = repoDir @@ -343,7 +343,7 @@ func FetchAllPRsForRepo(repoDir string) map[string]*PRInfo { cmd2 := exec.CommandContext(ctx2, "gh", "pr", "list", "--state", "merged", - "--json", "number,url,state,isDraft,title,headRefName,mergeStateStatus,updatedAt", + "--json", "number,url,state,isDraft,title,headRefName,mergeable,updatedAt", "--limit", "20") cmd2.Dir = repoDir @@ -373,7 +373,7 @@ func parsePRListResponse(pr *ghPRListResponse) *PRInfo { URL: pr.URL, Title: pr.Title, IsDraft: pr.IsDraft, - Mergeable: pr.MergeStateStatus, + Mergeable: pr.Mergeable, } // Parse state