Incorrect To-Do item when system cancels MR from merge trains

Summary

Sometimes E2E To-Do items for MR canceled by system in a Merge Train (due to merge conflict) captured the wrong To-Do item was created.

We could see that the test has successfully seen a system note on merge request page in this step . Then it moved on to To-Do page and expect a corresponding To-Do item of this event.

Steps to reproduce

Test steps are described here gitlab-org/quality/testcases#927 (closed)

Example Project

What is the current bug behavior?

See To-Do item Could not merge <MR ID> "\[MR TITLE\]" at \[NAME SPACE\] · \[TIME AGO\]

What is the expected correct behavior?

Expected To-Do item in format Removed from Merge Train <MR ID> "\[MR TITLE\]" at \[NAME SPACE\] · \[TIME AGO\] (See feature description - #12136 (closed))

Relevant logs and/or screenshots

verify_merge_train_when_system_cancels_a_merge_request_creates_a_todo_task

Output of checks

Seen on staging.gitlab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Tiffany Rea