/merge quick action does not auto-append SHA when used outside main MR thread

Summary

The /merge quick action fails to automatically append the SHA of the head of the branch when used outside the main MR thread (e.g., in review comments, batch review submissions, or combined with other quick actions). This causes the merge to fail with "Branch cannot be merged" or silently not set auto-merge.

Root Cause

When /merge is used in the main MR thread, GitLab automatically appends the current HEAD SHA. However, when used in other contexts (review comments, batch reviews, or combined quick actions), this automatic appending of merge_request_diff_head_sha is not happening

Affected Scenarios

  1. Review comments: Using /merge as part of a review submission
  2. Combined quick actions: Using /merge with /run_pipeline or /approve in the same comment
  3. Batch reviews: Submitting /merge as part of finishing a review

Steps to reproduce

  1. Open a merge request that is ready to merge
  2. On a diff thread:
    /approve
    /run_pipeline
    /merge
  3. Add the comment, and check the auto merge is set
Edited Feb 02, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading