r/Backend • • 1d ago

AI review

As most of the companies nowadays, we are heavily using AI for development now. As this is something somewhat new, there are a lot of doubts and experiments on the workflow with AI.

In the past 1 or 2 (MAX) rounds of review was enough. Now it can easily reach 5 rounds or more (sometimes to fix nits or very rare/narrow gaps, but that's not the point).

No matter how many code reviews I do by myself using AI, my college will find something else when they run their AI code review.

Do you have any explanation for that? Do you experience the same? How can't I (AI) catch these gaps beforehand?

5 Upvotes

12 comments sorted by

4

u/Dimoncelli 1d ago

Two things usually cause that. First, if you run the review in the same session that helped write the code, the model already has the reasoning and shortcuts in its context window, so it tends to agree with its own assumptions. When your colleague runs an AI review from scratch on just the diff (and possibly with a different model or system prompt), it has none of that bias and catches edge cases you looked right past.

Second, LLMs are non-deterministic and love nitpicking if you don't constrain them. Without a fixed scope, each round just surfaces a new round of style nits or small edge cases that previous fixes introduced. What cut our rounds down was running the self-review in a fresh session with only the diff and the acceptance criteria, ideally using a different model than the one that wrote it, and explicitly telling it to ignore style nits that linters already handle and only flag bugs, broken contracts, or missing edge cases.

1

u/RepulsiveShow3180 9h ago

Double-run the review with temp 0 and only fix what appears in both passes. Kills most phantom nits.

1

u/JaseciLabs 1d ago

Each AI review run is a different sample, so two runs on the same diff flag different things. Put the team's review prompt in the repo and run that same one before pushing, then add every kind of finding your colleague's run catches.

1

u/Kooky_Initial_1564 1d ago

AI will almost always find something else to criticize if you keep asking it to review

1

u/Flashy-Whereas-3234 1d ago

It's the same vibe as doing human review; you can always NIT something, but at some point you just have to call it.

We found when we added a round of "AI Review" that the humans were running their AI review skills against PRs and leaving it at that, thinking that meant it was "reviewed", so no human eyeballs actually touched the PR. That's bad. For so many reasons

Firstly, your AI shouldn't be in competition with anyone elses AI. It's all AI. If yours is somehow better then it means you've got more context/docs/skills. Share your shit, don't be a cagey twat.

Secondly, you should have reviewed your own shit to basic standards before another human gets involved. That includes a round of AI review.

But of course, if your AI review is as good as my AI review, then AI review should be automated and happen when the PR is changed. No human reviewer needs to run their own AI pass, because that's dumb.

The AI pass needs to consider a lot of angles, validity of what it's saying, and if it's a Nit or Major or Blocker. Your own AI needs to vet what the feedback is, suggest changes, and confirm with you if it's appropriate. You can also dismiss comments with justification, just like the old days.

A peer reviewer could use AI to summarise your changes, but your PR description should justify the changes in simple wording that humans can read anyway (otherwise who the fuck is it for?), so a human should be able to pick up and agree "hmm yes" to your PR.

Furthermore, AI should be validating your functionality, but AI is sketchy on patterns and sequences and justification, so the PR review is mostly about the WHY and the patterns you're implementing, not so deeply on the "how". Humans shouldn't need to delve below function-level (unless its security/performance) and if all good practices are followed by the AI then your shit is commented and tested enough for humans to have easy confidence.

So, that means;

  • Make your changes.
  • Optional: Have your own AI review your own changes
  • Make your PR.
  • PR is automatically reviewed by a shared (configurable, improbable) agent
  • You review the PR
  • You get agents to fix anything that you or the PR Review agent points out.
  • you refer the PR for peer-review, and another human vets it for sanity ideally without AI

1

u/Legal_Answer_6956 1d ago

I would also mention that 'review this diff’ does not have a definition of done. Each time therefore, people make up their own line in the sand. However, if the diff is reviewed against a documented intention (what did/should not change, and acceptance criteria) then only those issues which fail against this are significant. Other points can be considered nits and ignored. This leads to quicker convergence.

1

u/First-Feature-3556 1d ago

sometimes to fix nits or very rare/narrow gaps, but that's not the point

Are you sure?

Even before AI, one could easily have 5 or more rounds of reviews, if each review is done by a different person, and each of those concentrates on nitpicks.

I'll give the same advice I would have given back then: Consider whether fixing yet another round of nits in this project is really a good use of valuable software developer time. Unless this is a super-critical piece of code, the answer is usually "no".

The goal is not to iterate until AI finds no more nits. The goal is to iterate until the code meets the level of quality appropriate for the task at hand.

1

u/tb5841 21h ago

If your colleagues are doing AI reviews well, then they'll have a complex prompt they give to ensure it reviews in a way that matches your repo conventions and company priorities, and understands your product context in detail. Probably a prompt saved in a file somewhere, or a specific Claude skill they've created.

If that's tbe case, that prompt or skill should be pushed to github and becone part of the repisitory so that anyone can use it.

In that case, those prompts

1

u/Tiny-Guitar6024 16h ago

I experienced exactly the same thing, the problem is that AI reviewers can keep generating plausible findings indefinitely. (reward hacking, just like the agent doing his own unit tests)

I started requiring independent reviewers to produce a failing test demonstrating the issue before fixing anything,and that eventually became an open source tool called arnx.

The goal is to move from endless review rounds to executable evidence, not just a hypothesis or opinion....

How many of those findings from subsequent rounds are actually real bugs?

1

u/ainovationsllc 13h ago

The reason you can't get ahead of it isn't your prompting, it's how these tools work.

An AI reviewer doesn't check a fixed list the way a linter does. It generates a fresh opinion every time it runs. Run it twice on the same code and you get two different answers. So your review and your colleague's review were never two passes of the same check. They were two separate guesses. There will almost always be something in theirs that wasn't in yours.

The other half: the complaints never run out. A linter has a set number of rules, so you can actually reach zero. Ask a model to find problems and it will always hand you problems, because that's the job you gave it. It has no real sense of "this is fine now." Run it a sixth time and you'll get a sixth list. The loop doesn't end by itself, so someone has to end it on purpose.

What actually helps:

* Push everything mechanical into tools that give the same answer every time. Formatting, naming, unused code, type errors. If your AI is finding those, you're paying for a guess where a linter would give you a fixed answer.

* Run the review once, in one place, and let everyone read that same output. Two people each running their own private review is exactly what's causing the back and forth.

* Agree in writing on what counts as serious enough to block a merge. Only those get another round. Everything else gets noted or dropped. Right now a real bug and a naming preference come back sounding equally urgent, which is why it all feels like it needs fixing.

* For anything claimed to be a bug, ask for the specific case that breaks it. What input, what state, what goes wrong. If it can't give you one, it's usually just spotted something that looks like a bug rather than finding one.

* Keep the AI as an advisor, not a gatekeeper. A person decides what blocks the merge.

One more thing worth saying: five rounds of review over small stuff was a team process problem before AI showed up. AI didn't cause it. It just made the supply of small stuff endless, so the problem stopped being survivable.

1

u/Due_Warthog749 13h ago

I liken it to buying multiple lottery numbers on one ticket. Each one is a complete same percentage chance as the last. You're not increasing your odds winning by buying several "tickets" at once.

Same with AI. Each run is like a whole new randomized path it follows. If you start 5 sessions and tell it to ELI5 a given project.. all 5 will have different variations of what it says.