In our Staging pipeline, I'd like to get all work items linked to the build.
I have a script that runs this:
using var client = new BuildHttpClient(_organisationUri, _credentials);
var refs = client.GetBuildWorkItemsRefsAsync(project, buildId, 750).Result;
This seems to work fine on our Acceptance environment, but not on Staging: fewer items are returned. For example, looking here I find 139 items, yet the API call above only returns 89:
However, I believe this can be backtraced to a missing link, compare these two: the right one has an automatic link to the build, the left one hasn't (but it is visible in the Related items in the screenshot above).
I'm not sure why this link is sometimes missing (squash commits?). Is there another way to fetch all the items (or fix the missing links)? I'm totally stuck on our pipeline enhancement... Thanks.

