Merge request stuck in locked state when getting merged in a merge train

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

A customer reported an issue (ticket, internal) wherein a MR got stuck in a locked state when it was getting merged. The MR was in a merge train and also made the merge train stuck.

To unstuck the merge train, the MR had to be deleted.

What is the current bug behavior?

The MR shows the locked state of the MR. State shows open while the icon is showing a merge icon and the widget shows it's being merged.

What is the expected correct behavior?

The MR should've been completely merged.

Possible fixes

Based on discussion in #389044 (comment 1250042710), we can do the following:

  • Set the ttl for deduplication of MergeTrains::RefreshWorker to 1 hour.
  • Modify MergeTrains::RefreshService to unstuck stucked merge trains (update the status to stale from merging). We also need to unlock (MergeRequest#unlock) the MR associated to a merge train so it can be merged again. If the MR was already merged though (the merge commit is present) but the MR is unlocked, we should update the state to merged.

When implementing the proposed fix, try to test by breaking your local environment like what was done in #389044 (comment 1303396262).

Edited by 🤖 GitLab Bot 🤖