> ## 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.

# Pull Request Review

> Connect Azure DevOps Services service hooks and receive your first pull request review.

> [!NOTE]
>
> Using self-hosted Azure DevOps Server? Follow the [Server review setup](https://docs.codeant.ai/setup/azure_devops/self-hosted/pull_request.md).

## Before you begin

* An Azure DevOps Services account with access to the repository you want reviewed and permission to create a personal access token (PAT).
* An administrator who can install the CodeAnt AI extension in your organization. See [Microsoft's extension installation requirements](https://learn.microsoft.com/en-us/azure/devops/marketplace/install-extension?view=azure-devops).
* **View subscriptions** and **Edit subscriptions** permissions for service hooks in the project. Project administrators have these by default. See [Microsoft's service hook permissions](https://learn.microsoft.com/en-us/azure/devops/service-hooks/overview?view=azure-devops#faqs).
* A repository where you can open a pull request.

## Install the extension and create a token

**1. Install CodeAnt AI**

Open the [CodeAnt AI extension](https://marketplace.visualstudio.com/items?itemName=codeantai.codeant-azure-devops-extension) and install it in the organization containing your project. If you cannot install extensions, ask your administrator to complete this step.

**2. Create a personal access token**

In Azure DevOps Services, open **User settings** → **Personal access tokens** and select **+ New Token**.

Name the token `CodeAnt AI`, select the intended organization or collection, and choose an expiry date permitted by your organization's policy. Select these scopes:

| Scope | Access | Used for |
| - | - | - |
| Code | Read & write | Repository access and analysis |
| Pull Request Threads | Read & write | Review comments and threads |
| Build | Read | DORA metrics |
| Work Items | Read & write | Metrics and ticket creation |

**Code** and **Pull Request Threads** are the scopes for scans and reviews. Add **Build** for DORA metrics and **Work Items** for work item data and Azure DevOps ticket creation.

Select **Create** and copy the token before closing the page. You will use it in both service hook subscriptions below. See [Microsoft's PAT guide](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops) if token creation is restricted.

Review comments use the identity associated with the PAT. Use a [dedicated service account](https://docs.codeant.ai/setup/azure_devops/cloud/service_account.md) if you want automated comments attributed to a bot user.

## Create both service hook subscriptions

Service hooks send PR events and comments to CodeAnt. Configure both subscriptions for each project you want reviewed.

**1. Send new pull requests to CodeAnt**

In Azure DevOps, open the project and go to **Project settings** → **Service hooks**. Select **Create a new subscription**.

Choose **CodeAnt AI** as the service and select **Next**. Choose the **Pull request created** trigger. Check that any repository filters include the repository you want reviewed, then select **Next**.

Paste the PAT you created above into the access token field and select **Finish**.

![Azure DevOps service hook configured with the CodeAnt AI service](https://mintcdn.com/codeantai/cPAPWnajTUNzakyT/images/pull_request/azure_devops/select_service.png?fit=max\&auto=format\&n=cPAPWnajTUNzakyT\&q=85\&s=c3033d787fb8af56581dd78f20a8267f)

**2. Send pull request comments to CodeAnt**

Create another subscription to **CodeAnt AI** in the same project. Choose **Pull request comment created**, check the repository filters, and use the same PAT. Select **Finish**.

This subscription delivers review commands and questions posted on PRs.

Confirm that both subscriptions appear in **Project settings** → **Service hooks**. Creating the extension installation alone does not configure these project subscriptions.

## Get your first review

Open a new pull request in a repository covered by the subscriptions. CodeAnt AI posts review feedback directly on the PR. When it finds an issue, its comment explains the problem, severity, and suggested fix. See [how to read a review comment](https://docs.codeant.ai/pull_request/features/code_review.md).

To review an existing PR or rerun a review, post:

```text theme={"theme":"css-variables"}
@codeant-ai: review
```

The **Pull request comment created** subscription must be configured for this command to reach CodeAnt.

## Troubleshooting

> [accordion] CodeAnt AI is missing from the service list
>
> Confirm that the CodeAnt AI extension is installed in the organization containing this project. Ask the administrator who installed it to check the installation, then reopen the service hook wizard.

> [accordion] I cannot create a service hook subscription
>
> Ask a project administrator to create the subscriptions or grant you **View subscriptions** and **Edit subscriptions** permissions. Repository access alone does not grant permission to manage service hooks.

> [accordion] My pull request has not received a review
>
> Check that both subscriptions exist in the PR's project and that their repository filters include the repository. Check the subscription's notification history for failed deliveries. Confirm that the PAT is valid and its owner can access the repository, then post `@codeant-ai: review`. If feedback still does not appear, [contact CodeAnt support](mailto:support@codeant.ai) with the project, PR URL, and delivery error. Do not include the PAT.

> [accordion] Review commands do not receive a response
>
> Check the **Pull request comment created** subscription, including its repository filter and token. The subscription for new PRs does not deliver PR comments.

> [accordion] Reviews stopped after the token expired or was revoked
>
> Create a replacement PAT with the same scopes and repository access. Update the access token in both CodeAnt service hook subscriptions. If you also saved the PAT in CodeAnt's organization connection, update that credential too. Request a review to verify the replacement before revoking an old token that is still valid.

## Next steps

> [card] [Customize your reviews](https://docs.codeant.ai/pull_request/customize/rules.md)
>
> Add review rules for your team's coding standards.

> [card] [Connect repository scans](https://docs.codeant.ai/setup/azure_devops/cloud/control_center.md)
>
> Connect your organization to browse repositories and configure analysis.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.