Skip to content

[pr-review] Raise the automated review's changed-file cap from 100 to 300 - #203217

Closed
atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:atalman/pr-review-max-files-300
Closed

atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:atalman/pr-review-max-files-300

Conversation

@atalman

@atalman atalman commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Raise MAX_CHANGED_FILES in hardened-pr-review-run.yml from 100 to 300.

PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as skipped_too_large even though their diffs are small. For example, #203051 changes 161 files with a 106 KB diff.

  • MAX_DIFF_BYTES is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before.
  • MAX_CHANGED_FILES is one workflow-level env read by both prepare and review, so the early gate and the real-diff gate move together.
  • No test pins the number: scripts/pr_review/test_workflow_contract.py only requires a single numeric workflow-level value (its "100" at line 831 is a stub input to a unit test).

Tested: python3 -m unittest scripts.pr_review.test_workflow_contract — 183 tests, OK.

Created with Claude

… 300

PRs that touch many files with small per-file edits (lint autofixes, renames,
version-pin bumps) were skipped as skipped_too_large even though their diffs
are small: e.g. a 161-file PR with a 106 KB diff. Raise MAX_CHANGED_FILES to
300.

MAX_DIFF_BYTES stays at 400000, so a large diff is still skipped regardless of
file count and the context/cost bound on a single review is unchanged. The cap
is a single workflow-level env read by both `prepare` and `review`, so both
gates move together.
@atalman
atalman requested a review from a team as a code owner November 3, 2026 13:33
@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Nov 3, 2026
@pytorch-bot

pytorch-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

✅ AUTOMATED REVIEW - Ready for human review:

The PR raises MAX_CHANGED_FILES from 100 to 300. That works mechanically, but
stage A's provisional 35-minute and 60-turn limits don't grow with file count,
and the PR gives no data showing they hold. Recommendation: Needs Discussion.
Timing data or a time-budget mechanism should come before the cap is tripled.

Findings (1):

[minor] .github/workflows/hardened-pr-review-run.yml:80
Stage A's 35-minute limit was not revisited, and there is no time budget to let
a long review wind down cleanly. The claim that the cost bound is unchanged
covers only the diff (MAX_DIFF_BYTES). It does not cover per-file work:
REVIEW.md mapping for each file, the four-reviewer fan-out over every changed
line (:855), and sub-agent reads, all on stage A's clock. A 300-file PR under
400 KB can cost much more than a 100-file one. Stage A's timeout-minutes: 35
(:837) and --max-turns 60 (:877) were set provisionally (:546-548). The 35
minutes can't simply be raised, because it shares the 3600s session (:770) with
stage B's 20 minutes (:909). On a timeout, steps.a fails and arev is skipped
(:892), so a paid-for run is recorded as model_error. time-budget.sh is wired
only into claude-code.yml, and stage A has no hooks and no Time budget section,
so it can't post a marked partial result. A partial review can also be recorded
as ready_for_human_review (:984-985). Fix with any one of: stage A durations
from a run over 100 files (e.g. # 203051), wiring the time-budget hook and
prompt section into stage A, or raising the cap in a smaller step.

Reviewed commit: 9e20417

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203217

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 9e20417 with merge base 4fb332d (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Socialization
    • Moves a limit: MAX_CHANGED_FILES goes from 100 to 300, tripling the file-count cap on automated review
    • More PRs now reach the paid review job, a cost and coverage decision the review's owners should see
  • Trust boundary
    • hardened-pr-review-run.yml is a privileged workflow_run job with id-token: write and secrets.GITHUB_TOKEN
    • The cap gates which PRs that privileged pipeline processes, at the checks near lines 350 and 755
  • Correctness
    • The one-line edit is consistent: MAX_DIFF_BYTES stays at 400000 and both gates read the same env value

reason: needs_socialization
Reviewed commit: 9e20417

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Nov 3, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 3, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review of 9e20417: nothing blocking; ready for human review.

The PR raises MAX_CHANGED_FILES from 100 to 300. That works mechanically, but stage A's provisional 35-minute and 60-turn limits don't grow with file count, and the PR gives no data showing they hold. Recommendation: Needs Discussion. Timing data or a time-budget mechanism should come before the cap is tripled.

⚪ 1 non-blocking finding

Stage A's 35-minute limit was not revisited, and there is no time budget to let a long review wind down cleanly. The claim that the cost bound is unchanged covers only the diff (MAX_DIFF_BYTES). It does not cover per-file work: REVIEW.md mapping for each file, the four-reviewer fan-out over every changed line (:855), and sub-agent reads, all on stage A's clock. A 300-file PR under 400 KB can cost much more than a 100-file one. Stage A's timeout-minutes: 35 (:837) and --max-turns 60 (:877) were set provisionally (:546-548). The 35 minutes can't simply be raised, because it shares the 3600s session (:770) with stage B's 20 minutes (:909). On a timeout, steps.a fails and arev is skipped (:892), so a paid-for run is recorded as model_error. time-budget.sh is wired only into claude-code.yml, and stage A has no hooks and no Time budget section, so it can't post a marked partial result. A partial review can also be recorded as ready_for_human_review (:984-985). Fix with any one of: stage A durations from a run over 100 files (e.g. # 203051), wiring the time-budget hook and prompt section into stage A, or raising the cap in a smaller step.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

@pytorch-bot pytorch-bot Bot added ready for review Automated review passed, ready for a final review by a maintainer. and removed in progress PR is being worked on by the author, until the automated review accepts it labels Nov 3, 2026

@huydhn huydhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@atalman

atalman commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge -f "lets merge, looks good"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Nov 5, 2026
…ew (#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 (#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.

- 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 (#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: #203136
Approved by: https://github.com/huydhn
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
… 300 (pytorch#203217)

Raise `MAX_CHANGED_FILES` in `hardened-pr-review-run.yml` from 100 to 300.

PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as `skipped_too_large` even though their diffs are small. For example, pytorch#203051 changes 161 files with a 106 KB diff.

- `MAX_DIFF_BYTES` is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before.
- `MAX_CHANGED_FILES` is one workflow-level env read by both `prepare` and `review`, so the early gate and the real-diff gate move together.
- No test pins the number: `scripts/pr_review/test_workflow_contract.py` only requires a single numeric workflow-level value (its `"100"` at line 831 is a stub input to a unit test).

Tested: `python3 -m unittest scripts.pr_review.test_workflow_contract` — 183 tests, OK.

Created with Claude

Pull Request resolved: pytorch#203217
Approved by: https://github.com/huydhn
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…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
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
… 300 (pytorch#203217)

Raise `MAX_CHANGED_FILES` in `hardened-pr-review-run.yml` from 100 to 300.

PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as `skipped_too_large` even though their diffs are small. For example, pytorch#203051 changes 161 files with a 106 KB diff.

- `MAX_DIFF_BYTES` is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before.
- `MAX_CHANGED_FILES` is one workflow-level env read by both `prepare` and `review`, so the early gate and the real-diff gate move together.
- No test pins the number: `scripts/pr_review/test_workflow_contract.py` only requires a single numeric workflow-level value (its `"100"` at line 831 is a stub input to a unit test).

Tested: `python3 -m unittest scripts.pr_review.test_workflow_contract` — 183 tests, OK.

Created with Claude

Pull Request resolved: pytorch#203217
Approved by: https://github.com/huydhn
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GL/human GreenLight marked as needing human review Merged ready for review Automated review passed, ready for a final review by a maintainer. topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants