Retry failed tasks

This does not yet make sure tasks are not retried on the same agent they
just failed on.