For my current company I put together an integration with Harbormaster which subscribes to results of remote builds (Google Cloud Build, GitLab CI) then uses the
harbormaster.sendmessage API to update the build status in Differential. In case of a build failure, a bot account additionally comments on the diff with a link to the remote build logs so that the user can inspect the failure. 
The issue arises with spurious build failures.  Remote build systems like the two mentioned above offer a “Retry” button which my internal users are very happy to exercise. Unfortunately when the build succeeds on a subsequent run, the Differential revision does not get updated. The
harbormaster.sendmessage API appears to be a silent no-op for completed builds.
I wasn’t able to track where in the code the decision is made to ignore a build status update for a completed build/buildable. Wondering if it would be easy to make multiple status updates to the same build target apply? (I’m guessing it would involve restarting any/all subsequent build steps.)
Alternatively, if I had the ability to restart a build through the API, I believe I could make that work.
- Kick off a build for a Differential revision, let it finish.
- Follow links to the build e.g. https://secure.phabricator.com/harbormaster/build/32353/.
- In the “Metadata” tab note the Build Target PHID.
- At https://secure.phabricator.com/conduit/method/harbormaster.sendmessage/ paste the buildTargetPHID and set the type to “fail”.
- Repeat step 4, alternating between fail and pass. Ideally the Differential revision would reflect the build status in the most recent API call.
 It would be nice if Differential/Harbormaster offered a field to put the URL into so that a link to the remote build system is available as soon as the build is kicked off in the Build Status section at the top of a revision, as well as with “Harbormaster completed/failed remote builds” messages.
 The two most causes I most commonly see are:
- The build runs tests which are not reliable.
- Developer cloud infrastructure is less than stellar in its reliability.