Automatic reviewer assignment
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
When you enable automatic reviewer assignment, GitLab assigns the
Code Owners of changed files as reviewers on a merge request.
You don’t have to select reviewers from the CODEOWNERS file by hand.
Prerequisites
- The project must have a
CODEOWNERSfile. - The Maintainer or Owner role for the project.
Enable automatic reviewer assignment
To turn on automatic reviewer assignment for a project:
- In the left sidebar, select Search or go to and find your project.
- Select Settings > Merge requests.
- Go to the Automatic reviewer assignment section.
- Select Automatically assign all code owners as reviewers.
- Select Save changes.
When GitLab assigns reviewers
After you turn on the setting, GitLab assigns Code Owners as reviewers when:
- A merge request is created in a ready state.
- A draft merge request is marked as ready.
GitLab assigns every Code Owner that matches the files changed in the merge request.
GitLab skips auto-assignment when:
- The merge request is a draft.
- The merge request already has a reviewer.
@GitLabDuois excluded from this check. - No code owner matches the files changed in the merge request.
- The merge request author does not have permission to set merge request metadata.
Reviewer assignment strategy
The availability of the Assign reviewers with GitLab Duo Agent Platform strategy is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use.
When GitLab Duo Agent Platform is available for your project, the Automatic reviewer assignment section shows a Reviewer assignment strategy setting in place of the single checkbox. Select one of these options:
- Do not assign reviewers automatically: GitLab does not assign reviewers.
- Assign all code owners as reviewers: GitLab assigns every Code Owner from the
CODEOWNERSfile that matches the changed files. - Assign reviewers with GitLab Duo Agent Platform: GitLab Duo Agent Platform recommends and assigns the minimum number of reviewers required to satisfy each approval rule.
Assign reviewers with GitLab Duo Agent Platform
When you select this strategy, GitLab Duo Agent Platform reads the required approval rules on the merge request. For each rule, it recommends the minimum number of reviewers needed to satisfy the rule, assigns them, and adds a note that explains the choice. This strategy applies to all approval rule types, not only Code Owners.
To choose between the eligible approvers for a rule, GitLab Duo Agent Platform considers the following for each approver:
- Availability, based on their status.
- Review workload, based on the number of open merge requests waiting for their review.
- Local time, based on the time zone in their profile.
- Most recent activity.
GitLab assigns reviewers when the merge request becomes ready, the same as the code owners strategy. The recommendation runs in the background, so the reviewers might take a moment to appear. GitLab ignores approval rules that require zero approvals.