Issue to Merge Request Flow
- Tier: Premium, Ultimate
- Add-on: GitLab Duo Core, Pro, or Enterprise
- Offering: GitLab.com, GitLab Self-Managed
- Status: Beta
The availability of this feature is controlled by a feature flag. For more information, see the history.
The Issue to Merge Request Flow streamlines the process of converting issues into actionable merge requests. This flow:
- Analyzes the issue description and requirements.
- Opens a draft merge request that’s linked to the original issue.
- Creates a development plan based on the issue details.
- Creates code structure or implementation.
- Updates the merge request with the code changes.
This flow is available in the GitLab UI only.
Prerequisites
To create a merge request from an issue, you must:
- Have an existing GitLab issue with clear requirements.
- Have at least the Developer role in the project.
- Meet the other prerequisites.
- Configure push rules to allow the GitLab Duo service account (if push rules are enabled).
Configure push rules for GitLab Duo
The Issue to Merge Request Flow uses a service account that:
- Creates commits with its own email address.
- Creates branches with the
workloads/prefix (for example,workloads/a1b2c3d4e5f).
If your project or instance has push rules enabled, you must configure them to allow the GitLab Duo service account to create commits and branches.
To configure push rules for a project:
-
Find the email address associated with the service account:
- On the left sidebar, at the bottom, select Admin.
- Select Overview > Users and search for
duo-developer. - Locate the
duo-developeruser and copy the email address.
-
Allow the email address to push to the project:
- On the left sidebar, select Search or go to and find your project.
- Select Settings > Repository.
- Expand Push rules.
- In Commit author’s email, add a regular expression that allows the email address you just copied.
- Select Save push rules.
-
Allow the
workloads/branch prefix:- In the Push rules section, find Branch name.
- Add a regular expression that allows branches starting with
workloads/. For example:^workloads/.*$ - Select Save push rules.
If you are an administrator, you can create push rules for the instance:
- On the left sidebar, at the bottom, select Admin.
- Select Push rules.
- Follow the previous steps to allow Commit author’s email and Branch name.
- Select Save push rules.
For more information about push rules, see the push rules documentation.
Use the flow
To convert your issue to a merge request:
- On the left sidebar, select Search or go to and find your project. If you’ve turned on the new navigation, this field is on the top bar.
- Select Plan > Issues.
- Select the issue you want to create a merge request for.
- Below the issue header, select Generate MR with Duo.
- Monitor progress by selecting Automate > Sessions.
- When the pipeline has successfully executed, a link to the merge request is displayed in the issue’s activity section.
- Review the merge request and make changes as needed.
Best practices
- Keep the issues well-scoped. Break down complex tasks into smaller, focused, and action-oriented requests.
- Specify exact file paths.
- Write specific acceptance criteria.
- Include code examples of existing patterns to maintain consistency.
Example
This example shows a well-crafted issue that can be used to generate a merge request.
## Description
The users endpoint currently returns all users at once,
which will cause performance issues as the user base grows.
Implement cursor-based pagination for the `/api/users` endpoint
to handle large datasets efficiently.
## Implementation plan
Add pagination to GET /users API endpoint.
Include pagination metadata in /users API response (per_page, page).
Add query parameters for per page size limit (default 5, max 20).
#### Files to modify
- `src/api/users.py` - Add pagination parameters and logic.
- `src/models/user.py` - Add pagination query method.
- `tests/api/test_users_api.py` - Add pagination tests.
## Acceptance criteria
- Accepts page and per_page query parameters (default: page=5, per_page=10).
- Limits per_page to a maximum of 20 users.
- Maintains existing response format for user objects in data array.