I create a patch and testcase as Arul said.
But the behaviour of HistoryTaskDetail is totally weird. For example, if we use taskService.assignTask() or takeTask(), it won't add any HistoryTaskDetail into database, because AssignTaskCmd didn't notify TaskUpdated event. So the assignee changed details won't be saved. If we want to save the detail information, we have to getTask() first, and modify task information, then invoke taskService.saveTask() to save the task into database and notify TaskUpdated event. But the setAssignee() of TaskImpl must be used in the Environment, otherwise it will throw a None Session in Context Exception. Unfortunately, there is no existing Command for doing this, so we have to create a customized command by ourselves.
So I afraid this part should be rewritten in the future.