CRD Reference

MergeQueue Reference

Label-driven merge automation with AI conflict resolution and post-merge auto-revert

Overview

A MergeQueue (apiVersion: nominos.io/v1) watches a repository for PRs carrying a label (default nominos/merge-queue). Each labeled PR is rebased onto the latest target branch, gated on CI, and merged with the configured strategy. If the rebase conflicts, an AI agent attempts resolution before escalating to a human. After merging, the queue watches CI for a configurable window and can automatically revert and reopen the PR.

kubectl
kubectl get mergequeues
NAME         PHASE        QUEUE   TARGET   AGE
main-queue   Processing   3       main     2d

Spec Fields

FieldTypeDefaultDescription
repositorystringRepository URL to manage merges for. Required.
targetBranchstringmainBranch PRs are merged into.
mergeStrategyenum: squash | merge | rebasesquashHow PRs are merged.
watchLabelstringnominos/merge-queuePRs with this label enter the queue automatically.
defaultPRLabelsstring[]watchLabelLabels added to PRs created by this queue’s agents.
maxConcurrentCIinteger1Maximum concurrent CI runs (1 = strictly sequential).
ciCIConfigCI integration settings (see below).
conflictResolutionConflictResolutionConfigAI-assisted conflict resolution (see below).
autoRevertAutoRevertConfigAuto-revert on post-merge CI failure (see below).
stalePRStalePRConfigStale-PR handling (see below).
authSecretstringSecret containing git credentials.
pausedbooleanfalsePause queue processing.

CI configuration

FieldTypeDefaultDescription
ci.requiredChecksstring[]Status checks that must pass before merging.
ci.timeoutMinutesintegerinferred from historyHow long to wait for CI to complete.
ci.waitForAllChecksbooleanfalseWait for all checks, or just the required ones.

Conflict resolution

FieldTypeDefaultDescription
conflictResolution.enabledbooleantrueEnable AI-assisted conflict resolution.
conflictResolution.modelstringsonnetModel used to resolve conflicts.
conflictResolution.maxAttemptsinteger3Attempts before escalating to a human.
conflictResolution.humanReviewLabelstringnominos/needs-human-reviewLabel added when human review is needed.

Auto-revert

FieldTypeDefaultDescription
autoRevert.enabledbooleantrueAuto-revert the merge if CI fails on the target branch after landing.
autoRevert.windowMinutesinteger10Post-merge window to watch for CI failures.
autoRevert.reopenPRbooleantrueReopen the PR after reverting.

Stale PRs

FieldTypeDefaultDescription
stalePR.thresholdDaysinteger7Days before a queued PR is considered stale.
stalePR.actionenum: rebase | remove | notifyrebaseWhat to do with stale PRs.

Status

Queue Phases

PhaseMeaning
IdleQueue is empty or waiting for work.
ProcessingA PR is being rebased, checked, or merged.
PausedQueue processing is paused (spec.paused: true).
ErrorThe queue hit an error it cannot recover from on its own.

Per-PR Statuses

StatusMeaning
QueuedWaiting in the queue.
RebasingBeing rebased onto the latest target branch.
ResolvingConflictsAn AI agent is resolving rebase conflicts.
WaitingCIWaiting for required status checks.
MergingMerge in progress.
MergedMerged into the target branch.
FailedFailed to merge; removed from the queue.
NeedsHumanReviewConflict resolution exhausted its attempts — a human must take over.

Status Fields

FieldDescription
phase / messageQueue phase (see above) and a human-readable message.
queue / queueLengthPRs currently queued, each with number, title, author, enqueue time, status, priority, attempts, and any linked AgentJob/AgentPlan.
currentPRThe PR currently being processed, including conflictStatus (conflicting files, resolution attempts, resolution job).
statsLifetime counters: totalMerged, totalFailed, conflictsResolved, autoReverts, average queue and CI times.
lastMergeTimeTimestamp of the last successful merge.
recentMergesRecent merge records: PR number, merge SHA, and revert SHA/time if auto-reverted.
conditionsStandard Kubernetes conditions.

Examples

Basic queue for main

mergequeue.yaml
apiVersion: nominos.io/v1
kind: MergeQueue
metadata:
  name: main-queue
spec:
  repository: https://github.com/myorg/myapp
  targetBranch: main
  mergeStrategy: squash
  authSecret: nominos-git-credentials
  ci:
    requiredChecks: ["build", "test"]

Auto-revert queue

mergequeue-auto-revert.yaml
apiVersion: nominos.io/v1
kind: MergeQueue
metadata:
  name: auto-revert-queue
spec:
  repository: https://github.com/myorg/myapp
  targetBranch: main
  watchLabel: nominos/merge-queue
  mergeStrategy: squash
  maxConcurrentCI: 1
  authSecret: nominos-git-credentials

  autoRevert:
    enabled: true
    windowMinutes: 10   # watch CI for 10 minutes after merge
    reopenPR: true      # reopen the PR if reverted

  conflictResolution:
    enabled: true
    model: sonnet
    maxAttempts: 2
    humanReviewLabel: nominos/needs-human-review

With this configuration: the PR merges, and if CI fails on main within the 10-minute window, the queue reverts the merge commit and reopens the PR for another pass.