Add history tracking when task's work_ids and state are updated.