For whatever reason, Fallout 4's Automatron DLC did away with the ability to put a cute bowler hat on Codsworth. Thankfully, there is a mod that fixes that, and it also allows you to put other cutesy hats on your robo companions. Yay!