Inability to merge is not always detected

Summary

Sometimes, the merge request widget shows a "Merge" button when the MR is actually unmergeable due to conflicts. Clicking on the button gets a "Merge failed: Conflicts detected during merge. Please try again" message which stays around persistently (this is captured in #34186 (closed)). The problem here is that the merge button was presented in the first place.

Steps to reproduce

???

(How one can reproduce the issue - this is very important)

Example Project

Seen in:

What is the current bug behavior?

Merge button is presented when conflicts prevent an MR from being merged

What is the expected correct behavior?

Merge button should not be presented

Output of checks

This bug happens on GitLab.com (at least EE 12.8)

Edited by Takuya Noguchi