Yes, this exact scenario has happened to me a couple times with both Claude and Codex, and it's usually git checkout, more rarely git reset. They immediately realize they fucked up and spend a few minutes trying to undo by throwing random git commands at it until eventually giving up.
foobar10000|1 month ago
Of course if you give an agentic loop root access in yolo mode - then I am not sure how to help...