iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🤖

One Year of AI Code Reviews: Insights from Operating ai-pr-reviewer

に公開
2025/12/08

About a year ago, ai-pr-reviewer, a GitHub Action that uses AI for code reviews, became a hot topic!
Around that time, we also introduced AI code review in our company and have continued to operate it while making minor configuration changes.
So, in this article, I'd like to share the insights gained from one year of AI reviews.

Workflow Configuration

Here is the workflow we are currently using!

name: Review by OpenAI

permissions:
    contents: read
    pull-requests: write

on:
    pull_request:
        types: [opened, review_requested]
    pull_request_review_comment:
        types: [created]
    issue_comment:
        types: [created]

concurrency:
    group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }}
    cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}

jobs:
    review:
        runs-on: ubuntu-latest
        if: |
         (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) ||
         (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) ||
         (github.event_name == 'pull_request' && github.event.action == 'opened') ||
         (github.event_name == 'pull_request' && github.event.action == 'review_requested' && github.event.requested_team.name == 'request_ai_review')
        timeout-minutes: 15
        steps:
            - uses: coderabbitai/openai-pr-reviewer@latest
              env:
                GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
              with:
                debug: false
                review_simple_changes: false
                review_comment_lgtm: false
                openai_light_model: gpt-4o-mini
                openai_heavy_model: gpt-4o
                openai_timeout_ms: 900000 # 15 minutes
                language: ja-JP
                path_filters: |
                    !**/*.lock
                    !**/*.sum

I'll leave the installation steps to other articles and focus on explaining the configuration items we were particularly mindful of.

Review Frequency

We set the review frequency to trigger when a PR is first opened and when the "request_ai_review" team is added to the Reviewers list.

Initially, we tried configuring it to review on every commit, but we stopped after about a week because, in addition to the rising costs, the reviews lacked consistency and were difficult to converge.

Since reviewing only upon the initial opening doesn't fit the workflow of creating a PR first and then continuing development, we prepared a Reviewers setting trigger as a mechanism to actively call for a review.
Specifically, we created a team called "request_ai_review," and when this team is assigned as a reviewer, the AI review is triggered.
(It's also possible to re-run it by removing and re-adding the team.)

(github.event_name == 'pull_request' && github.event.action == 'review_requested' && github.event.requested_team.name == 'request_ai_review')

Models Used

                openai_light_model: gpt-4o-mini
                openai_heavy_model: gpt-4o

First, the light_model isn't involved in the quality of the review itself but only returns summaries or short "poems," so we use the cheapest gpt-4o-mini.
The heavy_model is the important one, and we always keep it on the latest model (currently gpt-4o). However, recently, formatting issues in comments have become noticeable, and I've started feeling that it's somewhat hit-or-miss.

I'm not sure if this is due to gpt-4o, but I didn't particularly feel that the performance improved compared to the gpt-4 era.
In the first place, I felt that gpt-4 itself was gradually declining in accuracy over time. Looking back to write this article, the AI's comments from last year were clearly more polite.


↑Last year's review shows more enthusiasm, starting from the amount of text!

Execution Time

        timeout-minutes: 15

The execution time is set to 15 minutes.
While this can sometimes time out when there are many changes (like 100 files), we haven't increased it because there's also the argument that we should reduce the creation of excessively large PRs in the first place.

Things I felt we should be mindful of when utilizing AI

AI does not operate with an understanding of the entire codebase; instead, it basically functions by looking only at a limited scope.
As a result, in products that use unconventional coding styles, those parts end up being flagged in reviews every single time.
Of course, one could simply ignore them, but if reviews continue to be filled mostly with meaningless comments, people gradually stop reading them altogether. Therefore, I felt it is better to align with standards as much as possible.

For example, in our company, we originally had a policy of returning error responses using panic, which led to it being flagged every time. We eventually modified it to align with the framework's standard way of writing.

While it might be possible to prevent this by specifying "do not point this out" in the prompt, considering the use of other generative AI services like GitHub Copilot, I believe it will become increasingly important to implement code from the perspective of making it easily understandable for AI.

So, How Is AI Review in Reality?

When we first introduced it, there was an atmosphere of "We won't need human reviews anymore!", but to be honest, it gradually stopped being read because of too many unnecessary comments. There were instances of completely incorrect reviews, and as those continued, the credibility of the AI reviews themselves dropped, and I felt they were being ignored more often.
Of course, it is true that there are still beneficial reviews, and there are many times when the AI has already written what I was about to comment on in a code review. (It seems particularly strong with typos.)
While it is effective as a piece of reference information for senior engineers, it felt like it depends on the skill of the person handling it, as you'll be tossed around by off-target comments if you can't vet them properly.

Since these are just my impressions after continuing to use the archived ai-pr-reviewer, things might change if we use something like the official CodeRabbit. With various models other than GPT, such as Claude and Gemini, also appearing, I want to keep trying through trial and error so that we can actively utilize AI instead of just concluding that "AI is no good!"

Discussion