add task_id to history appended to structure optimizations