Improve PR Bot reviewer assignment / pinging#37663
Improve PR Bot reviewer assignment / pinging#37663kennknowles wants to merge 1 commit intoapache:masterfrom
Conversation
1. It missed review comments, so would ping even when review was active. 2. It would not treat Github UI review assignments the same as "R:" comments
|
R: @damccorm |
Summary of ChangesHello @kennknowles, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refines the PR bot's ability to manage reviewer assignments and pings. It addresses previous shortcomings where the bot would incorrectly ping active reviews or fail to recognize reviewers assigned through GitHub's native UI. The changes ensure a more intelligent and less intrusive review process by integrating GitHub's reviewer assignment mechanisms more deeply into the bot's operational logic. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Mildly AI assisted, so feel free to point out areas where I just mis-reviewed the results. |
|
/gemini review |
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
|
Also I don't know how to / how best to test, if it is feasible. |
There was a problem hiding this comment.
Code Review
The pull request significantly improves the PR bot's ability to handle reviewer assignments and pings by integrating GitHub UI-assigned reviewers. This addresses key limitations mentioned in the PR description, ensuring that the bot's logic is more comprehensive and accurate. The changes correctly incorporate requested_reviewers into various parts of the workflow, such as excluding them from new assignments, including them in slow review pings, and considering them when determining if a committer needs to be assigned. However, there are a couple of areas that could be further refined to enhance correctness and robustness.
| ({ user: login }) => login !== pullAuthor && login !== BOT_NAME | ||
| ) | ||
| ) { | ||
| if (comment.user.login !== pullAuthor && comment.user.login !== BOT_NAME) { |
There was a problem hiding this comment.
The fix applied here correctly addresses the logic for reviewComments. However, a similar logical error exists in the preceding loop for issue.listComments (lines 75-83 in the full file). The comments.some check in that loop should be comment.user.login !== pullAuthor && comment.user.login !== BOT_NAME to correctly identify if a specific issue comment was made by a non-author/non-bot. Without this, the bot might incorrectly determine a PR is not slow.
There was a problem hiding this comment.
This comment is correct, we should apply the change above as well
| if (!labelOfReviewer) { | ||
| let isGithubReviewer = false; | ||
| if (pull.requested_reviewers && pull.requested_reviewers.some((r: any) => r.login === approver)) isGithubReviewer = true; | ||
|
|
||
| if (isGithubReviewer && pull.labels && pull.labels.length > 0) { | ||
| labelOfReviewer = pull.labels[0].name; | ||
| } |
There was a problem hiding this comment.
The logic introduced to guess a label for a GitHub-assigned reviewer by picking pull.labels[0].name might not always be accurate. If a PR has multiple labels, simply taking the first one could lead to an incorrect association between the reviewer and the PR's content area. This could result in committers being assigned to areas they are not specialized in. Consider a more robust way to infer the label, or explicitly require labels to be present for proper committer assignment.
damccorm
left a comment
There was a problem hiding this comment.
Generally LGTM - thanks for contributing!
Also I don't know how to / how best to test, if it is feasible.
Sadly, the answer is just merge the PR. You can add all of this to a fork and try it there, but it is all one-off testing. Merging and monitoring is usually much easier
| ({ user: login }) => login !== pullAuthor && login !== BOT_NAME | ||
| ) | ||
| ) { | ||
| if (comment.user.login !== pullAuthor && comment.user.login !== BOT_NAME) { |
There was a problem hiding this comment.
This comment is correct, we should apply the change above as well
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.