Repository navigation
[pr-review] Tell the author when a PR is too large for automated review - #203136
izaitsevfb wants to merge 4 commits into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (5): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203136
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 2fe8088 with merge base 2501aef ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
✴️ iz2: Re the automated review's non-blocking findings on 7967924. Taken in 2ffc4aa: a notice is no longer picked as the latest automated review in Not changed, deliberately:
|
|
✴️ iz2: Re the round-2 non-blocking findings on 2ffc4aa. Not changed, to keep this PR minimal:
|
|
✴️ iz2: Re the round-3 non-blocking findings on 5417007. None of them is a defect in this change, so to keep the PR minimal I'm leaving these for the human reviewer: naming the limit that tripped, renaming |
|
✴️ iz2: Requesting one more automated review of 5417007 with the round-3 replies above in view; no code change since. |
|
✴️ iz2: Re the final automated review on 5417007. I'm not making code changes for it, and this PR now waits for human review.
|
✴️ iz2: Dismissing the automated review at Ivan's request: Huy approved, and the remaining findings were answered in-thread.
|
✴️ iz2: Merging at Ivan's request. |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
|
✴️ iz2: Re-merging at Ivan's request; Dr.CI now classifies the lint failure as not related. |
A PR over the size gate (100 changed files or 400 KB of diff) was skipped with only an S3 telemetry row and a collapsed Dr.CI line, so authors read it as the review being broken. Post a COMMENT review instead that says why, suggests splitting the PR, and gives the pytorchbot command to opt out. The bot never applies the opt-out label itself.
Skip reposting only when the newest automated review is this exact notice. A notice marked in progress by `announce` on the diff-size path gets its body back instead of a new notice on every run, and a notice put back defused is replaced. fetch_pr_comments no longer treats a notice as the latest verdict. The limit sentence says "or".
A failed write-back left the marked notice for --restore-pending, which put it back with the command defused. Post a fresh notice instead. Test the guard that keeps a marked verdict from being overwritten, and state that a change request stays after an opt-out until a maintainer dismisses it.
5707942 to
2fe8088
Compare
|
✴️ iz2: Re the automated review on 2fe8088: the new findings are answered in their threads with no code change (doc wording and test hardening, none a behaviour bug); the rest repeat findings answered earlier. Requesting a re-review to read the replies. |
|
✴️ iz2: Re the automated review of 2fe8088 (round 8): every blocking finding repeats one already answered in its thread; replies to the three new non-blocking ones are below. No code change.
|
There was a problem hiding this comment.
Automated review of 2fe8088: nothing blocking; ready for human review.
When a PR is over the size gate, the automated review now posts a COMMENT notice (from announce --too-large or from publish on a skipped_too_large row) that explains the limit and gives the opt-out command, and fetch_pr_comments.py skips that notice when picking the latest verdict. Recommendation: Approve. Every blocking finding from earlier rounds is fixed or answered, and the points that remain are non-blocking hardening.
⚪ 5 non-blocking findings
Non-blocking. The model can be handed an "Outdated" verdict as the latest review. When a notice replaces a COMMENT verdict, replace_earlier hide_earlier take_down folds that verdict with the default SUPERSEDED reason ("Outdated automated review of <sha>; a newer one replaces it"). collect then picks that folded verdict as latest and passes its body through unchanged (:351), so the next review's model sees a body whose "newer one" is the notice that was filtered out. Before this PR, the latest verdict was never folded. Fix options: use a fold reason specific to the notice, unwrap folded bodies in collect, or at least note this next to TOO_LARGE_TAG. This is separate from the round-8 reply about losing unreplied inline findings.
An earlier comment near this line has replies: #203136 (comment)
pytorch/scripts/pr_review/post_review.py
Line 1220 in 2fe8088
Non-blocking. decline(gh, pr, sha, author, opt_out, limits) takes author and opt_out in the opposite order from run(gh, row, pr, sha, opt_out, author, limits). Both are plain str and are passed positionally from run() and main(). Both call sites are correct today and tests pin them, but a future swap would fail quietly: opted_out would check for a label named after the bot login, too_large_body would fall back to the default label, and earlier_reviews would find no reviews. Fix: make the arguments after sha keyword-only (*, author, opt_out, limits) and add type hints like its neighbours notice_stands and too_large_body have.
pytorch/scripts/pr_review/post_review.py
Line 1241 in 2fe8088
Non-blocking. decline never calls backfill(...), which run() calls after every verdict it posts (:1295). Older hidden reviews that were never folded or emptied stay that way until the next verdict run. If this is so the notice fits inside announce's 5-minute timeout, say so in decline's docstring.
An earlier comment near this line has replies: #203136 (comment)
pytorch/scripts/pr_review/post_review.py
Line 1241 in 2fe8088
Non-blocking. No test reaches the branch where the id is not an int. FakeGitHub's POST /reviews always returns "id": 999 (test_post_review.py:137-159). Removing the isinstance guard leaves every test green. In production, hide_earlier would then raise KeyError on new\["id"\]. That is not a GitHubError, so decline's except misses it, and main's catch-all warns "automated review not posted" even though the notice was posted.
An earlier comment near this line has replies: #203136 (comment)
pytorch/scripts/pr_review/post_review.py
Line 1203 in 2fe8088
Non-blocking. No notice test uses a CRLF body; the only CRLF test checks a marked verdict. Deleting .replace("rn", "n") leaves every test green. An unmarked CRLF notice (for example, one edited in the web UI) would then be reposted once and the old one hidden. Add a case with NOTICE.replace("n", "rn") as the newest review.
An earlier comment near this line has replies: #203136 (comment)
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
Withdrawn: the automated review of 2fe8088 found nothing blocking.
|
✴️ iz2: Merging at Ivan's request after the second rebase; CI on 2fe8088 is green and the head merges cleanly into main. |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…ew (pytorch#203136) ✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (pytorch#203051: 162 files, skipped under the earlier 100-file cap that pytorch#203217 raised to 300). The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (`@pytorchbot label "no automated review"`). The bot never applies the label itself; that stays the author's call. - File-count path (decided in `prepare`): `announce` posts the notice with a new `post_review.py --too-large` mode. It already has the right token: `pull-requests: write`, no AWS, no environment, no PR code. - Diff-bytes path (decided in `review`): `publish` posts the same notice from the `skipped_too_large` row. - The notice hides earlier automated reviews like any new review. It dismisses no standing change request, since the large PR was not evaluated; after an opt-out that request stays until a maintainer dismisses it. It is not reposted while the newest visible review is the same notice; one marked in progress gets its body back. `fetch_pr_comments.py` never treats a notice as the latest verdict, so re-review interdiffs (pytorch#202667) also start from the last verdict's commit. - The command sits mid-line in a code span. pytorch-bot only runs commands that start a line (`cliParser.ts`), and the label text is validated, so the notice cannot trigger the bot. Test plan: `python3 -m unittest discover -s scripts/pr_review -t .` passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring. Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure. Pull Request resolved: pytorch#203136 Approved by: https://github.com/huydhn
…DING) (#9332) ✴️ iz2: opened for @izaitsevfb, who asked for this change. trymerge fails a merge on the first check that sees a failed job, even when an AI CI Advisor verdict that would clear the job is minutes away. On pytorch/pytorch#203136 the merge failed at 11:55am PST and the `not_related` verdict landed by 12:03pm PST. trymerge's live Dr.CI call already dispatches the advisor; it just can't tell "verdict coming" from "no verdict". This adds an `AI_PENDING` key to Dr.CI's answer: failures still blocking whose latest advisor dispatch was made after the run finished, within the last 20 minutes, and has no verdict yet. Only failures a verdict could clear count (a conclusive `failure`, not a PR-state gate), and only while `DRCI_ADVISOR_SUPPRESSION_ENABLED` is on. - The jobs stay in FAILED/UNKNOWN, and the comment does not change. - The key is left out of the check-run summary, a snapshot that can lag the live answer. - A failed verdict or dispatch-state read, or any error, yields no key, which is today's behavior. - A failed dispatch, even one auto-dispatch may retry, and a dispatch made before the run finished don't count. Whether a retry or re-dispatch happens is decided by guards elsewhere, and a wrong "pending" costs a merge a pointless wait. - The 20-minute bound comes from 14 days of dispatches: 99.9% of answered ones were answered within 15 minutes, and 31 of 34 left in `dispatching` were never answered. Known limit: verdicts are read per PR and dispatch states per head, so two open PRs sharing a head could see a pending dispatch the other PR already got an answer for. In the last 30 days, 0 of 3,652 dispatched heads belonged to more than one PR, and the cost is a bounded wait. pytorch/pytorch#203462 makes trymerge wait on these jobs for up to 15 minutes each. Nothing reads the key until that lands. No ClickHouse query is added or changed. Test plan: new jest cases for `isAwaitingVerdict` / `awaitingVerdictJobIds` and the summary filter. Mutating the eligibility, live-dispatch, after-run, age, answered and null-read checks, or the summary filter, each fails a test. torchci gates pass: prettier, next lint, tsc, jest. Not covered: an end-to-end test through `updateDrciComments`, which has no test harness.
…ew (pytorch#203136) ✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (pytorch#203051: 162 files, skipped under the earlier 100-file cap that pytorch#203217 raised to 300). The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (`@pytorchbot label "no automated review"`). The bot never applies the label itself; that stays the author's call. - File-count path (decided in `prepare`): `announce` posts the notice with a new `post_review.py --too-large` mode. It already has the right token: `pull-requests: write`, no AWS, no environment, no PR code. - Diff-bytes path (decided in `review`): `publish` posts the same notice from the `skipped_too_large` row. - The notice hides earlier automated reviews like any new review. It dismisses no standing change request, since the large PR was not evaluated; after an opt-out that request stays until a maintainer dismisses it. It is not reposted while the newest visible review is the same notice; one marked in progress gets its body back. `fetch_pr_comments.py` never treats a notice as the latest verdict, so re-review interdiffs (pytorch#202667) also start from the last verdict's commit. - The command sits mid-line in a code span. pytorch-bot only runs commands that start a line (`cliParser.ts`), and the label text is validated, so the notice cannot trigger the bot. Test plan: `python3 -m unittest discover -s scripts/pr_review -t .` passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring. Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure. Pull Request resolved: pytorch#203136 Approved by: https://github.com/huydhn
…till on the way (#203462) ✴️ iz2: opened for @izaitsevfb, who asked for this change. A merge fails on the first loop iteration that sees a failed job outside Dr.CI's ignorable categories, even when Dr.CI is about to classify it: - #202436 failed 41 s after its macOS job did. Dr.CI's live answer didn't list the job in any category yet, and Dr.CI later classed it as flaky. - #203136 failed while the AI CI Advisor verdict that later cleared the job was still running. With this change, `merge()` counts a failed GitHub Actions job as pending, for up to 15 minutes per job, while either: - Dr.CI's live answer lists the job in no category (Dr.CI reads jobs from a database that lags GitHub), or - Dr.CI lists it under `AI_PENDING` (pytorch/test-infra#9332): a verdict that may clear it is on the way. As soon as the job is classified, or after 15 minutes, it is handled as today. Waiting clears nothing; only Dr.CI's existing categories do. Check names in the merge record are unchanged. For the PR being merged, and for a stacked PR's mandatory checks, the retry and reject messages say a job is waiting on its classification, and a failure message says when the merge waited on a job that still blocks it. A stacked PR's other failed or pending jobs keep today's messages. Scope: - Only plain `FAILURE` conclusions of GitHub Actions jobs. App check runs such as EasyCLA never wait. - Only a non-empty live Dr.CI answer starts a wait. The check-run summary fallback never does. An empty answer doesn't either, because Dr.CI also answers `{}` for a repo it has no data for. Once open, a wait survives a failed or empty Dr.CI call until its 15 minutes run out. - Only `merge()`, including the lower PRs of ghstack and native stacks. Other callers of `get_classifications` / `find_matching_merge_rule` pass no window and skip the wait logic entirely. - `merge_into` now runs a ghstack stack's lower-PR rule checks before the GreenLight check, as it already did for native stacks. Whether a lower PR's human approvals suffice without GreenLight's can depend on its CI, and that answer is cached for the merge, so it is asked only once the PR's own checks pass; a waiting job retries first. Lower ghstack PRs are now checked against the clone's rules file before it is reset to trunk, as the top PR already was. Cost: a merge whose failure is real reports later if Dr.CI hasn't listed the job or its verdict comes back `related`: at most about 20 minutes, since the 15-minute budget is checked on 5-minute retries. Usually that is one or two retries, since the advisor's p95 is 6 minutes from dispatch. Known limits: - The unlisted check matches Dr.CI's answer by job id. When trymerge holds a different run's id for a job than Dr.CI lists (a newer run dropped the job, or an older run's entry overwrote the newer one), that failure, which blocks today, reports 15 minutes late. Test plan: `python -m unittest test_trymerge`, with new `TestClassificationWait` tests: the matchers (including a malformed `AI_PENDING` list and checks that are not Actions jobs), precedence over arrived classifications and `-i`, the real `find_matching_merge_rule` with a waiting and an expired mandatory job, a wait surviving a failed Dr.CI call, one window shared by a stack, and `merge()` (on a clock its sleeps advance) looping until the job is classified or the budget runs out, with the failure note only for jobs it slept on, plus a test that a waiting lower ghstack PR retries before the GreenLight check is asked. Removing any window hand-off, wait condition, waiting reason or expiry note fails a test. The full suite passes (274 tests). Pull Request resolved: #203462 Approved by: https://github.com/jeanschmidt, https://github.com/huydhn
✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (#203051: 162 files, skipped under the earlier 100-file cap that #203217 raised to 300).
The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (
@pytorchbot label "no automated review"). The bot never applies the label itself; that stays the author's call.prepare):announceposts the notice with a newpost_review.py --too-largemode. It already has the right token:pull-requests: write, no AWS, no environment, no PR code.review):publishposts the same notice from theskipped_too_largerow.fetch_pr_comments.pynever treats a notice as the latest verdict, so re-review interdiffs ([pr-review] Give re-reviews the interdiff since the last automated review #202667) also start from the last verdict's commit.cliParser.ts), and the label text is validated, so the notice cannot trigger the bot.Test plan:
python3 -m unittest discover -s scripts/pr_review -t .passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring.Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure.