gemini-code-assist[bot] commented on code in PR #37663:
URL: https://github.com/apache/beam/pull/37663#discussion_r2834423736
##########
scripts/ci/pr-bot/processNewPrs.ts:
##########
@@ -195,12 +211,25 @@ async function processPull(
// TODO(https://github.com/apache/beam/issues/21417) - also check if the
author is a committer, if they are don't auto-assign a committer
for (const approver of approvers) {
- const labelOfReviewer = prState.getLabelForReviewer(approver);
+ let labelOfReviewer = prState.getLabelForReviewer(approver);
+
+ // If the approver is a GitHub assigned reviewer but not in our label
map,
+ // we can try to guess a label from the PR to assign a committer to.
+ 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;
+ }
Review 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.
##########
scripts/ci/pr-bot/findPrsNeedingAttention.ts:
##########
@@ -90,11 +90,7 @@ async function isSlowReview(pull: any): Promise<boolean> {
})
).data;
for (const comment of reviewComments) {
- if (
- comments.some(
- ({ user: login }) => login !== pullAuthor && login !== BOT_NAME
- )
- ) {
+ if (comment.user.login !== pullAuthor && comment.user.login !== BOT_NAME) {
Review 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]