Repository navigation
[CI] Add shadow PR self-review gate - #7003
Conversation
Drop the redundant static-check workflow and the fixture-only interface. Simplify the readiness evaluator, fix section boundaries and self-matching debug detection, and document the actual Copilot reply policy. Signed-off-by: zufayu <[email protected]>
Bound sticky-comment output, cover all PR file pages, treat draft PRs as not ready, and avoid duplicate comment and status writes. Restrict review events to main-targeting PRs and document the draft requirement. Signed-off-by: zufayu <[email protected]>
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
|
@aiter-bot review |
ROCm/aiter PR #7003 — [CI] Add shadow PR self-review gateAdds a shadow-mode "PR Self-Review" GitHub Actions gate that reads PR metadata over the GitHub API and reports, in one sticky bot comment plus an always-success commit status, whether the author's self-review answers, Copilot findings, code/op-test hygiene and the four required CI checks are ready for human review. Review (advisory): 🔴 HIGH RISK 🔴 [verified] |
Grant check-run read access and degrade CI API failures, safely render untrusted paths, refresh fork PRs by head identity, add deterministic regression coverage, and restore structured performance evidence in the PR template. Signed-off-by: zufayu <[email protected]>
Run the selftest explicitly with Python and remove the non-executable shebang flagged by the repository Ruff check. Signed-off-by: zufayu <[email protected]>
* [CI] Add shadow PR self-review gate * [CI] Fix PR self-review lint findings * [CI] Read PR checks from head commit * [CI] Lead self-review comment with readiness * [CI] Split self-review prompt from readiness report * [CI] Refresh self-review on review activity * [CI] Hide shadow audit metrics from PR comments * [CI] Show accepted self-review answers in report * [CI] Remove PR self-review unit test fixture * [CI] Replace self-review unit tests with static checks * [CI] Avoid blocking on unavailable Copilot review * [CI] Remove self-review rollout leftovers Drop the redundant static-check workflow and the fixture-only interface. Simplify the readiness evaluator, fix section boundaries and self-matching debug detection, and document the actual Copilot reply policy. Signed-off-by: zufayu <[email protected]> * [CI] Harden self-review gate edge cases Bound sticky-comment output, cover all PR file pages, treat draft PRs as not ready, and avoid duplicate comment and status writes. Restrict review events to main-targeting PRs and document the draft requirement. Signed-off-by: zufayu <[email protected]> * [CI] Address self-review security findings Grant check-run read access and degrade CI API failures, safely render untrusted paths, refresh fork PRs by head identity, add deterministic regression coverage, and restore structured performance evidence in the PR template. Signed-off-by: zufayu <[email protected]> * [CI] Fix self-review selftest executable lint Run the selftest explicitly with Python and remove the non-executable shebang flagged by the repository Ruff check. Signed-off-by: zufayu <[email protected]> * [CI] Isolate self-review refresh signals * [CI] Restore PR review context * [CI] Drop template regression assertion --------- Signed-off-by: zufayu <[email protected]>
* [CI] Add shadow PR self-review gate * [CI] Fix PR self-review lint findings * [CI] Read PR checks from head commit * [CI] Lead self-review comment with readiness * [CI] Split self-review prompt from readiness report * [CI] Refresh self-review on review activity * [CI] Hide shadow audit metrics from PR comments * [CI] Show accepted self-review answers in report * [CI] Remove PR self-review unit test fixture * [CI] Replace self-review unit tests with static checks * [CI] Avoid blocking on unavailable Copilot review * [CI] Remove self-review rollout leftovers Drop the redundant static-check workflow and the fixture-only interface. Simplify the readiness evaluator, fix section boundaries and self-matching debug detection, and document the actual Copilot reply policy. Signed-off-by: zufayu <[email protected]> * [CI] Harden self-review gate edge cases Bound sticky-comment output, cover all PR file pages, treat draft PRs as not ready, and avoid duplicate comment and status writes. Restrict review events to main-targeting PRs and document the draft requirement. Signed-off-by: zufayu <[email protected]> * [CI] Address self-review security findings Grant check-run read access and degrade CI API failures, safely render untrusted paths, refresh fork PRs by head identity, add deterministic regression coverage, and restore structured performance evidence in the PR template. Signed-off-by: zufayu <[email protected]> * [CI] Fix self-review selftest executable lint Run the selftest explicitly with Python and remove the non-executable shebang flagged by the repository Ruff check. Signed-off-by: zufayu <[email protected]> * [CI] Isolate self-review refresh signals * [CI] Restore PR review context * [CI] Drop template regression assertion --------- Signed-off-by: zufayu <[email protected]>
Summary
Adds a zero-token, shadow-mode PR Self-Review gate before human review. It asks the author to explain the current revision, reports active Copilot findings and code/op-test hygiene, and aggregates Black, Ruff, Repository Dependency, and Aiter Test Gate status.
The existing
aiter-review-bot.yml,.claude/skills/review-pr/, box308, and the@aiter-botreview flow are untouched.Motivation
PR authors need to demonstrate that they understand the current revision, have addressed automated review findings, have removed obvious artifacts or redundant op tests, and have baseline CI ready before consuming maintainer review time.
Changes
Performance (if applicable)
N/A — this PR changes GitHub metadata automation and contributor documentation only; it does not change runtime or kernel behavior.
Testing
Documentation
Dependencies
Breaking Changes
None. The gate defaults to advisory shadow mode and does not alter existing review-bot or runtime behavior.
PR Self-Review
Reviewed revision
4fa3b4a
Behavior and intent
This adds an independent GitHub-hosted metadata gate that reports whether a PR is prepared for human review. Shadow mode always leaves its commit status successful while exposing the author-answer, Copilot, hygiene, and required-CI blockers that would fail in enforce mode. The goal is to measure real author behavior, including generic or AI-generated answers, before making the gate required.
Validation and unverified scope
Ran the committed
pr_self_review_selftest.pysuite: 11 deterministic tests cover answer boundaries, Copilot replies, CI failure/unavailability, Draft readiness, untrusted path rendering, 3,000-file pagination, bounded output, sticky-comment ownership and idempotent status writes. Python byte-compilation, Black 26.3.0, full Ruff 0.16.0, Vulture, Actionlint 1.7.12 andgit diff --checkpass. Five real fork PRs confirmed thatworkflow_run.pull_requestsis empty; the new owner/branch/SHA resolver returned the exact PR for #5887, #7005 and #7014. Read-only evaluation also succeeded on PR #7003 and 12 additional open PRs. Actual bot-authored comments, workflow-run refreshes and status writes remain unverified until the trusted workflow lands onmain, so rollout stays in shadow mode.PR-specific question
The privileged workflow checks out only the trusted default branch and never checks out or executes the PR head. Untrusted PR title, body, filenames, patches and review comments are consumed only as GitHub API data by standard-library Python; rendered filenames use bounded dynamic code spans. Permissions are limited to Checks read, repository contents read, PR metadata read, issue comments write and commit statuses write. A missing Checks response degrades to
unavailableand keeps the PR not ready instead of terminating the report. Fork workflow runs resolve the open main-targeting PR from the payload's head owner, branch and SHA without executing fork code.Changed op tests
None. This PR does not add or modify any
op_tests/file.Test plan
python .github/scripts/pr_self_review_selftest.pypython -m py_compile .github/scripts/pr_self_review.py .github/scripts/pr_self_review_selftest.pygit diff --checkRollout
AITER_PR_SELF_REVIEW_MODEunset, which defaults toshadow.enforceonly after calibration.