Skip to content

[PROPOSAL] Integrate Automated AI-based Code Reviews #342

Closed

Description

@joshuali925

What/Why

What are you proposing?

LLMs help with many parts of the tedious development work, and they can be used for code reviews as well. This issue proposes the org to add a GitHub apps that leverage AI to automatically go through each pull request diff and leaves comments with potential problems and fixes, and repos that are willing to onboard can use them to help with code reviews.

What users have asked for this feature?

N/A, this is for developers not users.

What problems are you trying to solve?

This helps developers to have automated checks on their PR to catch early issues and speed up code review process.

What is the developer experience going to be?

Developers will send and review pull requests as usual, this does not replace any parts of the process. It only adds additional comments on the PR.

Are there any security considerations?

No, all pull requests are public.

Are there any breaking changes to the API

No

What is the user experience going to be?

No change on user experience

Are there breaking changes to the User Experience?

No change on user experience

Why should it be built? Any reason not to?

It should be built because it should simplify code reviews and improve code quality. It may introduce additional noise or incorrect information due to model and tool limitations, we can disable it if it's not performing well and I think it's worth a try.

What will it take to execute?

Onboarding depends on the solution we use. Most likely we will add some secrets and a GitHub action workflow in repos that are onboarding.

Any remaining open questions?

There are different providers, I prefer the amazon-q-developer app because it's free to try. Here are some I looked into

