Add task retry to core, tests, and sqlite backend