fix(pr-review): do not restart completed reviews on delayed submitted events - #647
all-hands-bot wants to merge 1 commit into
Conversation
A pull_request_review.submitted delivery is created after the review it reports, so comparing that review's submitted_at against the selected review_requested timestamp rejected the very review the event announced. The submitted event then fell through without completing the review, so the configured maintainer handoff never ran for it. Accept the exact review a submitted delivery names (matched by id) regardless of timing, and evaluate a submitted delivery even when no review_requested issue event is in the window. A submitted review still never acts as a fresh trigger, so a later explicit review_requested event starts a new exact-head review.
|
@all-hands-bot Please update this PR description so the repository's Validate PR description check passes. Preserve the substantive problem/change/test evidence, use the required HUMAN/AGENT markers and section headings, do not claim human testing, and then verify the check is green. |
|
Done — the PR description is updated and the What the check was failing on: the PR body used What I changed in the description:
Verification: I ran the base-SHA validator locally against the new body first ( Generated by OpenHands AI on behalf of the user. |
smolpaws
left a comment
There was a problem hiding this comment.
I am an AI agent helping my human, Engel Nyst (@enyst), with repository maintenance.
Taste: good. Reviewed head 71b5028. No material correctness, security, compatibility, or acceptance-criterion findings.
Acceptance criteria for #646:
- Submitted events select the reported review by ID while retaining the bot-author and current-head checks, including when no request event is available.
- Decisive completion retains the configured maintainer handoff and no-roster behavior; non-decisive and wrong-head submissions do not dispatch work or hand off.
- Later explicit review requests can dispatch a new review, and scheduled label behavior remains covered.
- Generated automation bundle matches its source.
Validation: independently ran python -m pytest -q tests/test_github_reviewer_delivery.py tests/test_maintainer_handoff.py in a fresh test environment: 29 passed. npm run build:automations produced no tracked diff; scripts/sync_extensions.py --check passed with the existing non-blocking marketplace coverage warning. Current-head test and extension checks passed, and the later successful PR-description check supersedes its earlier failure. Tests exercise the shipped worker with mocked GitHub/dispatch boundaries; I did not perform a live deployment or webhook test.
[RISK ASSESSMENT]
[Overall PR] Risk Assessment: 🟢 LOW. This is a bounded completion-selection fix using existing identity checks and handoff behavior, with no dependency or runtime-contract changes.
Architectural insight: the submitted review's identity supplies the completion signal, while explicit review requests retain timestamp-based selection for new work.
✅ APPROVED
HUMAN:
No human has tested these changes. The checkbox below is intentionally left unchecked, and all evidence in this description comes from agent-run automated tests and generated-artifact checks. This description was written by an AI agent at the maintainer's request.
AGENT:
Why
_finish_completed_review()in the reusablegithub-pr-reviewerextension decided completion by comparing each exact-head bot review'ssubmitted_atagainst the selected trigger'screated_at. In event mode the selected trigger is the latestreview_requestedissue event, and apull_request_review.submitteddelivery is naturally created after the review it reports. The review the event announced was therefore rejected by that window and never recognized as completion, so the configured maintainer handoff did not run for it. When noreview_requestedissue event was visible at all, the run also skipped completion entirely.Summary
skills/github-pr-reviewer/scripts/worker.py:run()now extracts thereviewobject from asubmittedevent payload and passes it into the completion path. When no reviewer-request event is selected, asubmitteddelivery is still evaluated (with an empty trigger) instead of being skipped, because the submitted review is its own completion signal._review_completes_request(review, triggered_at, submitted_review)accepts the exact review asubmittedevent names (matched by reviewid) regardless of timing, so a decisive exact-head bot review is recognized whether itssubmitted_atis before or after the selectedreview_requestedtimestamp. Non-submitted runs keep the previous timestamp comparison.review_requestedevent still starts a new exact-head review. Scheduled label mode is untouched.automations/bundle-index.jsregenerated withnpm run build:automations; no manifest or fixture drift.Diff is limited to the reusable extension, its tests, and the generated bundle:
Issue Number
Closes #646
How to Test
tests/test_github_reviewer_delivery.pygained:test_reviewer_delayed_submitted_event_completes_prior_request— a review whosesubmitted_atpredates the selectedreview_requestedevent is recognized, and the configured maintainer handoff (request_maintainer_reviewwith the roster) runs once.test_reviewer_submitted_event_completes_without_request_event— a submitted review completes even when noreview_requestedissue event is visible.test_reviewer_delayed_submitted_event_without_roster_is_a_noop— the no-roster path stays a no-op.test_reviewer_subsequent_review_request_starts_new_review— a later explicitreview_requestedstill dispatches a new review.id, so they pin the id-matching path.Focused results
Full results
Video/Screenshots
Not applicable: this changes automation worker logic, not a GUI.
Notes
No live deployment or human verification was performed for this change; the behavior is covered by the unit tests above. The human-test checkbox is intentionally unchecked.
Generated by OpenHands AI on behalf of the user.