-
Notifications
You must be signed in to change notification settings - Fork 38
Fix duplicate reviewer assignment in assign-reviews workflow #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The workflow was assigning reviewers to PRs that already had reviewers assigned. This happened because the prompt was not explicit enough about how to check for existing reviewers using the GitHub API. Changes: - Added explicit instructions to check both 'requested_reviewers' and 'requested_teams' arrays in the GitHub API response - Included concrete API response examples showing PRs with and without reviewers - Emphasized that PRs with any entries in either array should be skipped This ensures the agent will properly detect when a PR already has reviewers and avoid duplicate assignments. Fixes #826 Co-authored-by: openhands <[email protected]>
The previous fix only checked requested_reviewers/requested_teams arrays,
but GitHub automatically removes reviewers from these arrays when they
submit a review (COMMENTED, APPROVED, etc.). This meant the workflow could
still assign duplicate reviewers if someone had already reviewed the PR.
Now the workflow checks three conditions:
1. requested_reviewers array (pending review requests)
2. requested_teams array (pending team review requests)
3. submitted reviews via /pulls/{number}/reviews endpoint
This catches the exact case from PR #520 where @enyst reviewed on Oct 17
(removed from requested_reviewers) but @neubig was assigned on Oct 20
because the workflow only saw an empty requested_reviewers array.
Co-authored-by: openhands <[email protected]>
|
[Automatic Post]: This PR seems to be currently waiting for review. @simonrosenberg, could you please take a look when you have a chance? |
| 4. A PR needs reviewers ONLY if ALL of these are true: | ||
| - The "requested_reviewers" array is empty (no pending review requests) | ||
| - The "requested_teams" array is empty (no pending team review requests) | ||
| - The reviews array is empty (no reviews have been submitted yet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one seems a bit tricky, it's also possible to review a part of a PR and not the rest? 🤔
I'm not sure what is best:
- PRs with two reviewers
- PRs with a comment, and no more response/follow-up review
Probably two reviewers? 🤔
We can try it like this, see how it works, but idk, we might want to revisit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a little doubt, but maybe we can try this prompt and see how we like the effect! Not sure how Simon thinks about it?
|
Looks like this PR is needed: In that case, the PR
|
Summary
Fixes #826
The
assign-reviews.ymlworkflow was assigning reviewers to PRs that already had reviewers assigned, causing duplicate assignments. This happened because the prompt was not explicit enough about how to check for existing reviewers using the GitHub API.Changes
This PR updates the "Need Reviewers" section of the workflow prompt to:
GET /repos/{owner}/{repo}/pulls/{pull_number}to fetch PR detailsrequested_reviewersandrequested_teamsarraysExample
The updated prompt now includes concrete examples like:
Testing
This is a configuration change to a GitHub workflow file. The change will be validated when the workflow runs next (scheduled daily at 12 PM UTC or can be triggered manually).
Impact
This change should prevent the workflow from:
The agent will now properly identify PRs that truly have no reviewers assigned and skip those that already have reviewers.
@neubig can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
golang:1.21-bookwormeclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22Pull (multi-arch manifest)
Run
All tags pushed for this build
The
f41a0dbtag is a multi-arch manifest (amd64/arm64); your client pulls the right arch automatically.