Text of docs.gitlab.com › user › gitlab_duo › code_review as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

GitLab Duo Code Review (non-agentic) | GitLab Docs

/ GitLab Duo Code Review (non-agentic) Tier : Premium, Ultimate Add-on : GitLab Duo Enterprise Offering : GitLab.com, GitLab Self-Managed, GitLab Dedicated Default LLM Select a different model using the Non-Agentic Code Review setting. Available on GitLab Duo with self-hosted models Introduced in GitLab 17.5 as an experiment behind two feature flags named ai_review_merge_request and duo_code_review_chat , both disabled by default.

Feature flags ai_review_merge_request and duo_code_review_chat enabled by default on GitLab.com, GitLab Self-Managed, and GitLab Dedicated in 17.10. Changed to beta in GitLab 17.10. Changed to include Premium in GitLab 18.0. Feature flag ai_review_merge_request removed in GitLab 18.1. Feature flag duo_code_review_chat removed in GitLab 18.1. Generally available in GitLab 18.1. Changed to be available on GitLab Duo with self-hosted models in beta in GitLab 18.3.

Changed to be generally available on GitLab Duo with self-hosted models in GitLab 18.4. Depending on your add-on and group settings, GitLab runs one of two code review features: Code Review Flow: the agentic version, part of GitLab Duo Agent Platform. GitLab Duo Code Review: the non-agentic version, available only for users with the GitLab Duo Enterprise add-on. This page describes the non-agentic version. Learn how the two features compare .

GitLab Duo Code Review helps you streamline code reviews in your projects. Use GitLab Duo Code Review When your merge request is ready to be reviewed, use GitLab Duo Code Review to perform an initial review: In the top bar, select Search or go to and find your project. In the left sidebar, select Code > Merge requests and find your merge request. In a comment box, enter the quick action /assign_reviewer @GitLabDuo , or assign GitLab Duo as reviewer.

Watch an overview Provide feedback on this feature in issue 517386 . Contextual awareness When you use GitLab Duo Code Review, the following data is sent to the large language model: Merge request title Merge request description File contents before changes applied (for context) Merge request diffs Filenames Custom instructions To specify content to exclude, see exclude context from Code Review . Behavior on large merge requests GitLab Duo Code Review sends the merge request diffs and the original contents of changed files to the model.

The combined prompt is subject to the selected model’s context window. For large merge requests, GitLab Duo Code Review uses a fallback to improve the chance of a successful review: The initial request includes the merge request diffs and the original file contents. If that request fails, GitLab Duo Code Review automatically retries without the original file contents. If the retry also fails, GitLab Duo Code Review returns a generic error message.

The retry without file contents reduces prompt size, but also reduces the context the model has when reviewing your changes. Comments might be less specific than a review that includes the original file contents. GitLab Duo Code Review uses the instance AI Gateway request timeout . Reviews that do not complete in this window also surface as generic errors. To reduce the risk of failed reviews on large merge requests: Split large merge requests into smaller ones.

Exclude context for files that are not relevant to the review. Ask a group Owner or instance administrator to select a different model using the Non-Agentic Code Review setting. See GitLab.com or GitLab Self-Managed and GitLab Dedicated . Interact with GitLab Duo in reviews You can mention @GitLabDuo in comments to interact with GitLab Duo on your merge request. You can ask follow-up questions on its review comments, or ask questions on any discussion thread in your merge request.

Interactions with GitLab Duo can help to improve the suggestions and feedback as you work to improve your merge request. Feedback provided to GitLab Duo does not influence later reviews of other merge requests. There is a feature request to add this functionality, see issue 560116 . Custom code review instructions You can create custom MR review instructions to ensure consistent and specific code review standards in your project.

For more information, see customize review instructions for GitLab Duo . Automatic reviews Changed automatic reviews for projects to a UI setting in GitLab 18.0. Introduced automatic reviews for groups and instances in GitLab 18.4 as a beta with a feature flag named cascading_auto_duo_code_review_settings . Disabled by default. Feature flag cascading_auto_duo_code_review_settings removed in GitLab 18.7. Automatic reviews from GitLab Duo ensure that all merge requests in your project, group, or instance receive an initial review.

When a user creates a merge request, GitLab Duo automatically reviews it unless: It’s marked as draft. For GitLab Duo to review the merge request, mark it ready. It contains no changes. For GitLab Duo to review the merge request, add changes to it. It matches one or more exclusion rules you set. For GitLab Duo to review the merge request, manually request a review. Prerequisites: The Maintainer or Owner role for the project.

To turn on automatic reviews for a project: In the top bar, select Search or go to and find your project. In the left sidebar, select Settings > Merge requests . In the GitLab Duo Code Review section, select Enable automatic reviews by GitLab Duo . Select Save changes . Prerequisites: The Owner role for the group. To turn on automatic reviews for a group: In the top bar, select Search or go to and find your group. In the left sidebar, select Settings > General .

Expand the Merge requests section. In the GitLab Duo Code Review section, select Enable automatic reviews by GitLab Duo . Select Save changes . Settings cascade from group to project. More specific settings override broader ones. Prerequisites: Administrator access To turn on automatic reviews for an instance: In the upper-right corner, select Admin . In the left sidebar, select Settings > General . In the GitLab Duo Code Review section, select Enable automatic reviews by GitLab Duo .

Select Save changes . Settings cascade from instance to group to project. More specific settings override broader ones. After you enable automatic reviews, you can specify rules to exclude specific merge requests. Exclude merge requests for a project Introduced in GitLab 19.2 as a beta with a flag named duo_code_review_automated_rules . Enabled by default. Generally available in GitLab 19.3. Feature flag duo_code_review_automated_rules removed.

When automatic reviews are turned on for a project, GitLab Duo reviews every eligible merge request. To exclude specific merge requests, define exclusion rules in a .gitlab/duo/mr-review-automated-rules.yaml file. Exclusion rules only prevent automatic reviews. You can still request a review manually for any excluded merge request. To define exclusion rules: In the root of your repository, create a .gitlab/duo directory if one doesn’t already exist.

In the .gitlab/duo directory, create a file named mr-review-automated-rules.yaml . Add exclusion rules using the following format: yaml exclude : target_branches : - <pattern> source_branches : - <pattern> authors : - <pattern> Each key is optional. GitLab Duo skips the automatic review when a merge request matches any pattern in any category: target_branches : Matches the target branch name of the merge request. source_branches : Matches the source branch name of the merge request. authors : Matches the username of the merge request author.

Patterns support wildcard (glob) matching. For example, dependabot/* matches any source branch that starts with dependabot/ . For example, to skip automatic reviews for merge requests that target a release branch or that a bot account creates: yaml exclude : target_branches : - "release/*" authors : - "*-bot" Commit the file to the default branch of your repository. GitLab Duo reads the exclusion rules from the default branch of your

The rest of this page is on the live site.