> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Auto Approve PR

> Automatically approve pull requests once every CodeAnt review thread has been resolved

## Overview

When **Auto Approve PR** is enabled, CodeAnt AI will submit an `APPROVE` review on a pull request as soon as **every review thread CodeAnt opened on that PR is marked resolved**.

This closes the loop on the standard CodeAnt workflow:

1. CodeAnt reviews the PR and opens inline review threads on the issues it finds.
2. The author addresses each thread (commits a fix, replies with context, or marks it resolved).
3. Once all CodeAnt-opened threads are resolved, CodeAnt posts an APPROVE review automatically — no need for a human reviewer to come back and click the button just to acknowledge that CodeAnt's concerns are addressed.

<Note>
  **Currently GitHub-only.** Auto Approve PR is supported on GitHub and GitHub Enterprise. GitLab, Bitbucket, and Azure DevOps support is on the roadmap.
</Note>

## How It Works

There are two paths that trigger the auto-approve check:

### 1. After every review

Right after CodeAnt finishes reviewing a PR, it schedules a delayed check 60 seconds later. If all CodeAnt review threads are already resolved at that point, CodeAnt approves.

The delay exists so that any in-flight pushes settle before the approve action fires. The reviewed head SHA is **pinned at scheduling time** — if you push a new commit during that 60-second window, CodeAnt will skip the approve rather than approve an unreviewed commit.

### 2. When a thread is resolved

GitHub fires a webhook every time someone resolves a review thread. CodeAnt listens for these events and re-checks: if the resolution made every CodeAnt thread resolved, it approves immediately.

### What gets approved

CodeAnt only counts threads it authored. Threads opened by humans on the PR don't block auto-approve — only the CodeAnt-authored ones matter.

If CodeAnt has already approved the current head commit, the approve is a no-op (it doesn't post duplicate reviews). If you push a new commit after an auto-approval, CodeAnt's approval is dismissed by GitHub the same way any reviewer's approval would be — and the cycle restarts.

## Configuring Auto Approve PR

Navigate to **Settings → AI Code Review** at [app.codeant.ai/settings/prconfsettings](https://app.codeant.ai/settings/prconfsettings).

Find the **Auto Approve PR** row and choose:

| Option                                     | Behaviour                                                                                      |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| **Enable**                                 | Auto-approve PRs when every CodeAnt review thread is resolved.                                 |
| **Disable**                                | Never auto-approve. Human approval remains required.                                           |
| **Inherited from Org** *(repo-level only)* | Use whatever the organization-level setting is. Selecting this clears the repo-level override. |

The default is **Disable**. Opt-in per organization or per repository as needed.

### Org vs Repo

* **Organization scope** — sets the default for every repository in the org.
* **Repository scope** — overrides the org default for that one repo. Pick **Inherited from Org** to remove the override.

## Required GitHub Permissions

The CodeAnt GitHub App needs the following permissions, which are part of the standard CodeAnt install:

* **Pull requests: Read & Write** — to submit the `APPROVE` review.
* **Webhook event: `pull_request_review_thread`** — to react when a thread is resolved.

If you installed CodeAnt before these permissions were required, GitHub will prompt you to accept the new permission set the next time you visit the install page.

## Interaction with Branch Protection

Auto-approval counts as a normal PR review for the purpose of branch protection rules. If you require **N** approving reviews to merge, CodeAnt's auto-approval contributes one of those approvals.

If your protection rules require approval from **CODEOWNERS** or specific users/teams, CodeAnt's approval **will not satisfy those rules** unless the CodeAnt installation user is explicitly listed.
