fix(mq): persist MR rejection to beads storage

The RejectMR function was modifying the in-memory MR object but never
persisting the change to beads storage. This caused rejected MRs to
continue showing in the queue with status "open".

Fix: Call beads.CloseWithReason() to properly close the MR bead before
updating the in-memory state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/refinery
2026-01-13 12:54:54 -08:00
committed by beads/crew/emma
parent 73a349e5ee
commit 9315248134

View File

@@ -744,9 +744,16 @@ func (m *Manager) RejectMR(idOrBranch string, reason string, notify bool) (*Merg
return nil, fmt.Errorf("%w: MR is already closed with reason: %s", ErrClosedImmutable, mr.CloseReason)
}
// Close with rejected reason
// Close the bead in storage with the rejection reason
b := beads.New(m.rig.BeadsPath())
if err := b.CloseWithReason("rejected: "+reason, mr.ID); err != nil {
return nil, fmt.Errorf("failed to close MR bead: %w", err)
}
// Update in-memory state for return value
if err := mr.Close(CloseReasonRejected); err != nil {
return nil, fmt.Errorf("failed to close MR: %w", err)
// Non-fatal: bead is already closed, just log
_, _ = fmt.Fprintf(m.output, "Warning: failed to update MR state: %v\n", err)
}
mr.Error = reason