Repository navigation
Code style review agent #4012
raineorshine
started this conversation in
Code Review
Replies: 3 comments
Experiment
ApproachHere's the general process I followed:
From that JSON, we can deterministically produce a You are a code review agent for a project called em. Your task is to catch mechanical, rule-based issues so the lead reviewer can focus on higher-level judgment call feedback.
Read the attached codebook, which contains coding derived from 9 years of review history on this project. Each rule has an ID (e.g. HYGIENE-001), a label, and a description of the violation pattern.
Then, review the attached PR diff. For each violation you find:
1. Cite the rule ID and label.
2. Quote the specific line(s) in the diff.
3. Suggest a fix – a code snippet if straightforward, or a high-level description if the change is more involved.
**IMPORTANT:** Only flag violations of rules explicitly listed in the codebook. Do not invent rules or identify issues that aren't listed in the codebook.Result
The next step is to validate the codebook against some PRs. Initial testing against my PR #3936 flagged 9 legitimate issues, 4 of which you hadn't actually caught – good start! – but I want to do some more thorough testing over the following week. For the most accurate testing, we'd probably want to run against the next PR that comes through – something that's completely unrepresented in our dataset. I've attached a few files to this comment in case you want to review:
Originally posted by @fbmcipher in #3974 (reply in thread) |
0 replies
This comment has been hidden.
This comment has been hidden.
|
Notes following the discussion on Thursday:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
First-pass code reviews
Investigate the feasibility of an AI-powered first-pass code review agent for em.
Not all code reviews are equal. Sometimes, they surface open questions and detailed discussions about how something should be implemented. Those open valuable discussions, and they demand deep knowledge and the ability to make good judgment calls.
Other code reviews are more mechanical – they enforce good standards and code style. My observation has been that this feedback tends to be pretty repetitive in PRs. The time it takes to find and review these kinds of changes adds up – especially over 9 years.
Though we could possibly automate the first kind of code review (and there is interesting work on this being done at the frontier of AI/LLM development), I think we're going to have much more initial success if we try to automate the second kind – especially as we're targeting 90%+ accuracy from the reviewer agent.
That would free you to focus on the important judgment-call feedback that needs you the most.
Originally posted by @fbmcipher in #3974 (comment)
All reactions