In GitLab, what does Set to auto-merge wait for, and what cancels it or keeps the merge request blocked?
answer
- formerly named after the pipeline
- waits for every merge check
- no pipeline is not a passing pipeline
- new commits on the source cancel it
basics
~20 sGitLab's Set to auto-merge, formerly Merge when pipeline succeeds, merges once every merge check passes: approvals, a successful pipeline, resolved threads, not a draft, no conflicts. New commits on the source branch cancel it so they get reviewed.
solid answer
~40 s**Set to auto-merge** replaced the old **Merge when pipeline succeeds** button; since GitLab 17.7 it waits for **all merge checks**, not just the pipeline: required approvals, a successful pipeline, resolved discussions, no merge conflicts, the merge request not being a draft, external status checks, and more. It is the button for "I have reviewed this, merge it when it is ready". Two project settings feed it. **Pipelines must succeed** requires a successful pipeline to *exist*, so a merge request with no pipeline cannot merge, and skipped pipelines block unless **Skipped pipelines are considered successful** is selected. **All threads must be resolved** blocks while any thread is open. GitLab cancels auto-merge when new commits are pushed to the source branch, and, on the semi-linear and fast-forward methods without automatic rebase, when the target branch moves.
go deeper
Recall that Set to auto-merge replaced Merge when pipeline succeeds and that it merges only when every merge check passes, approvals and pipeline included.
Explain Pipelines must succeed and All threads must be resolved, why no pipeline means no merge, and which events cancel auto-merge.
Diagnose merge requests stuck or merged unexpectedly: missing or skipped pipelines, pipeline-type precedence, and auto-merge cancelled by a late push.
Decide which merge checks a project enforces so that auto-merge becomes the default way to merge without weakening review.
## From "merge when the pipeline passes" to auto-merge GitLab used to offer **Merge when pipeline succeeds**: a button that merged the merge request as soon as its pipeline passed. It is now **Set to auto-merge**, and the enhanced behaviour behind it became generally available in **GitLab 17.7**: auto-merge waits until **every merge check** passes, not only the pipeline. The old name survives in one place, the Git push option `merge_request.merge_when_pipeline_succeeds`, which sets auto-merge from the command line. The intended workflow: a reviewer satisfied with the content selects **Set to auto-merge**, and GitLab merges on its own when the rest of the conditions are met, so nobody has to watch the pipeline. ## What auto-merge waits for The merge checks include: - all **required approvals** given, including Code Owner approvals; - a **CI/CD pipeline** that completed successfully, whatever the project setting says; - **no merge conflicts**, and no other merge request blocking this one; - all **discussions resolved**, when the project requires it; - the merge request **not a Draft**, and still **open**; - all **external status checks** passed, and no denied policies; - a matching title when a **title validation** pattern is configured; - the current time past any **Merge after** date set on the merge request. ## The two project-level merge checks | Setting | What it enforces | Common surprise | |---|---|---| | **Pipelines must succeed** | A merge request needs a successful pipeline before anyone can merge it | It needs a successful pipeline to **exist**: no pipeline means no merge, and skipped pipelines block unless **Skipped pipelines are considered successful** is selected | | **All threads must be resolved** | No merge while any thread is open; the **Open threads** counter turns orange | A comment that opens a new thread after auto-merge was set holds the merge until it is resolved | **Pipelines must succeed** works with GitLab CI/CD and with pipelines reported by an external CI integration. When several pipeline types run for the same merge request, the **merge request pipeline takes precedence**, so an older passing merge request pipeline can outweigh a newer failing branch pipeline. Getting exactly one pipeline per merge request is a pipeline-configuration task; the merge check only reads the result. ## What cancels or blocks auto-merge 1. **New commits to the source branch** cancel auto-merge, so the new changes are reviewed before they merge. 2. **New commits to the target branch** cancel it when the project uses **Merge commit with semi-linear history** or **Fast-forward merge** and automatic rebase before merge is off, because the source would first need a rebase. 3. **A failed pipeline** does not merge. The author can retry the failed jobs; if a retry succeeds, the merge request merges. 4. **A new open thread** holds the merge when threads must be resolved. Auto-merge can be cancelled with **Cancel auto-merge** by the author or a project member with the Developer role or above, while the pipeline is still running. ## Diagnosing a merge request that will not merge When a merge request sits with auto-merge set and nothing happens, walk the checks in the order they usually fail: 1. **Approvals**: is a required rule, or a Code Owner section, still waiting? 2. **Pipeline**: did a pipeline run for this merge request at all, did it pass, or was it skipped? 3. **Threads**: is the **Open threads** counter orange? 4. **Draft and conflicts**: is it still marked as a draft, or does the source conflict with the target? 5. **Status**: is auto-merge still set, or did a recent push cancel it? Each of these can be read on the merge request itself, so the project settings are rarely the first place to look. ## Why reviewers rely on it - It separates **judging the content** from **watching the clock**: the reviewer decides once, the project settings decide when. - It cannot jump the queue: anything the project requires still applies, and it cannot be used to skip a merge train when trains are enabled. - It is safer than merging by hand right after approval, because a late push cancels it instead of sneaking unreviewed code in. In an interview, name the rename, list the checks, and explain the two classic surprises: a merge request that cannot merge although nothing failed (no pipeline ran) and an auto-merge that silently disappeared (someone pushed a commit).
- A GitLab project enables Pipelines must succeed and now some merge requests can never merge, although none of their pipelines failed. What is happening?The setting requires a successful pipeline to exist, not the absence of failures. Merge requests for which the pipeline configuration creates no pipeline, or whose pipeline was skipped, cannot merge. Either make the configuration run a pipeline for every merge request, or, for skips, select **Skipped pipelines are considered successful**.
- Why does GitLab cancel auto-merge when the author pushes a new commit after setting it?Auto-merge records a reviewer's judgement of the content as it was. A new commit changes that content, so GitLab cancels auto-merge to make sure the new change is reviewed before it merges; someone has to set auto-merge again.
- Set to auto-merge in GitLab merges as soon as the pipeline passes, even without approvals
- Pipelines must succeed lets a merge request merge when no pipeline ran at all
- Skipped pipelines count as successful by default under Pipelines must succeed
- Pushing a fix after setting auto-merge keeps auto-merge active for the new commit
- Merge when pipeline succeeds is still the button's name in current GitLab
Assumes GitLab 19.4; the button formerly called Merge when pipeline succeeds is Set to auto-merge, and its wait on all merge checks became generally available in GitLab 17.7.