I have recently noticed that in chat when I type enough and the profile picture expands with my message, the hat stays the same size and it stays in the same place (I have the Winter Bash app):
If the timing was really bad, it was possible for the hat placement to occur during the short time in which both the small and the large avatar where visible (because the animation in which one replaces the other was happening at that exact time).
In this case, the small avatar would win and get its hat, even if it was the one that was disappearing.
We now check whether both are still visible, and if so, we do nothing right now and instead come back a moment later to check again until only one of the avatars is left.
This fix is deployed, but only applies to chat pages that were loaded after the build (in other words: after you reload, this shouldn't happen anymore).