Maturity Matrix

Deterministic ordering + conflict detection

Deterministic ordering means the merge queue processes PRs in a defined, predictable sequence rather than in arbitrary arrival order.

  • ·Policy-based merge rules are enforced (OPA, branch protection, or equivalent)
  • ·Deterministic merge ordering with conflict detection prevents concurrent merge failures
  • ·PRs require a maximum of 2 CI rounds before merge (Stripe benchmark)
  • ·Merge rules are versioned as code and reviewed when changed
  • ·PRs exceeding 2 CI rounds are flagged for investigation

Evidence

  • ·Policy-as-code configuration (OPA rules, branch protection API config)
  • ·CI round count per PR metrics showing 2-round maximum adherence
  • ·Merge ordering logs showing deterministic processing

What It Is

Deterministic ordering means the merge queue processes PRs in a defined, predictable sequence rather than in arbitrary arrival order. Conflict detection means the system proactively identifies PRs that will conflict before they enter the queue, rather than discovering conflicts mid-queue and forcing a disruptive reset. Together, these two capabilities transform a basic merge queue into a reliable, high-throughput merge pipeline that can process hundreds of PRs per day without operational surprises.

In a basic merge queue (L2), PRs enter in FIFO order and are tested sequentially. This works but has inefficiencies: large or slow-testing PRs block all subsequent PRs in the queue, and conflict detection only happens when a PR enters the queue and the rebase fails. At L3, deterministic ordering adds priority lanes and batch scheduling to the queue. Conflict detection adds pre-queue analysis: before a PR is even added to the queue, the system checks whether it will conflict with currently queued PRs and alerts the author.

Deterministic ordering is critical for AI-assisted teams because agents produce PRs continuously and often in overlapping areas of the codebase. Without deterministic ordering, the queue can become pathological: a large agent PR that takes 20 minutes to test blocks 15 smaller PRs. With priority-based ordering, small, fast-testing PRs can be promoted ahead of large ones, maximizing throughput while maintaining the conflict-prevention guarantee.

Mergify implements this through its queue system: PRs can be assigned to named queues with different priority and batch settings. Trunk.io's merge queue has explicit priority lanes. GitHub's native queue supports batching but has limited ordering control - teams that need sophisticated ordering typically move to Mergify or Trunk at L3.

Why It Matters

  • Prevents queue starvation - without ordering rules, a slow PR blocks all subsequent PRs; deterministic ordering ensures fast PRs aren't held up by slow ones
  • Dramatically reduces "queue reset" overhead - when a conflict is detected mid-queue (after CI has already run), the queue must drain and restart; pre-queue conflict detection catches this before any CI has run, saving compute and time
  • Enables predictable merge schedules - with deterministic ordering, teams can make reliable predictions about when a queued PR will merge; this matters for release planning and cross-team coordination
  • Required for batch CI optimization - batching multiple PRs into a single CI run (major throughput optimization) requires knowing that the batched PRs are compatible; conflict detection is the prerequisite for safe batching
  • Reduces developer anxiety about queue position - when ordering is deterministic and visible, developers understand why their PR is at position 7 in the queue and what will happen if the PR ahead of them fails; opacity creates frustration

Getting Started

6 steps to get from here to the next level

Common Pitfalls

Mistakes teams actually make at this stage - and how to avoid them

How Different Roles See It

B
BobHead of Engineering

Bob's team has a merge queue but it periodically "gets jammed" - a PR with a flaky test fails, the queue resets, and all subsequent PRs lose their queue position and must restart CI. This happens 2-3 times per week and causes a multi-hour productivity hit each time. Bob wants to fix this but the team says "flaky tests are just a fact of life."

What Bob should do - role-specific action plan

S
SarahProductivity Lead

Sarah's developer experience data shows that the merge queue is a source of frustration, but the complaints are vague: "the queue is unpredictable." She wants to understand what "unpredictable" means to developers so she can fix it.

What Sarah should do - role-specific action plan

V
VictorStaff Engineer - AI Champion

Victor runs agents that produce 10-15 PRs per week and wants to configure a priority queue where agent-produced PRs are tested in parallel batches while human-authored PRs get individual queue slots. He's already written a Mergify configuration that does this in theory but hasn't tested it at scale.

What Victor should do - role-specific action plan