Skip to content

Conversation

@BakerNet
Copy link
Collaborator

@BakerNet BakerNet commented Jul 3, 2025

Summary / Background

The review comment isn't being updated when all PRs are satisfied, but it ought to. To avoid extra noise, if there is no existing comment, still skip.

@pooyaw
Copy link

pooyaw commented Jul 3, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @BakerNet, 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 refines the behavior of the review status comment system. The primary goal is to ensure that the comment accurately reflects the current review status, including when all required approvals have been met, by allowing existing comments to be updated. Concurrently, it prevents the creation of new, redundant comments when a pull request already satisfies all review requirements and no prior comment exists.

Highlights

  • Review Comment Updates: The logic within addReviewStatusComment has been adjusted to ensure that the review status comment is updated even when all required code owner reviews have been satisfied. Previously, the function would skip processing if no unapproved owners remained, preventing updates to an 'all approved' state.
  • Preventing Redundant New Comments: A new condition was added to prevent the creation of a new review status comment if all required code owner reviews are already satisfied and no existing comment is found. This avoids unnecessary 'all approved' comments from being posted when they are not needed.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and 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 to provide feedback.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot requested a review from zbedforrest July 3, 2025 20:07
@github-actions
Copy link

github-actions bot commented Jul 3, 2025

Codeowners approval required for this PR:

@BakerNet BakerNet merged commit a960855 into main Jul 3, 2025
9 of 11 checks passed
@BakerNet BakerNet deleted the fix/update-comment-on-all-approved branch July 3, 2025 20:08
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The code changes aim to update the review comment even when all PRs are satisfied. However, there are potential correctness issues where the updated comment content is incorrect when all approvals are met, and a misleading debug log message. Also, the logic to add a comment when all approvals are met and no existing comment is found is missing.

Comment on lines +297 to 300
if a.config.Quiet {
a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n")
return nil
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The removal of the len(allRequiredOwners) == 0 check means this function now executes even when all required reviewers have approved. However, the subsequent logic for generating the comment does not handle this case correctly, potentially leading to misleading comments. The debug message is also misleading now, as the function no longer skips if there are no unapproved owners.

return fmt.Errorf("UpdateComment Error: %v", err)
}
} else {
} else if len(allRequiredOwners) > 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The condition len(allRequiredOwners) > 0 is now checked in an else if block. This means that if existingFound is false (i.e., no existing comment was found) and len(allRequiredOwners) is also 0 (i.e., all required owners have approved), no comment will be added. This contradicts the PR description, which states that the review comment should be updated even when all PRs are satisfied.


if a.config.Quiet || len(allRequiredOwners) == 0 {
if a.config.Quiet {
a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The log message is now misleading after the logic change. The function no longer skips if there are no unapproved owners. The message should be updated to reflect that it only skips when quiet mode is enabled.

Suggested change
a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n")
a.printDebug("Skipping review status comment (disabled).\n")

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants