Merged system notes displayed as manually merged when it is not
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
As discussed in #436061 (comment 1861719243), it seems that the merge state change system notes sometimes display merged manually instead of linking to the related MR that triggered the merge.
It's displayed like this:
When it should be displayed like this:
I believe it's due to the execution timing of the UpdateMergeRequestsWorker which gets triggered by the initial merge commit here. It won't find the MR that has just been merged as it hasn't been marked as merged yet. I believe that background job sometimes gets executed earlier than the execution of MergeRequests::PostMergeService as we commit first and process the post merge service. I'm not sure how often this happens, but I noticed this happening a couple of times. I suppose it depends on the workload of the background workers.
I think it'd be tricky to fix this timing issue as we need to make sure the git commit succeeds first before we mark them as merged. It'd be best if we can do that somehow though.
One way to work around this timing issue would be to update the merged manually to include link to the project commit where we list MRs that include the commit as well. It'd be similar to the commit link within the merge details that links to something like 95a5e7dc. At least, that provides a way to see all MRs that contains the commit.
That link already exists in the merge details widget like below, but maybe it's helpful to link to that instead of saying merged manually incorrectly occasionally?

MRs that include this commit will be listed like this so it could be more helpful.


