Symptom

An issue whose closing PR was landed via gh pr merge --auto --squash could stay open indefinitely after the merge actually happened, with no error surfaced — easy to mistake for “nothing to close.”

Root cause

close-issues-on-merge.yml gated the whole job on if: github.event.pull_request.merged == true, trusting the pull_request: types: [closed] webhook’s merged field at face value. gh pr merge --auto queues the squash-merge asynchronously — GitHub can deliver the closed webhook before the merge commit actually lands, with merged: false still in that snapshot. Measured 68s of lag between the closed event and the PR’s real mergedAt (krill-agents#55, observed via krill-oss#197’s copy of the same workflow). The job-level if: snapshot never re-checked, so the run silently no-oped on a PR that had, in fact, merged.

Fix

Prevention