MWPSService currently uses the old pipeline lookup method. It searches
related merge requests with pipeline.ref, however, this doesn't work
for attached/detached merge request pipelines.
When a build is retried automatically, we close any open todos. However, we do
that _before_ creating a new build failed todo.
To solve this, we check if the build is retried before creating the todo. We
also ensure that the build _instance_ has the correct attribute set, without
needing to reload it from the database.
When a build fails for a commit, create a todo for the author of the
merge request that commit is the HEAD of. If the commit isn't the HEAD
commit of any MR, don't do anything. If there already is a todo for that
user and MR, don't do anything.
Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the
breaking commit.