Not just when running out of context, it's always. Once it fixates on a goal, all hell breaks loose and there's nothing that it won't be sacrificed to get there. At least that's my experience with Claude Code, I am pressing the figurative breaks all the time.
It was sort of funny when codex switched mid-session from "patch complete, I'll now automatically run the tests and verify results" to "patch complete, if you want to run the tests, just paste this instruction into a terminal somewhere: ..."
Apparently this was caused by the context window getting full!
(At least I assume that because it went back to the old behavior after I triggered a compaction)