why not just use 4 here instead of MAX_TASK_FAILURES, and then you don't need the assertion below?