Building AI Code Review into CI
The design for building a mechanism that has AI automatically check code changes into your CI, and where to draw the line so it doesn't replace human review.

Ren

Procura
The VPS's role
- Set up an endpoint that receives the change from CI, passes it to the AI and compiles the result
- Build a mechanism that returns the result as comments on the change
- It doesn't need to run all the time; it only needs to run when there's a change

Ren

Procura
Where to draw the line so it works well
AI review works well when you position it as an aid that reduces the effort of human review. The division of roles is that the AI handles the fine-grained comments while people concentrate on whether the design and intent are sound. Don't swallow the AI's comments whole and mechanically fix things; keep the premise that people make the final decision.
- Treat the AI's comments as 'suggestions' and don't apply them automatically
- The more important the change, the less you should skip review by a person
- Check that the code you hand to the AI doesn't include information that must not leave your control

Procura

Ren

Procura
Narrowing down what gets commented on
If you hand the AI the entire changed code every time, it not only drives up costs but also increases loosely related comments, which raises the burden on the reader. You can balance the quantity and relevance of comments with measures such as passing only the changed parts and their surroundings, or narrowing down the types of files targeted. Start with a narrow scope and widen the target as needed.
- Pass only the changed parts and their surroundings to reduce unrelated comments
- Decide in advance which kinds of files are targeted (only code, excluding config files, and so on)
- If there are too many comments, narrow it down so that only high-importance ones are shown

Ren
This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.