Post Commit status API with `pipeline_id` of a detached pipeline creates new pipeline

Summary

Using API https://docs.gitlab.com/ee/api/commits.html#post-the-build-status-to-a-commit to post a job status from external CI tool and using pipeline_id parameter API always creates a new pipeline.

Steps to reproduce

curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.com/api/v4/projects/:id/statuses/:sha?name=Job1&state=success&description=Description&pipeline_id=:pipeline_id"

Each request will generate a pipeline if the pipeline_id is from a detached pipeline (from MRs for example).

This picture shows the result after 6 identical requests using pipeline_id=88608: result

What is the expected correct behavior?

I don't know GitLab internal rules for detached pipelines, but as an User I expect to be able to add external status to a previous created detached pipeline.

My use case

I use an external ci tool to create an external status if my quality code is within some specific conditions. This external tool creates an external status with the result state.

Since I'm using detached pipelines, only for MRs, the external status created by the ci tool is overriding the final pipeline status. I may have, for example, a pipeline failing (should block MR) but a external succeeding (should not unblock MR). The result I have is a allowed-to-merge MR.

Related issues

I thinks those issues can be related, but its not the cause and not the consequence: #207500 (closed) and #28697 (closed)

Edited by Lucas Soares