I had a failed refactor with Codex recently and I am wondering if context window size is the cause.
Obviously major architectural changes need a bigger context window. But try to aggressively modularize your tasks as much as you can, and where possible run batch jobs to keep your workflow moving while each task stays a smaller chunk.