[DevOps] Add missing comment triggers to Needs: Attention policy#2079
[DevOps] Add missing comment triggers to Needs: Attention policy#2079
Conversation
Add Issue_Comment payload type and remove issueAuthor filter so that ALL comments on a PR — inline review comments, formal reviews, and conversation comments from any user — trigger the Needs: Attention label. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the GitOps PR feedback policy so the Needs: Attention 👋 label is applied for more kinds of PR feedback events, including general PR conversation comments.
Changes:
- Adds
Issue_Comment(action: Created) as an additional trigger for the feedback workflow. - Removes the
isActivitySender: issueAuthor: Falseconstraint so the PR author’s own comments can also trigger the workflow.
| - and: | ||
| - payloadType: Issue_Comment | ||
| - isAction: | ||
| action: Created |
There was a problem hiding this comment.
Adding payloadType: Issue_Comment here makes author comments like #needs-review match this policy too. That conflicts with .github/policies/pulls-04-respond.yml (which uses #needs-review to remove Needs: Attention 👋 and re-add Needs: Review 👀): the #needs-review comment will now also trigger this policy and can immediately re-add Needs: Attention 👋, making #needs-review ineffective. Exclude #needs-review from this policy (or split tasks so Issue_Comment labeling doesn’t run for that command) to avoid the label ping-pong.
| action: Created | |
| action: Created | |
| - not: | |
| commentContains: | |
| pattern: '#needs-review' |
| - and: | ||
| - payloadType: Issue_Comment | ||
| - isAction: | ||
| action: Created |
There was a problem hiding this comment.
With Issue_Comment triggering this task and an unconditional addReply in the then, the bot’s own reply comment is likely an Issue_Comment (action: Created) and can re-trigger this same policy, potentially creating a self-reply loop (and repeated label/assignment churn). Add a guard to ignore comments authored by the policy bot (or restructure into separate tasks so addReply is not executed for Issue_Comment events).
MSBrett
left a comment
There was a problem hiding this comment.
Review summary
CI is green and the intent of the change is solid, but the diff introduces a label-thrash race condition with .github/policies/pulls-04-respond.yml and regresses the non-author guard on two existing triggers. One small consolidated fix resolves both issues. There is also a design intent question worth confirming before merge — see "Design clarification" below.
Race condition / regression details
In .github/policies/pulls-03-feedback.yml (PR head):
-
The new
Issue_Comment / Createdtrigger has noisActivitySenderconstraint. It therefore fires when the PR author comments.pulls-04-respond.ymlalready handles authorIssue_Commentactivity by removingNeeds: Attention 👋and restoringNeeds: Review 👀. Both policies will run on the same author event with opposing outcomes — classic label thrash, with the final state depending on undefined ordering. -
The diff also removes
isActivitySender: issueAuthor: Falsefrom the existingPull_Request_Review_Comment / CreatedandPull_Request_Review / Commentedtriggers. Those guards are present today ondevand are intentional — they prevent author self-comments from firing the "give the author feedback" path. Removing them is a regression independent of the new trigger.
Pull_Request_Review / Changes_requested correctly remains unconstrained — GitHub does not allow PR authors to request changes on their own PR, so the guard would be redundant there.
Suggested fix
Apply the suggestion below to restore the guards on the two regressed triggers and add a matching guard to the new Issue_Comment trigger.
- and:
- payloadType: Pull_Request_Review_Comment
- isAction:
action: Created
- isActivitySender:
issueAuthor: False
- and:
- payloadType: Pull_Request_Review
- isReviewState:
reviewState: Changes_requested
- and:
- payloadType: Pull_Request_Review
- isReviewState:
reviewState: Commented
- isActivitySender:
issueAuthor: False
- and:
- payloadType: Issue_Comment
- isAction:
action: Created
- isActivitySender:
issueAuthor: False
After this change:
- Reviewer comments / reviews on a PR →
pulls-03-feedbackaddsNeeds: Attention 👋(intended). - Author comments on their own PR → only
pulls-04-respondruns, removingNeeds: Attention 👋and restoringNeeds: Review 👀(no thrash).
Design clarification
The PR description says the goal is to make author self-comments also trigger Needs: Attention 👋. The fix above intentionally does not do that, because:
pulls-03-feedback.ymlis described as "When a PR gets feedback" — semantically the reviewer side.pulls-04-respond.ymlalready owns the author-comment side and clearsNeeds: Attention.- Allowing both to fire on the same event is the source of the race.
If the intent really is "author comments should add Needs: Attention," that is a design conflict with pulls-04-respond.yml that needs to be resolved at the policy level (probably by changing pulls-04 rather than removing guards in pulls-03). Could you confirm which behavior you want?
CI / metadata
- All 6 checks passing (CodeQL ×3, GitOps/Branches, GitOps/YmlSchemaValidation, license/cla).
mergeable: MERGEABLE,mergeStateStatus: BLOCKEDonly because review is required.- Targets
dev✓. Labels appropriate. Checklist complete. Minor: PR body is missing aFixes #<issue>link, not blocking.
|
@@flanakin: you have some new feedback! Please review and resolve all comments and I'll let reviewers know by removing the |
🛠️ Description
Updates the
pulls-03-feedbackGitOps policy to triggerNeeds: Attention 👋on ALL comment types, not just review comments and change requests.Changes:
Issue_Commentpayload type to catch general PR conversation commentsissueAuthor: Falsefilter so comments from any user (including the PR author) trigger the labelPreviously, regular conversation comments on a PR and author self-comments (e.g., inline notes to hold a PR) would not trigger the label.
📋 Checklist
🔬 How did you test this change?
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md?📖 Did you update documentation?
🤖 Generated with Claude Code