Occasionally, one of my Windows build agents will get a "failed to start" message because it was unable to clean up the checkout directory from a previous build. This is usually because an MSBuild process is still hanging on to a file handle.
[Updating sources] Failed to perform checkout on agent: '"C:\Program Files\Git\bin\git.exe" clean -f -d -x' command failed.
exit code: 1
stdout: Removing bin/
[...]
stderr: warning: failed to remove bin/prod/otherDirectory
warning: failed to remove bin/prod/yetAnotherDirectory
One solution to this is to use Swabra to kill the process before the next build starts, as described in this answer.
Another thing I'd like to try is to automatically re-add the "failed to start" build to the queue and force it to run on another agent. The problem agent usually resolves itself within a few minutes, so kicking off the build immediately on another agent is a good temporary solution.
Is it possible to add "failed to start" builds to the queue again in this manner?