fix: Refinery queue uses beads MQ as source of truth (hq-eggh5)

The refinery was checking git branches instead of the beads merge queue.
This caused MRs to pile up when branches were deleted but MR beads remained.

- manager.go: Queue() now queries beads for type=merge-request issues
- refinery.md.tmpl: Updated queue-scan to use gt mq list
- mol-refinery-patrol.formula.toml: Updated queue-scan step instructions
This commit is contained in:
mayor
2025-12-31 02:02:26 -08:00
committed by beads/crew/dave
parent 7069f762e5
commit 36f17bbadd
3 changed files with 75 additions and 24 deletions

View File

@@ -99,27 +99,28 @@ id = "queue-scan"
title = "Scan merge queue"
needs = ["inbox-check"]
description = """
Review the queue built from MERGE_READY messages in inbox-check.
Check the beads merge queue - this is the SOURCE OF TRUTH for pending merges.
```bash
# Always fetch with prune to clean stale tracking refs:
git fetch --prune origin
# For each queued merge request, verify the branch exists:
git branch -r | grep <branch>
# IMPORTANT: Before queuing, verify branch has unmerged commits:
git log origin/main..origin/<branch> --oneline | head -1
# If empty → branch already merged. Archive MERGE_READY, don't queue.
gt mq list <rig>
```
The beads MQ tracks all pending merge requests. Do NOT rely on `git branch -r | grep polecat`
as branches may exist without MR beads, or MR beads may exist for already-merged work.
If queue empty, skip to context-check step.
If branch doesn't exist for a queued item:
- Mail witness: Branch not found, cannot merge
- Remove from queue
For each MR in the queue, verify the branch still exists:
```bash
git branch -r | grep <branch>
```
Track verified branch list for this cycle."""
If branch doesn't exist for a queued MR:
- Close the MR bead: `bd close <mr-id> --reason "Branch no longer exists"`
- Remove from processing queue
Track verified MR list for this cycle."""
[[steps]]
id = "process-branch"