Repository navigation
Conversation
filterReviewsToTriggerTime() and filterCommentsToTriggerTime() drop any entity whose submit/creation time is >= the trigger time, to exclude content injected at or after the trigger. But the entity that triggered the run is submitted/created exactly at the trigger time, so it was always filtered out. For a pull_request_review trigger this dropped the triggering review and all of its inline comments; a review with only inline comments and an empty body left <review_comments> empty and Claude had nothing to respond to. Retain the entity whose databaseId matches the triggering webhook payload id (new extractTriggerEntityId), bypassing both the submit/create and the edit-time checks for that one entity while leaving the >= comparison intact for every other entity, so post-trigger injection is still filtered. databaseId is compared as a string because the GraphQL id is a string while the webhook payload id is a number. Fixes anthropics#1522
TemRevil
force-pushed
the
fix/pr-review-trigger-context
branch
from
August 7, 2026 22:30
628731a to
d84cf91
Compare
Contributor
Author
|
Rebased onto main, the conflict was from #1592 touching this same file for an unrelated timestamp feature. Trigger-entity-id fix is back on top, typecheck and the data-fetcher/tag suites are green. |
Contributor
Author
|
@ashwin-ant #1526 went in on the 20th, this one has been sitting since July without a look. Still rebased and green as of the 7th, happy to redo it if it has drifted since. |
This branch has not been deployed
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.
Fixes #1522.
Problem
filterReviewsToTriggerTime()/filterCommentsToTriggerTime()drop any entity whose submit/creation time is>= triggerTime, to keep content injected at/after the trigger out of the prompt (TOCTOU protection). But the entity that is the trigger is submitted/created exactly attriggerTime, so>=always filtered it out.For a
pull_request_reviewtrigger this dropped the triggering review and all of its inline comments (they hang off the review node, which was removed). When a reviewer submits only inline comments with an empty body,<review_comments>renders "No review comments" and Claude receives nothing about the review it is supposed to respond to.The edit-time check compounds it: reviews fetch
updatedAt, which GitHub stamps at submit time, so even relaxing the submit comparison alone wouldn't be enough.Fix
Retain the entity whose
databaseIdmatches the triggering webhook payload id, exempting only that one entity from both the submit/create and edit-time checks. The>=comparison is left untouched for every other entity, so post-trigger injection is still filtered — this is deliberately narrower than relaxing>=to>, which would admit any same-second entity.extractTriggerEntityId(context)returnsreview.id/comment.idfrom the payload (mirrorsextractTriggerTimestamp).fetchGitHubDatato both filters (coverspull_request_review,pull_request_review_comment, andissue_commenttriggers).databaseIdis string-compared: the GraphQL id is astring, the webhook id is anumber.Tests
Added 4 tests to
test/data-fetcher.test.ts:updatedAtis bumped to the submit time (edit-check bypass);bun test test/data-fetcher.test.ts→ 80 pass / 0 fail.bun run typecheckclean. Only the two touched source files + the test are changed.