Also, a similar case is produced I think (I musy verify it tomorrow) when user belongs to a group and task.potentialOwner contains only the group, not the user.
Perhaps, changing userIsExplicitPotentialOwner is needed to also check if user belongs to one of the groups contained in task.potentialOwner.
I'll do some more tests tomorrow for this and update my temporary solution.