fix(mq): skip closed MRs in list, next, and ready views (#563)

* fix(mq): skip closed MRs in list, next, and ready views (gt-qtb3w)

The gt mq list command with --status=open filter was incorrectly displaying
CLOSED merge requests as 'ready'. This occurred because bd list --status=open
was returning closed issues.

Added manual status filtering in three locations:
- mq_list.go: Filter closed MRs in all list views
- mq_next.go: Skip closed MRs when finding next ready MR
- engineer.go: Skip closed MRs in refinery's ready queue

Also fixed build error in mail_queue.go where QueueConfig struct (non-pointer)
was being compared to nil.

Workaround for upstream bd list status filter bug.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* style: fix gofmt issue in engineer.go comment block

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Erik LaBianca
2026-01-16 18:23:28 -05:00
committed by GitHub
parent c51047b654
commit 4fa6cfa0da
3 changed files with 31 additions and 5 deletions

View File

@@ -71,6 +71,22 @@ func runMQList(cmd *cobra.Command, args []string) error {
var scored []scoredIssue
for _, issue := range issues {
// Manual status filtering as workaround for bd list not respecting --status filter
if mqListReady {
// Ready view should only show open MRs
if issue.Status != "open" {
continue
}
} else if mqListStatus != "" && !strings.EqualFold(mqListStatus, "all") {
// Explicit status filter should match exactly
if !strings.EqualFold(issue.Status, mqListStatus) {
continue
}
} else if mqListStatus == "" && issue.Status != "open" {
// Default case (no status specified) should only show open
continue
}
// Parse MR fields
fields := beads.ParseMRFields(issue)

View File

@@ -73,6 +73,10 @@ func runMQNext(cmd *cobra.Command, args []string) error {
// Filter to only ready MRs (no blockers)
var ready []*beads.Issue
for _, issue := range issues {
// Skip closed MRs (workaround for bd list not respecting --status filter)
if issue.Status != "open" {
continue
}
if len(issue.BlockedBy) == 0 && issue.BlockedByCount == 0 {
ready = append(ready, issue)
}

View File

@@ -630,11 +630,12 @@ func (e *Engineer) HandleMRInfoFailure(mr *MRInfo, result ProcessResult) {
// Returns the created task's ID for blocking the MR until resolution.
//
// Task format:
// Title: Resolve merge conflicts: <original-issue-title>
// Type: task
// Priority: inherit from original + boost (P2 -> P1)
// Parent: original MR bead
// Description: metadata including branch, conflict SHA, etc.
//
// Title: Resolve merge conflicts: <original-issue-title>
// Type: task
// Priority: inherit from original + boost (P2 -> P1)
// Parent: original MR bead
// Description: metadata including branch, conflict SHA, etc.
//
// Merge Slot Integration:
// Before creating a conflict resolution task, we acquire the merge-slot for this rig.
@@ -768,6 +769,11 @@ func (e *Engineer) ListReadyMRs() ([]*MRInfo, error) {
// Convert beads issues to MRInfo
var mrs []*MRInfo
for _, issue := range issues {
// Skip closed MRs (workaround for bd list not respecting --status filter)
if issue.Status != "open" {
continue
}
fields := beads.ParseMRFields(issue)
if fields == nil {
continue // Skip issues without MR fields