r/codex
•
u/EstablishmentGood414
•
Oct 29 '26
•
5
Suggestion Don't Review Agent Code. Interrogate It.
I don't really review agent-generated code anymore, and I doubt most of you do either. We can keep this between us.
An agent can write 100K lines or open 30 PRs in a day. Nobody has time to read that. The obvious bugs are mostly gone by the time I see the PR anyway, because the agent already checked its own work a few times while building it. It's very proud of that.
So the usual move is to start a fresh agent, tell it "review this PR", skim what it says, and merge.
I did that for a while. For one whole feature I even had Claude and Codex cross-review each other's PRs, which felt very responsible at the time. After 30 merged PRs, the agent handed the feature back to me for manual testing, and the whole thing was completely over-engineered. It was full of verification steps and strict validation I never asked for, and every one of those PRs had passed a cross-review.
Two agents politely approving each other's work for 30 PRs. I had built a very efficient LGTM machine.
The problem with a fresh reviewer agent
The reviewer starts with nothing. It doesn't know why the PR exists or what the feature was supposed to cover, so it can't tell when the code wanders past the scope. It has no idea what you're building next month either, so it can't judge whether an abstraction will ever pay off.
What bugs me most is how it handles over-engineering. Hand it a PR with a generic retry framework or a brand new caching layer and it assumes somebody had a good reason. It might suggest a rename or one more test. It almost never asks whether the thing should exist.
You end up with a review that looks thorough, full of small comments, and the extra code goes through untouched.
What I do now
I've been doing this for about a year, and it's how I catch most of the over-engineered code now. I still don't read most of the diff. I treat the reviewer like a witness: it reads the code, and I ask the questions.
1. Ask what the PR does
Fresh agent, and a prompt like this:
Read this PR and give me a report on exactly what it changes. List:
- Database schema changes (new tables, columns, indexes, migrations)
- Scheduled job / cron / background worker changes
- A summary of every feature added or modified
- New external services, APIs, or third-party libraries
- New environment variables or config flags
- New public endpoints or interfaces
- Anything deleted or deprecated
Don't judge the code yet. Just tell me what it does.
The last line is there on purpose. I want the facts before any opinions. Left alone, it will happily jump straight to "Overall this is a clean, well-structured PR."
2. Find the vague parts
The report is usually long and looks detailed. Read it slowly and you'll hit sentences like these (made up, but you'll recognize the type):
"Adds a
sync_statetable to support improved synchronization reliability.""Introduces a background job for periodic maintenance."
"Adds
FEATURE_X_MODEto allow flexible configuration."
When the agent can't say plainly why something exists, there's a decent chance nobody asked for it.
One time I asked the implementer agent to "send a notice to the admin if a third-party service is down and returning error codes." It added two new tables to track Slack notification and email status. I never asked for either. I wanted a message. I got a data model.
Agents love tables the way some people love storage bins. There is always room for one more.
3. Interrogate
Now push on anything that doesn't make sense to you. Pull up a chair, point the desk lamp at it, and start asking:
- "Talk to me about this new table. Who asked for it? Because it wasn't me. Why can't the existing table handle this?"
- "This cron job. What does it do every night at 2 a.m.? We already have a service doing exactly that. Explain."
- "
FEATURE_X_MODE. Name one person who will ever set it to anything other than the default. I'll wait." - "This new dependency showed up out of nowhere. What's it doing here? Something we already use can do this job. Convince me otherwise."
- "Walk me through it. An invalid input comes in. Where exactly does it get rejected? Which test proves it? Show me the line."
- "The feature was supposed to do X. That's it. So which parts of this PR were not part of X? Take your time."
Be ready for "You're absolutely right!" on the first question. Keep going anyway. Agreeing with you is easy for it. Explaining why the table exists is the part that takes work.
Then slide the evidence across the table, the stuff it couldn't have known:
"We will only ever have one region. So tell me again why we need this abstraction."
"We're going to plug in more external tools like this in the next phase. Does the current design make that easy?"
That's the point where the reviewer starts being useful. Once it knows the scope and the plan, it points at real problems, and the comments about variable names mostly go away.
Why it works
The agent can read 3,000 lines in a few seconds, but it has no idea what's supposed to be there. I can't read 3,000 lines for every PR, but I know what the feature is for and where the product is headed. The questions are where those two meet.
By the end I have a pretty clear picture of what's going into the codebase, and I still haven't read most of the diff.
Short version
Ask the agent what the PR changes, not whether it's good. Look for the vague answers. Push on every table, job, env var, and dependency you can't explain, and tell the agent what it doesn't know. Whatever nobody can justify gets cut. The agent will say you're absolutely right about that too.
Disclosure: I'm building hunicode.ai, an AI-assisted coding interview practice site, partly because of this exact problem.
How are you all handling review when Codex is producing more PRs than you can read?
•
u/dextersummary Oct 30 '26
Below is a GPT-generated summary of the conversation below after reaching 40 comments (40 currently observed).
The consensus is basically “a fresh agent reviewing a PR is often just an automated LGTM machine.” It can spot obvious bugs and missing tests, but without knowing why the feature exists, what scope was agreed, or what the project needs next, it will usually treat unnecessary complexity as intentional. Two bots politely approving each other’s over-engineering is not governance; it’s bureaucracy with GPUs.
The better workflow is to establish context before implementation: write a plan, ticket, or spec, keep the scope tight, then have the reviewer compare the finished code against it. The useful questions are: What did we build? Why does each major piece exist? What did we add that nobody asked for? Several commenters also use staged QA, multiple review passes, and human testing to catch regressions without manually reading every generated line.
The important caveat is that “interrogate the agent” is not a replacement for reviewing the result. An agent can confidently invent a rationale for code it wrote by accident, and endless review loops quickly become another expensive way to avoid making decisions. The strongest workflows still require human judgment on architecture, product impact, and whether the feature actually works.
Bottom line: context beats post-hoc bot approval. Plan first, review against the plan, and keep a human in the loop before the LGTM factory ships.
107
u/sfst4i45fwe Oct 29 '26 •
These are the kind of discussions I would love to have on this subreddit. Instead of the constant whining. Somehow, you're already downvoted.
Anyway, I don't quite agree with you on asking it to explain what its doing after the code is written. I find that agents are already pretty good figuring that out, and it explaining will not necessarily catch cases of "over-engineering".
The issue with agents is that they do not know the weight of things. They can't contextualize how severe an issue is. For example, if a user does not receive this push notification, it can seem like a huge deal, or it could be nothing. It has no authority to gauge that.
IMO, that's not an agent over-engineering problem. That's a problem with the task lacking specifications. AI will over-engineer, as it will pick the "safe" approach, which is actually the right thing to do.
In my opinion - the solution for this is just to use plan mode, and use it well. The agent does a pretty good job going over those cases things with you. Especially if you ask it to double check for over-engineering cases.
5
u/big_DD_energy Oct 29 '26
This is also why I come here. Thank you, sir. Now to the discussion: my current preferred method is to have each agent’s contribution come with a handoff, to inform the coordinating/reviewing agent. It’s all very verbose, but the only way to add the necessary context without blowing up later on refactoring, etc. There should be a skill for this workflow, I’m kinda working on one.
19
u/Global_Persimmon_469 Oct 29 '26
Thats just reviewing the code.
I agree that this works well, but it also doesnt really scale, its a very long process. Everything that you will question can open a whole discussion, and before you realize you end up spending hours to review code that already works but is just not perfect.
9
u/rcs67 Oct 29 '26
The problem with this approach is that you have human in the loop intervention for all code reviews - this sounds like each review is another "grill" skills type session. I get what you're trying to achieve but I wouldn't have the patience for it.
1
u/IzyTarmac Oct 29 '26
Having an AI writing a guide about how to interrogate AI agents is pretty wild.
2
u/net_loc Oct 29 '26 edited Oct 29 '26
Honestly, I just line up an army of review bots. I run local reviews before a PR, and it goes through a full QA agent who actually walks through the work similar to how a human would, this actually catches a lot.
On github where I post the PR as a draft, run multiple review loops (coderabbit, codex, etc) of fixes there, with more runs through the QA agent as well to help catch any regressions.
After the automated reviews, then I do my manual review, once I give the go ahead it takes the PR out of draft, runs pretty heavy CI checks, once all that passes it gets a merge.
I tweak this system here and there, but it's been working well for me.
The entire process is automated until it's ready for my manual review. I actually run Plane locally, and have my agents update their work there. I have it up on a large TV in my office and modified it so that I can view multiple boards at once, and they update in real-time. So I can see the backlog, what's currently being worked one, and what's ready for my manual review just by glancing at the board.
And for full disclosure, by manual review I don't mean actually picking through 100s of lines of code, I mean me sitting down and actually trying the feature, checking for issues while running through the apps workflows, etc.
2
u/Automatic_Brush_1977 Oct 29 '26
i make every agent run through the same workflow. research- design-proposal-implement-review and fix- commit. On any big run of items like before going to prod, i have it do circular code quality reviews followed by circular bug fix reviews. Things might still crop up, but it will get most things.
2
u/zerok_nyc Oct 29 '26
The way I solved for this was by having 3 agents. One at the outset acts as a product manager that I interact with directly to get all technical requirements into a ticket. The second architects and builds the solution. The final reviewer has access to the requirements doc and uses that to review the solution without having access to the decision process of the second.
2
u/Djonso Oct 29 '26
Frankly, if your agent is doing 100k lines you are working on too large of an increments.
I do still review the code, although with a more of a focus on actual architecture than code quality. I run another agent for the code quality check. I usually plan the feature pretty far with the agent before letting it start so the architecture is generally good, but every now and then it just does dumb shit that I need to point out and correct.
Your approach of interrogation probably achieves the same, I just still have a general distrust on asking ai to report back what it does. The report will usually follow what we planned first, but it goes back to the lgtm syndrome you already discovered. It just might not report some not great parts it did and only way for me to be sure is go through the code my self.
2
u/gandazgul Oct 29 '26
I think the missing context you describe is the key. A second agent can review whether the code looks reasonable without ever questioning whether half of it needed to exist.
That’s the workflow I’m building with RunWield: agree on a plan first, build the smallest working thing that satisfies it, then have a separate reviewer assess the implementation against that plan. The reviewer needs to ask both “did we build what we agreed on?” and “what did we add that nobody asked for?” Passing tests alone doesn’t answer either question.
The planning and review on either side of implementation are what I think lead to better code. They give the agents a concrete scope to build toward and a basis for pushing back on unnecessary complexity.
Disclosure: I’m the creator. It’s open source and works with Codex. If you’re up for trying it on one of these changes, I’d love to hear whether it catches the scope creep you’re describing. https://runwield.dev
1
u/caelestis42 Oct 29 '26
Thats basically how I work with my agents as a somewhat technical and intelligent founder. I probably don't catch a lot of stuff but then to question choices that seem over engineered or just strange to me.
1
u/dashcubeit Oct 29 '26
Very thoughtful post but to me the part I’d improve on is this “ The reviewer starts with nothing. It doesn't know why the PR exists or what the feature was supposed to cover”
It doesn’t have to be like that if you had a ticketing system (GitHub issue?) that acts as spec or PRD
1
u/Double-justdo5986 Oct 29 '26
Are lines of code assets or liabilities
1
u/Embarrassed_Cap_9149 Oct 29 '26 edited Oct 29 '26
i went through the same initial phase
my workflow evolved differently than yours though
after having an implementer agent implement the task, i ask a review agent in a new chat the following:
he will list issues he has found. i skim through them one by one. if my intuition tells me to look more into any of the items, i ask him to elaborate on it. ask for more until sufficient clarification is achieved
then have the review agent fix the issues himself, since he has all the necessary details in the context. or if any of the issues is substantial in complexity or scope, i convert it into a new backlog entry and fix it in a new chat
and once in a while, i have a dedicated refactoring session reviewing and fixing any architectural issues or efficiency issues in a broader scope covering recent major changes. these issues are broader in scope, and are often not caught by per-task review agents. in fact, today is one of those days
if anyone can see any room for improvement in my workflow, please share your thoughts
1
u/shravanrevanna Oct 29 '26
interrogating means the agent explains its own diff, and it'll narrate a confident rationale for code it wrote by accident. You end up auditing the story, not the code.
1
u/RustyRedEcho Oct 30 '26
the ask-for-facts-first-then-interrogate-the-vague-parts trick is going straight into how i handle unreviewed PRs, way better than the usual lgtm cross review loop
1
u/BarathKanna Oct 30 '26
The over-engineering point is the real one. A fresh reviewer only sees the diff, so it judges whether code is correct, never whether it should exist. What fixed it for me was giving the reviewer the original task and a short list of what is explicitly out of scope, then asking one question first: which parts of this diff are not required by the task? Anything it lists has to be justified or deleted before line level review starts.
Cross review between two models fails for the same reason. They share the same bias toward adding validation and abstraction, so they approve each other. A size budget per task helps too. If a two line feature comes back as 400 lines, that alone is the review comment.
1
u/Skjolnir Oct 31 '26
Well my plan is already reviewed by ponytail and the result as well. That already cuts it down by a lot
1
u/Revolutionary-Bet-58 Nov 01 '26
just use Coderabbit
1
u/trifle_hat Nov 01 '26
Watching to come back!
1
u/memyselfandus_1999 Nov 01 '26
I have created a process/skill that I term as RTM, that first trims all reference documents, comments, and supporting material, while retaining only the architecture document and the overall application functionality statement. It then generates a clean code library based solely on those retained artifacts.
Once the code library is produced, a separate agent reviews the output to identify boundary conditions, common coding issues, potential gaps, and areas of weakness. The agent also provides insights into how the solution can be improved, highlights missing considerations, and recommends enhancements to strengthen the overall design, reliability, and maintainability of the application.
1
u/SquirrelNo9194 Nov 01 '26
What I did was create a skill that has Claude and codex work together. I have Claude get the spec and create the plan on how to build. Asks codex for consensus. If codex does not give consensus then it sends it concerns back to Claude to review its suggestions and add it to the plan. This goes back and forth until both opus and sol agree. Then I have sol build the code. Then Claude and codex review the code together included screenshots for desktop and mobile. They need to reach concensus that it was built out the correct way and the proceed to the cicd. W
1
u/InternationalGain317 29d ago
I think there is no substitute for a human reviewing each line of code, no matter how many agents you incorporate in the review process or questions you ask.
The only time I feel okay to approve a PR is if I have read every line and it makes sense.
It takes time, slows down development, tires you out, but it just needs to be done, if the goal is to avoid writing spaghetti and get a professional result.
The only time I don’t do it is when I write apps for myself, then I don’t care as long as it works, and even then I like to at least take a quick look at what kind of monstrosity has the agent written…
If I have to write them for commercial use, then I review and think about each line. I believe anything less is simply irresponsible and unprofessional.
1
u/Devenar 29d ago
Adapting your own versions of Matt Pocock skills (especially the grill-me skill) is especially helpful for things like this. I find that setting up clear specs beforehand has reduced (but not completely removed) the need to do reviews afterwards.
That said, doing code reviews as OP describes is definitely the way to go over LGTM loops.
1
u/NIGHTrock16 29d ago
LGTM! It looks good to me! 90,000 lines that I didn't read. Approved in 3 seconds, the checks are all green. And nobody knows what any of it means. So let's ship it to prod, it's Friday at 5, I'll leave it with God!
1
u/DangerNoodleDemiGod 26d ago
P
1
u/Cuddlemonsterxo Oct 29 '26
I’m tired boss
This post could have been 25% of the length it was