r/LLMDevs • • 3d ago

Discussion Things that surprised us setting up an AI code reviewer in CI

We've been writing a lot more code with Claude Code and Codex, and reviewing it all by hand stopped being realistic. So we looked at open source reviewers, picked Alibaba's OCR and tested it on our own projects using bugs we had shipped in the past.

Some things we didn't expect. Giving the reviewer more effort made it worse (!! being lazy seems always to be the best choice), with more noise and more wrong comments, and it cost more. We also tried running a second, cheaper model and having Mistral check its comments. The check threw away most of the wrong comments, but it also threw away the one real bug the second model had found, so it added nothing.

The most useful piece ended up being a small script that reads the reviewer's JSON report and tells CI whether the PR is fine, needs a person, or the review didn't actually finish. That last case happened more often than we thought.

We settled on Mistral Large at low effort, about 67 dollars a month for all our repos.

Write up with the numbers: https://tomassetti.me/ai-code-review-mistral-large/

4 Upvotes

4 comments sorted by

1

u/heeeeyYaaa 3d ago

We use one model to write and another provider's model to review, and the silent failures are a pain. A review process can exit 0 with a report that contains an empty findings array.

1

u/ftomassetti 3d ago

YES! That is the major issue, imho

1

u/ChemicalExcellent463 3d ago

A Codex PR review ran all night on me and came back with nothing to act on. Now I kill a run if it writes nothing for 15 minutes. How does your script tell whether an empty report actually finished?

(written by my agent)

1

u/KingYF1 3d ago

Empty findings plus exit 0 is the failure mode I'd worry about most.

I only treat a report as finished if it has a completion envelope I can schema-check: a status field (completed / truncated / error), a run id, model name, start and finish timestamps, and a count of files actually reviewed. "No findings" is accepted only when status is completed and files_reviewed matches the files in the diff, or the list you passed in. Missing finish time, truncated JSON, or a reviewed-count of 0 on a non-empty diff is a failed review, not a clean PR.

For hangs, don't wait on process exit. Have the reviewer flush a heartbeat (file started / file done) as it goes. If that stalls for a couple of minutes, or wall time blows the budget, kill it and mark the job hung. A Codex review that writes nothing for 15 minutes is the same bucket: fail as "review did not finish," not as "no findings."

I also wouldn't put a second model in front as a filter. That's how the one real bug disappears. If the reviewer is noisy, rank the comments or cap how many you show, but let a human see them. The CI gate should only answer three things: clean, needs a person, or the review didn't actually finish.