Repository navigation
ci: skip the AI review after maintainer activity and add /ai commands - #4679
Conversation
…mmands - A push runs the AI review only while no maintainer (OWNER, MEMBER, or COLLABORATOR, not a bot and not the PR author) has commented on or reviewed the PR. The triage still runs on every push. - Maintainers can comment `/ai review` (or `/ai`) for a new full review of the current commit, and `/ai triage` to run the triage again. The bot confirms a command with a reaction. Commands from other users are ignored. - A new `context` job resolves the PR and the mode from the pull_request_target or issue_comment event, so the other jobs no longer read the event payload. Other comments get their own concurrency group and do not cancel a running triage. Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
|
✅ DCO Check Passed Thanks @dolfim-ibm, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit This PR reduces AI review costs by skipping the automatic review after a maintainer gets involved. It also adds Topic labels added: CI safety: needs maintainer care before you approve CI.
1 related pull request(s) in the same code
The |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The AI review ran on every push, also on PRs that a maintainer already reviews. That costs money and adds noise. This PR stops the automatic review after a maintainer is involved, and gives maintainers
/aicommands instead.Automatic review only before maintainer activity
Before each push-triggered review, the job reads the issue comments, the reviews, and the review comments of the PR. The review is skipped if one of them comes from a maintainer:
OWNER,MEMBER, orCOLLABORATOR, not a bot, not the PR author, and not an/aicommand. The triage still runs on every push, because it is cheap and keeps the CI-safety label current./aicommandsA PR comment from a maintainer that starts with one of these commands:
/ai review(or/ai): a new, full review of the current commit. It ignores the maintainer check, the "already reviewed" check, and the duplicate gate. The size limits still apply./ai triage: runs the triage again.The bot adds a 👀 reaction to confirm the command. Comments from other users and other text are ignored. Only an exact command on the first line counts.
Workflow changes
issue_comment(created). A cheapif:on the newcontextjob skips all other comments without running the script.contextjob runsai_pr_event.py. It validates the event again and sets the outputspr,run, andforce_review. The other jobs use these outputs and no longer readgithub.event.pull_request, which does not exist for comment events./aicomments share the group of the PR. Any other comment gets its own group, so it cannot cancel a running triage.Checklist:
.github/CI_LABELS.md)Review evidence:
uv run pytest tests/test_ai_pr_event.py tests/test_ai_pr_review.py tests/test_ai_pr_triage.py tests/test_groundtruth_diff.py tests/test_pr_topic_labels.py tests/test_pr_approval_reminder.py: 42 passed. The new tests cover command parsing, maintainer and open-PR checks for commands, drafts and bots on pushes, and the maintainer-activity filter (bots, the PR author, command comments).make validate: passed. Both folded YAML expressions parse to one line.issue_commentpath on GitHub. It runs frommain, so the first/ai reviewcomment after the merge tests it.