r/codex • u/jaysonrobinson • 23h ago
Question I'm in edge case hell. What am I doing wrong?
In the last month or two, I have found using Codex an absolute nightmare. I used to be able to just say roughly, "This is what I want at a use-case/functional requirement level... consider the following edge cases and account for them... off you go." and it would work basically every time.
Now, sessions seem to be dragging on for days as it constantly finds new edge cases to try and fix. When I stop and dig into it, the explanations I get are ludicrous, like the odds of it happening would be infinitesimally small - "Oh, if a user selects an option, then their connection drops and they background the app, and then they come back to it later and in that time the data provider has changed the primary identifier it would fail."
I can't seem to prevent it, despite prompts and instructions to:
- "focus only on the top few edge cases"
- "this is not enterprise-grade software - be practical in your approach to testing and edge cases."
...and things like this.
Has anyone else encountered this, and if so, how did you overcome it?
It doesn't seem to matter what model/effort I use, although it does seem to be worse when I use a /code-review loop that I built that goes through max 3 rounds of code review with other agents - Claude and Codex.
For context, I am semi-technical, have worked in tech for over a decade, but not a SWE.
15
u/itix 22h ago
This is an architectural problem in your app design. You lack generalized failure handling mechanisms. It could be something as simple as "reset app if any problem occurs". Now you have infinite number of different error cases and it tries to account them all.
Prompts like "this is not enterprise grade software" are useless because there is no definition for enterprise grade software. In fact, they are often just bad. Instead, generalize error handling and define a list of failures that should be specially accounted for. The "top few edge cases" is vague again, like I am more critical of FAANG slop than others while somebody else is happy with any junk app they spit out.
5
u/Unhappy-Loss-97 19h ago
A 3-round Claude/Codex review loop with no stopping rules is basically an infinite edge-case factory. Both models are trained to sound thorough, so if they don't find a real bug they will happily invent a theoretical one just to avoid saying "looks fine".
Four rules snapped mine out of that spiral:
6
u/RudyHuy 23h ago
That's what gpt added for me in
~/.codex/AGENTS.mda long while ago and so far it's been working well:2
u/MaqeSweden 23h ago
Are you still using the same chat that you started working on this issue with?
It can be a good idea to have it write its shortest possible handover file and start it again with a new chat agent and explain to it before it reads the handover file what you felt the issue was - let it read the handover - and then create a plan for how to solve exactly what you want and nothing else.
Then let it set one or more sub-agents to execute on said plan and have the main chat orchestrate and keep an eye on that they are following the plan.
2
u/ErikaFoxelot 22h ago
Sometimes I’ve noticed that it can get hyper fixated if i try to attack the same problem over and over again. ‘Edge cases’ is vague - if you’re not defining exactly what you want it’ll interpret that as a justification to find edge cases, even those that may never have been a problem.
It’ll create problems to satisfy your request to fix problems.
3
u/Party-Temporary-2813 18h ago
You can do what every single tech company on the planet does and review the code and then ask for specific changes.
3
u/anime_daisuki 15h ago
you built a loop where three rounds of agents exist to find problems and you're confused that it keeps finding problems?
3
u/DanGTG 11h ago
Ask it to look at the found bugs and classify them into families, then ask it to look for a root solution for each family of bug because you feel there is likely a broad simple solution that has been overlooked.
1
u/i_reddit_it 22h ago
I had the exact same issue.
Open API really messed up with the 6.x models, no amount of prompting fixes it.
I still think Codex models are great providing you don't actually get them to do any of the implementation.
If you've not tried Claude yet, get a $20 plan and test it out, you'll soon realise it's not a skill issue.
2
u/Right-Performance-93 16h ago
asking it to consider edge cases is the job it is doing. take write access off the reviewer and let it name one check that already failed. a new case with no failing run does not get a handler.
1
u/avivng 22h ago
I'm having something similar, In my case at least it is connected to the model used though. It happens whenever sol 6.2 is used. It will just find new issues on every check made. When switching back to sol 6.1, it approves the changes and finds no issues. In my case, I am currently trying to solve that by telling the ai agent to give a score to issue it finds based on some criterias we've found online. Based on something like that, perhaps, you could tell if some findings are worth your time or not.
1
u/Swimming-Bank6567 21h ago
I've been spending a lot of time rebuilding my whole workspace, so file structures, etc. Ive then had 4 runs at getting the LLM to audi, and then rewrite documents and .MD files.
Long story short... I'm still finding massive issues, however this had led me to a funny/strange spot. Apart from a memory MD files, everything is now new, and that I've placed. But... The LLM is still finding files it deems to be authoritative, but this has been my breakthrough. I'm babysitting work, and at the first sight of a problem, and taking extra care to not complain, but ask the model why it's done something and eventually it'll tell you what it read, and why it interpreted something in the way it did; it takes a bit of prompting 😂. This is where I've then been concentrating my efforts, and step by step the whole setup is improving.
My agent server has been running since Feb, so it doesn't surprise me, after all this time, that there's all sorts of strange things it's self-made, from different models, that it thinks are current trust/direction. Even dictated project magically have things in them that I wasn't aware of.
Anywho, no idea if this helps. 6.2 is still being a durp, but I now have an idea as to why... All of this started from building a while new server to house codex/Hermes, it was dumb though at least acting a bit more "normal". Once I copied over a project, it would start falling for the same traps.
1
u/xqianliu 20h ago
I write the expected behavior and the non-goals in the issue before the run, then check the final diff against both before approving a merge. An extra edge-case handler has to point at something the issue actually asked for.
If one of those low-probability cases really matters, I add it to the acceptance criteria with a concrete test. The rest can stay out of the task, which gives the agent a clear place to stop.
1
u/ChemicalExcellent463 18h ago
Codex over-validates for me too, and what helped was refusing new safeguards unless an observed failure, a log line or a failing test called for one. Your 3-round cap limits the rounds, not how much extra stuff gets added in each one.
1
u/Tacdel0 14h ago
i'd look at the review loop first. a reviewer agent that's asked to review will always find something, so 3 rounds pretty much guarantees fresh edge cases. make it tag each finding as blocker or nice to have, with a real repro, and only send blockers back. if round one has no blockers, end the loop there.
1
u/digiorno 10h ago
Have you called it out: “it looks like you’re trying to avoid doing real work by focusing on edge cases that don’t matter? Why are you doing this? Just complete the work that I am asking of you.“
I said this to an Astra 6.2 agent that I had working on a custom interface for my TV and it basically responded with “You’re right. I can’t implement this software even though the design is technically sound, and I’ve been doing more tests on the Linux environment instead of doing what you requested.”
I had to drop down to a lower level model to actually get it to install the software. And then the lower model said “I don’t know why the other agent wouldn’t install this but this is ready to go and I’ll install it for you now.”
1
u/Last-Bluejay-4443 10h ago
Put in the caveat of “include must haves only” when it comes to edge cases
1
u/Bolizen 2h ago
Do you have that codex setting enabled that always searches for bugs
1
u/HATENAMING 1h ago
Your specific case just need a general catch for unhandled cases instead of finding every single edge case. In general from my past 2-3 days of intense usgae due to all the free reset I found that the best way to combat over engineering / thinking is to set a clear objective and a reasonable time limit. Tell it in goal that it has x hours to achieve y. GPT models follow that strictly and also has a pretty good sense of time. This pushes it to work towards more important tasks.
0
u/jim_nihilist 23h ago
This is how OpenAI makes money.
Even the most simple process gets compartmentalized into 64 steps.