feat: add merge queue with conflict-aware ordering#9
feat: add merge queue with conflict-aware ordering#9yangwao wants to merge 1 commit intozippoxer:mainfrom
Conversation
Implement a merge queue system for batch merging multiple tasks in optimal order. The queue supports three ordering strategies: - FIFO: oldest first - Priority: by task priority (P1-P5) then age - Conflict-aware (default): minimizes cascading conflicts Key features: - Priority field (1-5) added to tasks, settable via --priority flag - Scoring algorithm weighs priority (50%), age (20%), conflict-free (20%), stage (10%) - Overlap detection identifies tasks modifying same files - Auto-rebase handles base branch advancement during queue processing - Maturity checks ensure tasks are ready (open, clean, no conflicts, stage met) New commands: - subtask queue list: show ordered merge queue - subtask queue merge: execute queue with dry-run, stop-on-error options Schema v7 adds priority column with index for efficient queue queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed5e12e093
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Check maturity (can merge now?) | ||
| qi.CanMerge, qi.BlockedReason = CheckMaturity(&qi, opts.MinStage) | ||
|
|
||
| // Get conflict info from index if available | ||
| rec, ok, err := idx.Get(ctx, item.Name) |
There was a problem hiding this comment.
Re-evaluate maturity after loading conflict files
The merge-queue readiness check runs before conflict data is populated. CheckMaturity uses item.ConflictFiles to block tasks with base-branch conflicts, but ConflictFiles is filled from the index after that call, so tasks that already have recorded conflicts get marked CanMerge and included in the queue. This means queue list can show them as ready and queue merge will try to merge them (only to fail in MergeTask). Move the conflict-file load before CheckMaturity or re-run the maturity check after loading conflicts to ensure known conflicts actually block the task.
Useful? React with 👍 / 👎.
Summary
Implements a merge queue system for batch merging multiple tasks in optimal order, addressing #6.
--priorityflag on draftNew Commands
Implementation
pkg/task/queue/queue.gopkg/task/queue/scoring.gopkg/task/queue/conflicts.gopkg/task/queue/maturity.gopkg/task/ops/queue.gocmd/subtask/queue.goSchema v7 migration adds
prioritycolumn with index.Test plan
go test ./... -short)go build ./cmd/subtask)subtask queue listshows empty queuesubtask queue merge --dry-runworksCloses #6
🤖 Generated with Claude Code