Automated addition of fault-tolerance via lazy repair and graceful degradation