doc/user/project/merge_requests/duo_in_merge_requests.md
[!disclaimer]
GitLab Duo is designed to provide contextually relevant information during the lifecycle of a merge request.
{{< details >}}
{{< /details >}}
{{< collapsible title="Model information" >}}
{{< /collapsible >}}
{{< history >}}
add_ai_summary_for_new_mr enabled by default in GitLab 17.11.{{< /history >}}
When you create or edit a merge request, use GitLab Duo Merge Request Summary to create a merge request description.
In the Description field, put your cursor where you want to insert the description.
On the toolbar above the text area, select Summarize code changes ({{< icon name="tanuki-ai" >}}).
The description is inserted where your cursor was.
<i class="fa-youtube-play" aria-hidden="true"></i> Watch an overview
Provide feedback on this feature in issue 443236.
Data usage: The diff of changes between the source branch's head and the target branch is sent to the large language model.
GitLab Duo can review your merge request for potential errors and provide feedback on alignment to standards.
When you request a review from GitLab Duo, it automatically runs one of two code review features based on your add-on. Users with the Owner role for the group can configure which feature runs for all users.
| Detail | Code Review Flow | GitLab Duo Code Review |
|---|---|---|
| Reviewer | @GitLabDuo | @GitLabDuo |
| Type | Agentic | Non-agentic |
| Required add-on | None. Uses GitLab Credits. | GitLab Duo Enterprise |
| Context awareness | Enhanced understanding of repository structure and cross-file dependencies | Focused on the merge request and the file diffs within it |
| Analysis | Multi-step agentic reasoning | Single-pass |
| Session creation | {{< yes >}} | {{< no >}} |
| Automatic reviews | {{< yes >}} | {{< yes >}} |
| Custom instructions | {{< yes >}} | {{< yes >}} |
| Custom comments | {{< yes >}} | {{< yes >}} |
By default, the code review feature that GitLab runs depends on the user that initiates the review.
| Review trigger | Initiating user |
|---|---|
| Review requested manually | The user who requests the review. |
| Merge request created (not a draft) | The merge request author. |
| Draft merge request marked as ready | The merge request author. |
If the initiating user has a GitLab Duo Enterprise seat, GitLab Duo Code Review runs. If not, Code Review Flow runs. Both features can run in the same project.
Users with the Owner role for the group can configure all reviews to use Code Review Flow, regardless of seat type. When Code Review Flow runs, credit usage is attributed to the initiating user.
To determine which feature runs a review, check the merge request's activity feed. Code Review Flow starts a review session when it runs. If no review session appears, GitLab Duo Code Review runs the review.
After the review completes, you can also look for a Code Review Flow session in sessions for your project.
{{< history >}}
duo_code_review_dap_routing_consent_enabled. Enabled by default.{{< /history >}}
[!flag] The availability of this feature is controlled by a feature flag. For more information, see the history.
To prevent GitLab Duo Enterprise seat holders from using a feature that consumes GitLab Credits, all code reviews they initiate use GitLab Duo Code Review by default. This behavior occurs even if a user with the Owner role turns on Code Review Flow for the group.
You can change this default and configure all code reviews to use Code Review Flow instead, regardless of the user's seat.
To override the default code review feature for GitLab Duo Enterprise seats:
{{< tabs >}}
{{< tab title="GitLab.com" >}}
Prerequisites:
{{< /tab >}}
{{< tab title="GitLab Self-Managed and GitLab Dedicated" >}}
Prerequisites:
{{< /tab >}}
{{< /tabs >}}
Code Review Flow now runs for all code reviews in the group and consumes GitLab Credits. To switch all reviews back to GitLab Duo Code Review, turn off Code Review Flow.
{{< details >}}
{{< /details >}}
{{< history >}}
resolve_discussion_with_duo. Enabled by default.{{< /history >}}
Use GitLab Duo to resolve review discussions on merge requests.
When you ask GitLab Duo to resolve a discussion, it reads the review comment and the surrounding code, makes the requested change on the source branch, then commits and pushes the change. GitLab Duo then replies to the discussion with a summary of the change and resolves the thread.
This feature uses the Developer Flow on the GitLab Duo Agent Platform.
Prerequisites:
To resolve a discussion with GitLab Duo:
GitLab Duo starts a session you can track in the sessions for your project.
{{< details >}}
{{< /details >}}
{{< collapsible title="Model information" >}}
{{< /collapsible >}}
{{< history >}}
summarize_my_code_review enabled by default in GitLab 17.10.{{< /history >}}
When you've completed your review of a merge request and are ready to submit your review, use GitLab Duo Code Review Summary to generate a summary of your comments.
The summary is displayed in the comment box. You can edit and refine the summary before you submit your review.
<i class="fa-youtube-play" aria-hidden="true"></i> Watch an overview
Provide feedback on this experimental feature in issue 408991.
Data usage: When you use this feature, the following data is sent to the large language model:
{{< details >}}
{{< /details >}}
{{< collapsible title="Model information" >}}
{{< /collapsible >}}
{{< history >}}
generate_commit_message_flag. Disabled by default.generate_commit_message_flag enabled by default in GitLab 17.2.generate_commit_message_flag removed in GitLab 17.7.{{< /history >}}
When preparing to merge your merge request, edit the proposed merge commit message by using GitLab Duo Merge Commit Message Generation.
<i class="fa-youtube-play" aria-hidden="true"></i> Watch an overview
Data usage: When you use this feature, the following data is sent to the large language model:
When working with GitLab Duo in Merge Requests, you might encounter the following issues.
If you ask GitLab Duo for a review by mentioning or replying to @GitLabDuo,
and do not receive a response, this might be because you do not have the
appropriate GitLab Duo add-on.
To check your GitLab Duo add-on, ask your group Owner to check the group's GitLab Duo seat assignments.
To change your GitLab Duo add-on, contact your administrator.
If you cannot assign GitLab Duo as a reviewer, it might be because you do not have the appropriate GitLab Duo add-on.
To check your GitLab Duo add-on, ask your group Owner to check the group's GitLab Duo seat assignments.
To change your GitLab Duo add-on, contact your administrator.
GitLab Duo Code Review was not automatically added...If you try to create a merge request with automatic reviews from GitLab Duo turned on, you might get the following error message:
GitLab Duo Code Review was not automatically added because your account requires
GitLab Duo Enterprise. Contact your administrator to upgrade your account.
Contact your administrator to ask them to purchase a GitLab Duo Enterprise seat and assign it to you.