Repository navigation
ci: delete fork-PR runs still awaiting approval once their PR closes - #2650
Conversation
Every review comment on a fork PR starts a qodo-gate run that needs a maintainer's approval. Nobody approves the extras. On merge GitHub closes the pending pull_request runs but leaves the pull_request_review_comment ones to expire 30 days later, and it reports each expiry to the contributor as a failed run. #2463's author got six of these a month after the merge. A deleted run never expires. On pull_request_target closed, this deletes the runs awaiting approval on the closed PR's branch. A weekly sweep catches anything that event missed. Neither touches a branch that an open PR uses.
PR Summary by QodoPrune unapproved fork-PR runs after their PR closes
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
Problem
On #2463 the author asked (comment) why several workflows kept notifying them, a month after the merge, about runs that "lasted 30 days".
Every run a fork PR triggers needs a maintainer's approval. qodo-gate fires on every review and every review comment, so each review round leaves a few extra runs that nobody approves. The run that matters gets approved; on #2463 that was 35520648466, which passed. When the PR merged, GitHub closed the pending
pull_requestandpull_request_reviewruns, but it left thepull_request_review_commentones pending. Six of them stayed until 2026-10-20, when GitHub expired them ("This workflow run required approval but was not approved before it expired", 30d 0h 5m), recorded each as a failure, and sent a notification for each.Before the cleanup below, 106 runs were awaiting approval, and 82 of them belonged to PRs that were already merged or closed: #2438, #2446, #2465, #2467, #2473, #2474, #2579, #2580, #2628 and #2634. Every one would have produced the same notification.
Change
A new
stale-approvals.ymlworkflow deletes runs that are awaiting approval on a branch no open PR uses. A deleted run never expires, so it never sends a notification.pull_request_target: closedhandles the closed PR's branch. Nothing is checked out. The branch name, which the contributor controls, reaches the shell only throughenv.closedevent that was missed.workflow_dispatchdefaults to a dry run.master, a live PR can never lose its runs.ci-matrix.pylists it as a no-build workflow, with a self-test case.Evidence
lint-workflow-shell.py: all run blocks parse clean, and--self-testpasses.ci-matrix.py --self-test: ok (107 boards, 157 packages, 76 cases).ci-matrix.py --stdinon this diff:needs-build=false.Not tested
Approval policy
The fork approval policy was
all_external_contributors, which is why every review comment created a run that needed approval. On 2026-10-21 it was switched tofirst_time_contributors, so only a contributor's first PR now waits for approval. This workflow still matters for those first PRs and for the runs already queued under the old policy.