Okay, yup, this line of reasoning has me removing agents from my personal machines. I was enjoying the convenience and waved that internal niggle away with a vague feeling of "they would never exploit this", but you're right, I needed that wake up call.
You could consider open source coding harnesses (I quite like Pi especially its customisability) as a middle ground and alternative.
And for what it's worth, Codex is still open source under Apache 2.0. Claude Code is closed-source.