Key the prgate comment marker on the reason alone - #2
Open
zzzeek wants to merge 1 commit into
Open
Conversation
The hidden marker the gate leaves on a pull request was "<!-- prgate:<reason>:<sha> -->", carrying the head sha, so _already_commented() only suppressed a repeat when the reason *and* the commit both matched. The gate runs on opened/reopened, which means a contributor who is closed, pushes a commit and reopens gets a second copy of the same rejection. The sha isn't part of the decision: the gate reads the pull request title and body and the state of the issue they name, never the code, so a new head commit cannot change the outcome without also changing the reason, which is in the marker already. Drop it. The pull request number doesn't need to be in the marker either, since the comments are fetched per pull request to begin with. Matching is done against the unterminated "<!-- prgate:<reason>" prefix so that comments already posted in the old format are still recognized and don't draw a duplicate on their next reopen.
CaselIT
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on CaselIT's review of eed2480.
The hidden marker the gate leaves on a pull request was
<!-- prgate:<reason>:<sha> -->, carrying the head sha, so_already_commented()only suppressed a repeat when the reason and the commit both matched. Thenumberargument passed alongside it is only the API scope forget_issue_comments(), not part of the marker — so within a PR the dedup identity was(reason, sha).The gate runs on opened/reopened, so a plain push to a closed pull request doesn't re-comment. But a contributor who is closed, pushes a commit and reopens gets a second copy of the same rejection.
The sha isn't part of the decision: the gate reads the pull request title and body and the state of the issue they name, never the code, so a new head commit cannot change the outcome without also changing the reason — and the reason is in the marker already. This drops it. The pull request number doesn't need to be in the marker either, since the comments are fetched per pull request to begin with.
Matching is done against the unterminated
<!-- prgate:<reason>prefix so that comments already posted in the old format are still recognized and don't draw a duplicate on their next reopen. No close reason is a prefix of another, so that stays unambiguous.One consequence worth naming: the comment is now strictly once-per-reason-per-pull-request forever. A pull request closed for
issue_unlabeled, reopened, and closed again a month later for the same reason gets no second explanation. The close itself still happens every time.