It's surprising that the JR engineer who presumably has access to chat jippity submitted this bad code to begin with. Wouldn't they have had the AI review the code first?
My theory would be that the Jr probably generated the code with o1 in the first place. The buggy, nonsensical crap I've seen that thing generate boggles the mind.