The method HarbormasterBuildMessageRestartTransaction::isFailed() does not exist.
While there is a variety of classes that offer a public isFailed() method (HarbormasterBuildStatus, HarbormasterBuildableStatus, HarbormasterBuild, HarbormasterBuildTarget) which could have been meant instead (the git history provides no hints as this code has always been broken), the error message explicitly refers to a Build. Thus replace !$this->isFailed() with !$build->isFailed().