---
title: "Merger"
description: "Checks every pull request against your merge rules, CI, open threads, and risk, labels it with a verdict, and can approve it when it is ready."
canonical: "https://baz.ai/docs/agents/deploy/merger"
---

# Merger

Checks every pull request against your merge rules, CI, open threads, and risk, labels it with a verdict, and can approve it when it is ready.

Merger decides whether a pull request is ready to merge. It runs after CI and the Baz review finish, applies your rules, then judges the change: does it deliver what its title says, are review threads really settled, and how risky is the code it touches. It labels the pull request with the verdict, can explain it in a comment, and can approve it. Merger never merges: a person, or your repository's auto-merge, does that.

## Verdicts

When every gate passes and the change looks safe, Merger adds the `baz: ready to merge` label and its comment says **Ready to Merge**. Otherwise it adds `baz: needs human review`: the status is **Pending** when threads are waiting on the author, and **Needs Review** when there is a blocker, a disagreement, high risk without CI, a rule that blocks it, or a change that does not do what its title says.

Draft pull requests get `baz: pending` and are not judged.

## Why you can trust it

Your rules come first: if CI is red, the branch has conflicts, or a rule condition fails, Merger says so plainly ("CI is not passing", "PR has merge conflicts") and stops there. It waits for CI and the Baz review to finish before judging. Only then does it read every review thread to tell settled threads from ones that were resolved but still have the bug, and it rates risk by what the change touches, such as billing, data, or access control.

An approval is tied to the commit Merger judged. When new commits arrive, Baz drops the ready label and withdraws its approval until the new head is evaluated.

## What you see

```markdown title="PR comment"
Merger    🟠 Needs Review

The retry change is correct, but one thread still holds the PR.

**Holding this PR**
1. `src/payments/retry.ts:42` · resolved, but the code still has the issue
   The 503 case still returns before the backoff.

**Risk** 🟡 Medium · Billing
- Changes how failed charges are retried.

**To unblock:** fix the code in the threads above, or reply in each thread why it is safe. A maintainer can also approve the PR.

Commit abcdef1 · Evaluated 2026-11-20 14:02 UTC
```

Merger's results appear in **Insights → Evaluation → Deploy** as **Ready to Merge PR Breakdown** and **PR Throughput**, and on the Tasks list as **Ready to merge** and **Approved (Baz)** badges.

<figure><img src="/docs/docs-assets/appdemo-merger-agent-stats.png" alt="Merger stats in the Deploy tab of Insights Evaluation" width="1400" height="730" /><figcaption>Merger stats in Insights</figcaption></figure>

## Rules

Select Merger on **Software Factory → Deploy** and use **Add rule**. When you first turn Merger on with no rules, Baz adds a default rule for all repositories and all authors ("We added a default Merger rule"). A rule reads top to bottom.

Give the rule a **Rule name**, pick repositories in **If repo** (GitHub and GitLab only), and narrow it with **In paths** and **PR authors**. **Add condition** adds limits such as **Max lines changed**, **Max files changed**, or an open finding at a given severity, and **Guideline** is free text that tells Merger how to judge these changes. Turn on **Then: Auto approve** to have Merger approve ready pull requests (it needs write access); **Explanation as a PR Comment** is on by default, and **Tag Reviewers** asks up to two recent reviewers of the same code to look when Merger escalates.

### Baz Approved label

The **Baz Approved** switch adds a `baz approved` label once all Baz findings on a pull request are resolved, on repositories that no Merger rule covers. It does not approve the pull request and needs read access only.

## Prerequisites

GitHub or GitLab repositories. Write access only for **Then: Auto approve**.

## Related

<CardGroup cols={2}>
  <Card title="Verification Agent" href="/docs/agents/deploy/verification-agent" icon="flask-conical">
    Check the change against its ticket first.
  </Card>
  <Card title="Tasks" href="/docs/work/tasks" icon="check-check">
    See which PRs are ready to merge.
  </Card>
  <Card title="Evaluation" href="/docs/insights/evaluation" icon="gauge">
    Track Merger's verdicts over time.
  </Card>
</CardGroup>
