Repository navigation
ci(ai-review): move a PR back to draft after three failing rounds - #427
Conversation
| hand-off: | ||
| needs: ai-review | ||
| if: ${{ !cancelled() && needs.ai-review.outputs.hand-off == 'true' }} | ||
| uses: Kong/volcano-actions/.github/workflows/ai-review-hand-off.yml@main |
AI review: no P0-P2 findingsOpts the AI Review workflow in to the shared hand-off: ⚪ P3
Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.
Human review: needed
The AI review found no P0-P2 problems at 420412d, so the code needs no second review for bugs. Decide the points above: approve to accept them, or request changes. Any collaborator with write access other than the author can approve. |
shawnwu-kong
left a comment
There was a problem hiding this comment.
Guided review at 420412d, posted by an agent on Shawn's delegation, following the brief's recommendations. The AI review's two human-review reasons ask the same question, and it is accepted.
- Grant
contents: writeto thehand-offjob at@main(marker reasons 1 and 2) — Accept. No job with a write token checks out or runs PR code. The hand-off workflow runs only the SHA-pinned action'shandoffstep and gets no secrets (volcano-actionsai-review-hand-off.yml:25-37@ f87f40c). Probe run 43455029391 showscontents: writeis the least GitHub accepts forconvertPullRequestToDraft.@mainmatches this repo's four existing AI review references, which already have open CodeQL unpinned-tag alerts #7, #8, #11 and #12, so pinning belongs in a repo-wide change. Themainruleset keeps the token from pushing tomain. On volcano-hosting the same code moved #3275 to draft after three failing rounds, and marking it ready restarted the count.
Not checked:
- the hand-off job's first real run in this repo (it runs only after merge; the same code already moved PRs to draft on volcano-hosting);
- whether a narrower credential than
contents: write, such as a GitHub App token, could move a PR to draft.
Generated by the guided-review skill. Install it with one command:
sh -c 'd=$(mktemp -d) && gh repo clone Kong/volcano-conventions "$d" -- --depth 1 -q && make -C "$d" install-skills guided-review pr-review explain-pr; s=$?; rm -rf "$d"; exit $s'Then ask your coding agent for a guided review of a PR or issue URL. Run the command again to update.
Why
After three failing AI review rounds in a row, the AI review is supposed to move the PR back to draft, so the author re-assesses the approach instead of pushing another fix. Until now it could not. GitHub converts a PR to draft only for a
GITHUB_TOKENwithcontents: write, and the review's verdict job hascontents: read. The conversion failed with "Resource not accessible by integration", and the review kept reviewing each push. Kong/volcano-hosting#3396 hit this.A probe confirmed the permission:
contents: read+pull-requests: writeis refused (FORBIDDEN), andcontents: write+pull-requests: writeconverts the PR (run).What
Opts this repository in to the hand-off that Kong/volcano-actions#49 added, as its README's caller stub shows, and as Kong/volcano-hosting#3407 did:
ai-reviewpasseshand_off: true, so the verdict job leaves the hand-off to the new job.hand-offjob callsai-review-hand-off.yml, and only when the review'shand-offoutput is'true'. It is the only job withcontents: write(pluspull-requests: writeandstatuses: read). It never checks out the PR, and runs only the action'shandoffstep. That step acts only on a PR that is open, ready, at the reviewed head, and failing in the current set of rounds. Fork PRs never reach it, because the review skips them.Marking the PR ready for review again starts a new set of three rounds.
Verification
actionlinton the changed workflow. A PR's own review runs the base branch's stub, so the new job first runs after merge, on the next PR that fails three rounds in a row.🤖 Generated with Claude Code