Automatic merging stalls when MR is behind n commits

Summary

Automatic merging hangs indefinitely when the HEAD of MR is behind target branch n commits

Steps to reproduce

Set Merge Method to Merge commit with semi-linear history

  1. User 1 creates MR
  2. User 2 approves MR
  3. User 1 notices MR is behind (n commit behind), clicks rebase button
  4. User 1 refreshes page, clicks "Merge when pipeline succeeds"
  5. Something else is merged into target branch so MR is being n commits again.

Have to click Cancel automatic merge to get MR back into a valid state.

What is the current bug behavior?

Automatic merge hangs indefinitely

What is the expected correct behavior?

Automatic merge should be canceled

Links

Customer ticket -> https://gitlab.zendesk.com/agent/tickets/91803 (internal)

I have been able to reproduce locally on 10.5.2. This could possibly be a regression.

Assignee Loading
Time tracking Loading