Is there an off-by-1 here?  Shouldn't it be `if self.current_task_number >= len(self.task_states)` ?