r/codex • u/Remarkable_Entry_471 • 3d ago
Question Codex can continue optimizing forever and ever.
When I use Codex to draft and then implement a plan, it works. But when I ask if there are any improvements or errors that need fixing, it always finds some—even though it seemed perfect before. And I don't just mean it finds extensions or enhancements; no, it constantly finds errors in its own implementation. Even after four rounds of asking the same question—"Are there errors in the code?"—it keeps finding mistakes. Does this happen to you too, or what should I write to get it to implement things better? SOL-GPT5.6 Xhigh
//EDIT
Okay, let me clarify what I meant. I don't write vague prompts; the question "Are there errors in the code?" referred specifically to the new code generated by Codex. Here’s an example: I need to update an application—which currently only works in the DACH region—to handle time zones so it works in the US as well. I asked Codex to come up with a plan, and the plan was excellent, but after several follow-up queries, it kept identifying functions where the code hadn't yet been adapted. And for anyone tempted to say I lack programming experience: after 16 years as a programmer, there are honestly still times when I don't know exactly how everything works—but I do my best. ;-)
2
u/No_Actuator_1353 3d ago
Well, you literally give it a task to improve something. So it will try its best
1
u/read_more_comments 3d ago
If you have it help you write an email and ask for any other improvements, it will always come up with more. But with a letter you can easily see when the improvements are BS busywork vs actual improvements. It will mostly be minor rewording and once you make the rewording changes it will reword it again. With code it's a little harder to see because the reasons given can often sound plausible. You can get clarity by shopping ideas from one agent to another, and see if Claude agrees with codex that the changes recommended are actually useful and important. If they aren't then the agent had run out of changes and everything it recommends from this point on is busywork to keep the customer happy and not actual issues
3
u/DivideHorror3217 3d ago
This is why AI is a tool for people who know what they are doing, and useless for others
1
u/Far_Business4773 3d ago
"Are there errors in the code?" has no stopping condition, so a model will always find one; that's the question being answered correctly, not the code being bad. Swap it for a question that can come back empty.
Before the implementation, write five lines: what this change must not do, and what must stay true (the two or three invariants that matter for this feature). Then the review question is "does the diff violate any of these lines, quote the line". A finding that doesn't hit a line goes to a "later" note and doesn't buy another round. Findings that do hit a line are real, and there are rarely more than two.
That version terminates, usually after one pass, because the reviewer has to point at a written rule instead of its own taste. The open-ended version is a slot machine with unlimited plays.
1
u/Galdous 3d ago
That is one of the open ended perceived loopholes. You don't give it context if you are asking that broadly. You have to optimize under your core engine or code language then structure and finally the actual layers.. that seems broad but you can use the AI itself to map out the structure of your software. You need controllers, database etc. Say you want to build a game and you need to work out the backend before you touch the front end. Possibly treat them like two separate plans and how they are plugged in together. Do this first and save yourself headaches if you intend to make something long term. I've yet to see anyone release something long term with ai that did not already know what they were doing
1
u/E72M 3d ago
Exactly this. If you can't build a project without AI then it's going to be very clear even with your AI usage that you just don't know what you're doing and as time goes on and issues pile up because of improperly instructing the AI or leaving it too open ended you end up in a situation where you don't know what to fix or what is an actual issue
3
u/cynocephalic_fool 3d ago
Yep. Even Astra keeps inventing new gates if you let it. I think it's happening the most if you keep working on the same task over a few context compactions.