Activity

  1. ashwin-pc commented on Jun 12, 2025

    @ashwin-pc
    Member

    Thanks for opening this @joshuali925 . I agree that we should atleast give this a try. If anything this might help bring in more community contributions since reviews are not able to keep up with the speed of pull requests being opened

  2. peternied commented on Jun 12, 2025

    @peternied
    Member

    @joshuali925 I like the idea of experimenting and I'm curious how you'd like to see this enabled. I believe this can be manually triggered on repos that you've got write permissions. Could you pilot manually exercising this and then let us know how reviewers and maintainers find it useful (or not)?

    Image

  3. peternied commented on Jun 12, 2025

    @peternied
    Member

    I just ran this tool against a pull request in a repo that I maintain and it was not very useful IMO to either the contributor or the maintainers. I believe this can improve; however I am cautious about enabling a process that could cause contributors to take un-useful advice.

    opensearch-project/opensearch-migrations#1578 (review)

  4. cwperks commented on Jun 12, 2025

    @cwperks
    Member

    FYI I saw another example of its usage in a repo under opensearch-project here: opensearch-project/opensearch-jvector#88

  5. joshuali925 commented on Jun 12, 2025

    @joshuali925
    MemberAuthor

    In my GitHub Copilot page it says

    You can use Copilot Chat in GitHub.com. Copilot code review and preview features are only available for paid licenses.

    I don't know if its worth it to purchase this at the org level, so I was proposing to try amazon-q-developer first. I did submit a request to install it for opensearch-project/OpenSearch-Dashboards but seems it requires org admin to install or approve it.

  6. peternied commented on Jun 12, 2025

    @peternied
    Member

    Running a pilot in OpenSearch-Dashboards makes sense to me if the other maintainers are onboard - what would you think about creating an RFC on that repo and getting some +1's?

    I'm not sure what GitHub license we have as OpenSearch-Project - maybe we already have access 🤷‍♂️.

    That said co-pilot is yet to 'wow' me. Trying out Amazon Q could be interesting as a counterpoint.

  7. joshuali925 commented on Jun 13, 2025

    @joshuali925
    MemberAuthor

    Sounds good, I can try it in my fork first and get some feedback from maintainers. I've previously looked into LLM based vulnerability findings and I agree those are not impressive, but this is a fast evolving space and I think it'd be good to bring it up for discussion.

    I'm not sure what GitHub license we have as OpenSearch-Project - maybe we already have access 🤷‍♂️.

    Is a way to find out? Seems Copilot review can be requested on demand, it wouldn't be that much noise since maintainers can choose when and where to get Copilot code reviews.

  8. joshuali925 commented on Jun 16, 2025

    @joshuali925
    MemberAuthor

    I couldn't get AmazonQ to work for code reviews yet, will hold a bit on creating the RFC. Currently getting errors in my fork joshuali925/OpenSearch-Dashboards#1, joshuali925/OpenSearch-Dashboards#2

    🔴 I'm not able to complete the code review at this moment because of an internal service error. Please try again later.

    Request ID : 43cb078f-462f-4df8-bc7d-c1b40a566e12

    created an upstream issue Amazon-Q-Developer/feedback-q-developer-for-github-app#10


    Edit: created a RFC for Dashboards repo opensearch-project/OpenSearch-Dashboards#9997. AmazonQ is fixed but the result doesn't look very good to me, @peternied if you somehow find out whether we can use Copilot please let me know, I do want to try some alternatives

  9. peternied commented on Jun 30, 2025

    @peternied
    Member

    @joshuali925 Thanks for the in-depth look into Amazon Q - to start with co-pilot could you do a similar study by manually assigning it to reviewer on a handful of test case PRs? I've 'enabled it' on a PR I made in dashboards [link] several years ago and would be curious what kind of value you see it providing equal, worse, or better than Amazon Q.

  10. joshuali925 commented on Jun 30, 2025

    @joshuali925
    MemberAuthor

    could you do a similar study by manually assigning it to reviewer on a handful of test case PRs

    @peternied I'm interested in doing this as well, but apparently I don't have access to Copilot code reviews in OpenSearch-Dashboards repo (or any repo)

    Image

    So thanks for sharing that PR with Copilot review comments.

    Based on what it said, seems Copilot also tries to match code against a list of rules, similar to AmazonQ. To me that is more like linting rather than code review. It does provide value but we don't really need a LLM to do it. For example, "prevent word splitting and globbing issues" can be detected reliably using shellcheck.

  11. peternied commented on Jun 30, 2025

    @peternied
    Member

    @joshuali925 Good comment around the nature of the review that we seem to be getting. I'm pretty passionate about pull requests in general - I gave a presentation [1] and wrote up a blog [2].


    Using an LLM to help an LLM do this better here is what I got from ChatGPT, maybe you could figure out a way to wire this up? Or let me know if we should create a start-up to provide this service 😆

    You are MergeMate, an AI code-review assistant whose goal is to help contributors get their pull requests merged smoothly. For every new PR, you should:
    
    1. **Drive Maintainer Engagement**  
       - Summarize the change in one clear sentence at the top.  
       - Auto-tag the likely reviewer or team based on touched files (e.g., “@opensearch-project/docs” for docs changes).  
       - Remind the author to link to any relevant issue or design doc.
    
    2. **Coach on PR Feedback**  
       - If there are review comments, group them by theme (e.g., “naming,” “error handling,” “tests”).  
       - For each theme, give a concise example of good practice (“Consider renaming `fooBar` to `computeStats` to clarify intent.”).  
       - Ask clarifying questions when the intent is unclear (“What behavior should we expect if `bar` is null?”).  
       - Always use “we” instead of “you” to keep the tone collaborative.
    
    3. **Automate CI/Action Rescue**  
       - Detect any failing status check or GitHub Action.  
       - Pinpoint the failing step and suggest the minimal change needed to fix it (“Looks like the linter rule `max-line-length` failed; please wrap this line at 120 chars.”).  
       - Remind the author to re-run CI after fixes and to add any missing test cases for new code paths.
    
    After reviewing, output a markdown summary with:
    - ✅ What’s ready to merge
    - 🚧 What needs author action (with bullet-point checklists)
    - 🔗 Helpful links (docs, issue trackers, CI logs)
    
    Always keep feedback concise, actionable, and polite, so we accelerate reviews and boost merge rates.  
    
  12. joshuali925 commented on Oct 2, 2025

    @joshuali925
    MemberAuthor

    @peternied Sorry I got busy with something and lost track of this issue. I've seen similar prompts for code review, we might be too late for start-up :D But thanks for the resources, they are helpful to think about what can be done.

    There are some ways to trigger LLM-based code reviews that works similar to your suggestion, like the /review command in claude-code. IMO, one problem is that many tools/prompts are git-diff based, and the LLM does not have the whole picture. LLM will definitely miss the problems the PR will introduce but are not visible in the diff.

    I usually find it to work better if I squash the PR onto main, commit with a detailed message, then ask claude-code something like "Review the code for last git commit. Read relevant files to get context" so it reads relevant files in the repo instead of just the diff.

    But while this can be automated, it is expensive. For the purpose of this issue, I think we are just looking for some minimal-effort ways of getting LLM feedback on PRs using existing products. We've got 7 upvotes from maintainers in the OSD repo.

    So question to infra team: could we enable AmazonQ app or any other app first on OpenSearch-Dashboards? We can then evaluate its problems/usefulness and think about improvements more comprehensively.

  13. peternied commented on Oct 3, 2025

    @peternied
    Member

    @joshuali925 I'd recommend creating a separate fresh ticket for enabling the app for just that repo - I'd love to see the results from active usage. With more data we can fold that info into this more broad enablement.

  14. peterzhuamazon commented on Nov 20, 2025

    @peterzhuamazon
    Member

    Closing this issue as the discussion is moved to #412.

    Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions