Skip to content

[GreenLight] Accept the author's hardware and benchmark runs - #9130

Closed
jeanschmidt wants to merge 1 commit into
jeanschmidt/gl-perf-groundingfrom
jeanschmidt/gl-author-runs
Closed

jeanschmidt wants to merge 1 commit into
jeanschmidt/gl-perf-groundingfrom
jeanschmidt/gl-author-runs

Conversation

@jeanschmidt

@jeanschmidt jeanschmidt commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Impact: GreenLight verdicts on hardware-specific fixes and on PRs with benchmark results
Risk: medium

What

"A PR cannot certify itself" no longer covers a run no reader can repeat: a run on the hardware a change targets, or a benchmark. When the PR description states such a run and its outcome, the reviewer accepts the outcome. That never settles anything the diff or checkout can show, and never decides whether an exclusion or a "Never trivial" item applies, so numerics stay out of reach.

In the bugfix class, such a run can replace only the reading that shows the old code would have failed. It has to show a fail before the fix and a pass after, on the targeted hardware, and it never replaces the test.

Why

GreenLight cannot run anything, so a fix for a bug that only shows on particular hardware could never satisfy the bugfix class. Authors already hold merge rights, so trusting their stated run for what nobody can check from the PR matches how human review works. This came out of #9098.

Policy changes impact

Replayed with torchci.greenlight_replay on the 708 pytorch/pytorch PRs that GreenLight judged and that landed as judged (717 kept by the tool's frame, 9 failed in every run). One review per PR per policy, claude-opus-5-5[1m]. Base: #9129 (e4d78a0).

Reported case. #9098 reported pytorch/pytorch#200725 at 91b5f9e. The frame drops it, because the PR changed before landing, so it was replayed on its own at that head. It did not flip: NO_LAND under #9129, under this PR, and in every other run. As this PR intends, no stated run can clear it: it stumbles on the Never trivial numerics rule, which the reviewer applies to the flex-attention kernel config changes on sm_10x. The InductorChoices signature point also remains.

Other PRs that flipped.

Due to this change:

  • [MPS] Keep stream command-buffer state on the serial queue pytorch#197836 ([MPS] Keep stream command-buffer state on the serial queue): NO_LAND → LAND. This PR's LAND rests on the author's stated run ("the author reports it failing before on M4 Max and passing after"), the hardware-only bugfix check this PR adds. The earlier NO_LANDs doubted that the timing-dependent test could show the bug.

The other 23 flips are natural instability: the verdict flips back in a later run, goes against this change's direction, or rests on a NO_LAND reason this change does not touch.

Run LAND NO_LAND Flipped by this change Flipped by natural instability
Base: #9129 (e4d78a0) 136 (19.2%) 572 (80.8%)
With this PR (6acb088) 140 (19.8%) 568 (80.2%) 1 (NO_LAND → LAND) 23 (13 NO_LAND → LAND, 10 LAND → NO_LAND)

Notes

  • Only the PR description counts. The reviewer's inputs carry no PR-author login, so comments cannot be attributed to the author.
  • An agent-written description can claim runs that never happened. Like stack context, this relies on the author's goodwill.

Stack created with GitHub Stacks CLI • Give Feedback 💬

@jeanschmidt
jeanschmidt added this pull request to stack #9131 October 15, 2026 00:23
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
torchci Ignored Ignored Oct 30, 2026 7:26pm UTC

Request Review

@jeanschmidt
jeanschmidt marked this pull request as ready for review October 15, 2026 22:04
does not survive that check counts against the change, not for it. This reaches any
claimed fact that would clear an exclusion, and any argument that refusing costs too
much; the checkout is at PR head, so evidence the diff supplies came from the author.
This does not reach a run no reader can repeat: on the hardware a change targets, or a

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.

This is not english lol?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rewrote, and revised, I believe it looks much cleaner now

no value shared across configurations that differ. You cannot run anything: rather than
claiming a test fails before and passes after, read it and the pre-change code and
satisfy yourself the old code would not have passed. If you cannot, not the class.
satisfy yourself the old code would not have passed. If you cannot, not the class. Where

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.

If you cannot, not the class.

Huh?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated :)

@jeanschmidt
jeanschmidt force-pushed the jeanschmidt/gl-author-runs branch from 6acb088 to abb278b Compare October 17, 2026 01:22
ezyang
ezyang previously requested changes Oct 19, 2026

@ezyang ezyang 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.

**Impact:** GreenLight verdicts on hardware-specific fixes and on PRs with benchmark results
**Risk:** medium

## What
"A PR cannot certify itself" no longer covers a run no reader can repeat: a run on the hardware a change targets, or a benchmark. When the PR description states such a run and its outcome, the reviewer accepts the outcome. That never settles anything the diff or checkout can show, and never decides whether an exclusion or a "Never trivial" item applies, so numerics stay out of reach.

In the bugfix class, such a run can replace only the reading that shows the old code would have failed. It has to show a fail before the fix and a pass after, on the targeted hardware, and it never replaces the test.

## Why
GreenLight cannot run anything, so a fix for a bug that only shows on particular hardware could never satisfy the bugfix class. Authors already hold merge rights, so trusting their stated run for what nobody can check from the PR matches how human review works. This came out of #9098.

# Notes
- Only the PR description counts. The reviewer's inputs carry no PR-author login, so comments cannot be attributed to the author.
- An agent-written description can claim runs that never happened. Like stack context, this relies on the author's goodwill.
@github-actions

Copy link
Copy Markdown

GreenLight policy replay: base vs this PR

Re-reviewed 186 historical pytorch/pytorch PRs 3 times under the base policy (9a21af67fd1a, the merge base) and 3 times under this PR's policy (5a91d2236ccd), on Bedrock. Workflow run.

Summary

Base This PR
Runs with results / runs 3 / 3 3 / 3
Verdicts: LAND / NO_LAND 107 / 451 (LAND rate 19.2%, 95% CI 14.2–25.4% over 186 PRs) 105 / 453 (LAND rate 18.8%, 95% CI 13.9–25.0% over 186 PRs)
Harness failures 0 0
Missing (never reached the reviewer) 0 0
PRs unanimous LAND 32 30
PRs unanimous NO_LAND 148 146
PRs split (unstable) 6 of 186 assessable (3.2%, 95% CI 1.5–6.9%) 10 of 186 assessable (5.4%, 95% CI 2.9–9.6%)
PRs with fewer than 2 verdicts 0 0
Flip rate (run to run) 12 of 558 pairs of runs (2.2%, 95% CI 0.8–5.4% over 186 PRs) 20 of 558 pairs of runs (3.6%, 95% CI 1.7–7.3% over 186 PRs)
Majority LAND rate, comparable PRs with a majority 37 of 186 (19.9%, 95% CI 14.8–26.2%) 35 of 186 (18.8%, 95% CI 13.9–25.0%)

Flips

  • Comparable PRs (consistent input, at least 2 verdicts in both arms): 186, of which 175 stable and 5 unstable without a flip
  • Flip rate, base → this PR: 6 of 186 (3.2%, 95% CI 1.5–6.9%)
  • True flips: 0 of 186 (0.0%, 95% CI 0.0–2.0%); LAND → NO_LAND 0, NO_LAND → LAND 0
  • Non-true flips: 6 of 186 (3.2%, 95% CI 1.5–6.9%); LAND → NO_LAND 4, NO_LAND → LAND 2
  • Newly unstable (split under this PR, unanimous under base): 5
  • Newly stable (split under base, unanimous under this PR): 1

True flips

None.

Non-true flips

PR Base This PR Base reasons This PR reasons
#196481 NO_LAND · NO_LAND · NO_LAND NO_LAND · LAND · LAND not_trivial not_trivial, clean
#197632 LAND · LAND · NO_LAND NO_LAND · NO_LAND · LAND clean, not_trivial not_trivial, clean
#197655 NO_LAND · LAND · LAND NO_LAND · NO_LAND · LAND not_trivial, clean not_trivial, clean
#197675 NO_LAND · NO_LAND · NO_LAND LAND · LAND · NO_LAND not_trivial clean, not_trivial
#197703 NO_LAND · LAND · LAND NO_LAND · NO_LAND · LAND not_trivial, clean not_trivial, clean
#197705 LAND · LAND · LAND NO_LAND · NO_LAND · LAND clean not_trivial, clean
PRs unstable under this PR's policy (10)
PR This PR Base This PR reasons
#193218 NO_LAND · LAND · LAND LAND · LAND · LAND not_trivial, clean
#196481 NO_LAND · LAND · LAND NO_LAND · NO_LAND · NO_LAND not_trivial, clean
#197632 NO_LAND · NO_LAND · LAND LAND · LAND · NO_LAND not_trivial, clean
#197655 NO_LAND · NO_LAND · LAND NO_LAND · LAND · LAND not_trivial, clean
#197675 LAND · LAND · NO_LAND NO_LAND · NO_LAND · NO_LAND clean, not_trivial
#197686 LAND · LAND · NO_LAND LAND · NO_LAND · LAND clean, not_trivial
#197703 NO_LAND · NO_LAND · LAND NO_LAND · LAND · LAND not_trivial, clean
#197705 NO_LAND · NO_LAND · LAND LAND · LAND · LAND not_trivial, clean
#200002 NO_LAND · LAND · LAND NO_LAND · LAND · LAND not_trivial, clean
#201183 NO_LAND · LAND · NO_LAND NO_LAND · NO_LAND · NO_LAND not_trivial, clean
PRs unstable under the base policy (6)
PR Base This PR Base reasons
#197632 LAND · LAND · NO_LAND NO_LAND · NO_LAND · LAND clean, not_trivial
#197655 NO_LAND · LAND · LAND NO_LAND · NO_LAND · LAND not_trivial, clean
#197686 LAND · NO_LAND · LAND LAND · LAND · NO_LAND clean, not_trivial
#197692 NO_LAND · LAND · NO_LAND NO_LAND · NO_LAND · NO_LAND not_trivial, clean
#197703 NO_LAND · LAND · LAND NO_LAND · NO_LAND · LAND not_trivial, clean
#200002 NO_LAND · LAND · LAND NO_LAND · LAND · LAND not_trivial, clean
Excluded PRs (0)

None.

Reason codes

Reason Base This PR Change
not_trivial 422 421 -1
clean 107 105 -2
possible_regression 11 11 0
needs_socialization 6 8 +2
build_or_ci_risk 6 7 +1
breaking_change 3 3 0
security_risk 3 3 0
Run health
Run Arm Exit Rows LAND NO_LAND Failed Missing
greenlight-replay-base-1 Base 0 complete 186 34 152 0 0
greenlight-replay-base-2 Base 0 complete 186 37 149 0 0
greenlight-replay-base-3 Base 0 complete 186 36 150 0 0
greenlight-replay-change-1 This PR 0 complete 186 32 154 0 0
greenlight-replay-change-2 This PR 0 complete 186 36 150 0 0
greenlight-replay-change-3 This PR 0 complete 186 37 149 0 0

Harness failures by reason:

None.

How to read this
  • Sample. A seeded sample of the harness's replay frame: landed PRs whose original GreenLight verdict is recoverable, size-gate declines excluded. It is not every PR GreenLight reviewed. The PR count above is every PR seen in any run of either arm.
  • Outcomes. Each run gives each PR one outcome: LAND, NO_LAND, failed (a row with no policy verdict, reason harness:<outcome>), or — (no row: the PR never reached the reviewer, or the run produced nothing).
  • Harness failures come from the harness, never from the policy, and are left out of every verdict statistic. A row whose reason starts with harness: is one even when it carries LAND or NO_LAND.
  • Verdicts and LAND rate count every row of the arm's runs: LAND rate = LAND / (LAND + NO_LAND).
  • Inconsistent input. A PR whose recorded head SHA differs between any two of its rows, in either arm, is left out of the PR-level statistics and the comparison.
  • Per PR and arm. With at least 2 verdicts a PR is assessable: unanimous if they all agree, split (unstable) if not. Its majority is the verdict held by more than half of them; a tie has none. Unstable rate = split / assessable.
  • Flip rate (run to run) is the share of pairs of one arm's runs that disagree on a PR, pooled over its PRs: the sum of LAND × NO_LAND over the sum of n(n-1)/2, n being a PR's verdict count. It estimates the reviewer's own noise under that policy.
  • Comparable PRs are assessable in both arms. True flip: unanimous in both arms, with different verdicts. Non-true flip: not a true flip, but both majorities exist and differ. Stable: unanimous in both arms, same verdict. Anything else is unstable without a flip. Flip rate, base → this PR = (true + non-true flips) / comparable. A direction runs from the base majority to this PR's majority.
  • Newly unstable: comparable PRs split under this PR and unanimous under base. Newly stable is the reverse.
  • Majority LAND rate: comparable PRs whose majority is LAND, over the comparable PRs that have a majority in that arm.
  • Intervals. Each percentage comes with its 95% Wilson score interval (CI), whose sample size counts PRs, never runs: the runs of one PR are not independent. The LAND rate and the run-to-run flip rate pool rows and pairs of runs, so their intervals count the PRs that contribute to them, shown as "over k PRs". Such a PR's own rate lies between 0 and 1, so its variance is at most p(1-p), p being the rate, as for one yes-or-no outcome: counting each PR once gives an interval at least as wide as needed when the PRs contribute equally many rows or pairs, and close to it otherwise. Overlapping intervals do not show that the arms are the same: both arms reviewed the same PRs, and the flips compare them PR by PR.
  • Reason codes count the reason of every verdict; invalid marks a reason that is not a well-formed reason code.
  • Attribution. Each arm uses its policy commit's skill, verdict schema, hooks and greenlight-pr-review.yml prompt and settings; the CLI version and context window are the replay workflow's. Both arms ran the same harness and backend at the same time on the same PRs, so a difference between them is this PR's change plus run-to-run noise. The two flip rates have different bases and are not comparable with each other.

@albanD albanD 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.

The impact looks pretty bad?

@jeanschmidt

Copy link
Copy Markdown
Contributor Author

Closing the stack.

jeanschmidt added a commit that referenced this pull request Nov 12, 2026
…r any merge-rule approver (#9417)

🏖️ nmc:

**Impact:** GreenLight's review policy
(`.claude/skills/greenlight-review/SKILL.md`) is rewritten as one linear
decision procedure with broader, generic rules, and GreenLight
eligibility widens to every approver `merge_rules.yaml` names, on any
path. Each of the 12 open GreenLight feedback reports would get the
opposite verdict (LAND). Other PRs are expected to flip to LAND along
the way.

**Risk:** High, by design: it eases review gates. The skill goes live on
merge. The eligibility change goes live in two steps. The record job and
the `@greenlight recheck` path run `greenlight` from test-infra `main`,
so they change on merge. The scheduled scan changes only with the next
greenlight-scan Lambda release. Merge first and release right after. In
between:
- a recheck of an approver's PR outside their merge-rule paths gets a
LAND approval, which the old scan's next pass dismisses;
- PRs the old scan dispatches on a base trymerge refuses end as shadow
verdicts, and Dr. CI shows them as not completed.

Neither loops. The accepted risks are listed under Notes.

## What

### The reports this flips

| Report | PR | What GreenLight objected to | Root cause in the policy |
|---|---|---|---|
| #9098 | pytorch/pytorch#200725 | Flex-attention config pruning on
sm_10x, for a Triton miscompile. Objections: "kernel config selection"
counts as numerics; a new default config; a 5th argument to the
subclassable `InductorChoices` hook; tests miss the pruned autotune
lists | Numerics covered config tuning; "moves a default" and "a caller
outside the diff" were not limited to what users rely on; no class for a
hardware-scoped workaround; tests expected for every branch |
| #9093 | pytorch/pytorch#200126 | `HIDDEN_NAMESPACE_BEGIN` on more
`torch/headeronly` headers: a linkage change, "correct but
consequential", no class fits | The "Correct but consequential" shape;
no class for applying a pattern the checkout already uses (41 headeronly
files used the macro before); linkage treated as API |
| #9140 | pytorch/pytorch#201160 | Docs toctree move: "navigation
markup, not prose"; docs owners may weigh in | Documentation meant prose
only; "a reviewer might ask" sent taste questions to humans |
| #8885 | pytorch/pytorch#198501 | Python 3.10 to 3.11 in periodic, slow
and periodic-strict. Objections: ~30 sites; a coverage shift; job-name
history moves; "confirm it is intended" | Breadth counted sites, not
unchecked sites; "removes coverage" applied to CI that gates no merge;
job names treated as parsed output; intent questions sent to humans |
| #9291 | pytorch/pytorch#202759 | Lowered a perf floor (1.5x to 1.2x)
on non-HIP GPUs: "re-baselined test"; is 1.2x enough? | The test hard
stop covered performance thresholds; the test classes were a closed
list; the "would a reviewer ask" question |
| #9230 | pytorch/pytorch#202224 | Flaky-test fix (warm up, then
reseed): not a skip, xfail or message; first-call RNG coverage | Closed
list; the "would a reviewer ask" question |
| #9259 | pytorch/pytorch#202242 | SM-count skip that also skips some
cases that would fit; "could ask for an occupancy bound" | "Wider than
its guard"; the "would a reviewer ask" question |
| #9359 | pytorch/pytorch#203688 | One new assert in a helper under
`torch/testing/_internal/`: outside `test/`; 17 tests, only 10 run
locally | The test classes stopped at `test/`; "confirm it passes in CI"
sent to a human |
| #9358 | pytorch/pytorch#203742 | Filters cuBLAS-internal profiler
events out of an expected trace: "weakened assertion"; the filter now
applies on every CUDA version | The test hard stop covered checks of
another library's internals; closed list |
| #9329, #9335 | pytorch/pytorch#203292 | Never reviewed: the author is
named only by a path-scoped merge rule (`c10/util/**`) | Eligibility
required one rule naming the author to cover every changed file |
| #9304 | pytorch/pytorch#203025 | One-line bugfix in a JIT-wrapper
cache-key marker with no test in the diff; "confirm cross-process reuse
is intended" | The bugfix class needed a test in the diff, or a change
that leaves nothing lasting (a cache key does); the author's runs did
not count; intent questions sent to humans |

### The broad changes

| # | Change | Flips (report: PR) |
|---|---|---|
| C1 | One linear decision order; only defects send a PR to a human |
Every report needs it: it removes the "would a reviewer ask" question,
its repeat in criterion 8, and "Correct but consequential" |
| C2 | What the PR's text can tell you: reported runs are facts | #9359:
#203688, #9304: #203025, #9098: #200725 |
| C3 | Test code is one class; the only stop is weakening checks of
PyTorch's own results | #9291: #202759, #9230: #202224, #9259: #202242,
#9359: #203688, #9358: #203742 |
| C4 | Bug fixes need evidence, not a new test; platform-scoped
workarounds are included | #9304: #203025, #9098: #200725 |
| C5 | Numerics means changing the math, not choosing a kernel | #9098:
#200725 |
| C6 | The user-facing surface, defined concretely | #9098: #200725,
#9093: #200126, #8885: #198501 |
| C7 | Applying an established pattern is a class | #9093: #200126
(helps #9230, #9358, #9140, #8885) |
| C8 | Documentation includes its structure | #9140: #201160 |
| C9 | CI coverage rules bind merge-gating workflows; hiding failure is
always a stop | #8885: #198501 |
| C10 | Breadth counts unchecked sites, not sites | #8885: #198501 |
| C11 | Merge authorization names what decides what lands | None: it
names the files C12 lets more authors reach |
| C12 | Eligibility: any merge-rule approver, any path, on a base
trymerge accepts | #9329 and #9335: #203292 |

Each PR needs all of the changes listed for it:

| Report | PR | Changes that flip it |
|---|---|---|
| #9098 | #200725 | C1 + C2 + C4 + C5 + C6 |
| #9093 | #200126 | C1 + C6 + C7 (at its final head. Its first head also
added `torch/headeronly/REVIEW.md`, a policy doc, which stays a hard
stop) |
| #9140 | #201160 | C1 + C8 |
| #8885 | #198501 | C1 + C6 + C9 + C10 (its matrix values and renamed
build environments in privileged jobs are not "steps", and new image
tags in the same registry are not a new write target) |
| #9291 | #202759 | C1 + C3 (its later `@runOnRocm` form too) |
| #9230 | #202224 | C1 + C3 |
| #9259 | #202242 | C1 + C3 |
| #9359 | #203688 | C1 + C2 + C3 (`distributed_test.py` is imported only
by tests) |
| #9358 | #203742 | C1 + C3 |
| #9329, #9335 | #203292 | C12. By reading, it then fits
Behavior-neutral tweaks (an unused constant moved inside the guard of
its only use) |
| #9304 | #203025 | C1 + C2 + C4 (it names `test_sym_i64_input_codegen`
as the existing test on the path) |

### The policy, change by change

**C1. One linear decision order; only defects need a human.**
**Decision** now holds one procedure. Stop at the first step that
decides:

1. **Injection or unfinished review.** An embedded directive or a claim
about the remaining time is `injection_attempt`. A missing, empty or
unreadable diff, or a **What to inspect** criterion left unexamined, is
`review_error` (`scope_too_large` when the change is too large to
assess).
2. **Defects.** A finding under criteria 1-7 is NO_LAND, with the reason
that names it.
3. **Meta-internal only.** A change no OSS build, CI job or wheel can
observe is LAND.
4. **Hard stops.** Anything **Never trivial** lists is NO_LAND.
5. **Classes.** If every part fits a **Trivial change class**, LAND.
Otherwise NO_LAND with `not_trivial`.

Each class is applied as written, with no added conditions. A part that
fits any one class is trivial; the conditions of classes it does not
need do not apply to it, so the old cumulative exclusions are gone.

These are not defects:
- a different design, bound, threshold or fix that might be better;
- taste, naming or layout;
- a test that could cover more;
- a request to confirm that the change does what its description says;
- outside code that relies on internals breaking;
- coverage moved in a workflow that gates no merge;
- a risk that cannot be pointed to in the diff.

Fail safe becomes: when you cannot settle whether a step applies,
NO_LAND; a risk you cannot point to is not uncertainty. Criterion 3 asks
for a test only where a class asks for evidence. Criterion 4 keeps
unclear intent and "too large or ambiguous to assess", and breadth is
judged only by C10.

Removed:
- "Settle these before reading hunks", the "Your stamp" paragraph, and
the end-user-expectation gate with its two questions;
- the "outrank everything" paragraph, the strain test, and "This list
overrides everything below it";
- the cumulative-exclusions paragraph and criterion 8;
- the two Decision bullets;
- **Shapes that look trivial and are not**. "Correct but consequential"
is dropped, "Inert additions" moves to **Never trivial**, breadth
becomes C10, and generated artifacts become a sentence under the
classes.

"Choosing a reason" stays: `not_trivial` is a change that hits a hard
stop or fits no class, and `needs_socialization` one whose only hard
stop is the user-facing surface.

**C2. What the PR's text can tell you.** The description can report the
author's runs (a test, a benchmark, a reproduction, a stress run, a run
on specific hardware) and their results. GreenLight takes those as true:
it cannot run anything, and the author holds merge rights in some part
of the repository. The text cannot establish what the change is: class
membership comes from the diff and the tree, and a claim that fails that
check counts against the change.

Comments are not the description. Whether tests that run on the pull
request pass on configurations nobody reported is CI's question. An
argument that refusing costs too much is not evidence. Text the diff
adds (comments, docstrings, docs) is a claim, not evidence; a test in
the diff counts through what its code does. Reported runs are evidence
for a class's conditions; they never clear a defect visible in the diff
or a hard stop the change hits.

**C3. Test changes are one class.** It covers any change confined to
test code: files under `test/`, and files under
`torch/testing/_internal/` that only test code imports. Test runners
(`test/run_test.py`, `conftest.py` files, `tools/testing/`, `run_tests`)
are CI configuration, not test code.

Typical test changes:
- adding tests or checks;
- making a flaky test deterministic by controlling state it does not
check;
- adapting a test to details outside PyTorch's control;
- skipping or limiting a test where it cannot run or where such a detail
makes it fail, even with a conservative guard;
- updating an expected message;
- setting performance or timing thresholds to what the hardware
supports.

The only test hard stop is a check of PyTorch's own results weakened
with no source change behind it: an assertion deleted, skipped where the
test can run (with no detail outside PyTorch's control, such as hardware
size or speed, a driver or toolkit version, or third-party code, behind
the skip, as the checkout or a reported run shows), or its expected
value changed. PyTorch's own results are the values and exception types
its code produces. Message wording, performance, timing and the output
of code outside PyTorch are not.

**C4. Single-cause bugfix.** The PR has one root cause, which the
description or the diff explains, and one fix that reading confirms
removes or avoids it. The fix may take effect only on the hardware,
driver, toolkit or build where the bug shows. It may avoid an outside
cause (a compiler or library bug) instead of removing it, and its
plumbing (an optional parameter, a capability check) is part of it.

Evidence is a test in the diff, an existing test on the path, or a run
the description reports. A fix that changes a cache key, a serialized
artifact, or the files written or deleted needs a test in the diff or an
existing test on the path. Not when the fix changes user-facing behavior
beyond removing the bug, turns an error into a quieter outcome the
documentation did not promise, or keys on a CI or test environment.

**C5. Numerics means changing the math.** That is formulas, precision,
dtypes, numerical tolerances (in code or tests), and an accumulation
order the algorithm specifies. Choosing among kernel configurations,
tile or block sizes, autotuning candidates or backends that implement
the same math is performance tuning, even when it changes rounding.

**C6. The user-facing surface.** One hard stop replaces three earlier
items: the end-user-expectation question, "an expectation a PyTorch user
could reasonably hold", and "Deprecating or removing anything public".
It stops on removing, deprecating or renaming something PyTorch offers
outside code, or changing its signature, a default, a limit or its
documented behavior. It also stops on changing the shape of output
something parses.

What PyTorch offers:
- the public Python API: no underscore in the import path, or listed in
a `docs/source` autodoc entry;
- the C++ extension API: what `docs/cpp` and `docs/source/accelerator`
document, `torch/headeronly`, `torch/csrc/stable`, and libtorch's
exported symbols;
- configuration users set (config modules such as
`torch._inductor.config`, and environment variables);
- formats users save.

Parsed output is output that the repository shows something matches, or
that test-infra, the HUD and Dr. CI read. A job name is parsed only
through the workflow names `merge_rules.yaml` and
`update-viablestrict.yml` list. Everything else is internal: private
modules, internal heuristics and their defaults, extension points under
a private import path, and the linkage of header-only code.

**C7. Established patterns.** A new class: applying a construct the
checkout already uses for the same purpose, the same way, at new sites
of the same kind. Those sites are the same file or module, sibling
workflows, or the code a comment or doc says the construct is for. Lines
the diff adds do not establish a pattern. The reviewer judges
faithfulness, not the pattern's merit.

**C8. Documentation includes its structure.** This covers wording,
examples, headings, toctrees and navigation, cross-links, and page moves
that keep URLs. Not when the code may be the defect, when it adds or
changes a download or install link or command, embeds raw HTML or
script, or adds or removes an autodoc entry. `docs/source/conf.py` and
policy docs stay hard stops.

**C9. CI coverage rules bind merge-gating workflows.** A workflow gates
merges when it runs on every pull request, when
`update-viablestrict.yml`'s `requires` list names it, or when such a
workflow calls it. In other workflows, version bumps, renamed jobs and
images, and added or dropped configurations are their owners' call.

**CI and build configuration** is a class with no exclusions. Everything
that used to exclude a CI change is a hard stop, so no class can reach
it:

- **CI privilege and merge gating**, a new hard stop, covers:
- OIDC roles, `pull_request_target`, and generated workflows or their
generators;
- a step added or edited in a job that holds secrets or an OIDC role, or
in an action or reusable workflow such a job uses, or in a script such a
job runs (test code and PyTorch's own source are not such scripts;
matrix values and reusable-workflow inputs are not steps);
- a change to which bucket, registry, repository, table or branch a
workflow writes to or deletes from;
- a `uses:` outside the `pytorch` org, or a step moved out of the build
container;
  - a test job added to `pull.yml` or `trunk.yml`;
  - coverage removed in a merge-gating workflow.
- **Security**, an existing hard stop, now names secrets, tokens,
permissions, runner trust boundaries, and release or publish plumbing
(the workflows that publish wheels, conda packages, docs and release
tags).
- **Hiding CI failure**, a new hard stop, catches a test or job that
still runs and fails but no longer blocks what it blocked. Examples:
`continue-on-error`, `|| true` on a test step, a name gaining
`unstable`, a workflow dropped from `requires`, or an exit status
ignored in `run_test.py`, a `conftest.py` or `run_tests`.

**Pinned third-party code**, a new hard stop: moving a submodule or a
commit pin of third-party code (such as `ci_commit_pins/`), pointing a
requirement at a commit, branch or URL instead of a released version, or
changing a pinned version of third-party code built into or published
with PyTorch's released artifacts. None of the reports is such a bump.

**C10. Breadth counts unchecked sites.** "Edits at sites you have not
checked" replaces "Breadth disguised as simplicity". A repeated edit is
one change when every site follows one mechanical rule and every site
was checked, by reading them or by searching for what is left of the old
form. The number of sites is not a reason on its own. A change to a
definition other tests are generated from (an OpInfo's or ModuleInfo's
dtypes, devices or samples, the dtypes or devices a device-type test
template is instantiated for, a shared parametrization list) is an edit
at every test that iterates it, suites that do not run on pull requests
included: the reviewer checks that each consumer handles what the change
adds, or the description reports a run that covers them.

**C11. Merge authorization.** One item names `.github/merge_rules.yaml`,
`.github/scripts/trymerge.py`, `.github/scripts/tryrebase.py`,
`.github/scripts/greenlight_*.py`, the modules those scripts import, and
anything else deciding who or what may approve or land a PR. It absorbs
the separate land-time-guard item.

**Re-landing a reverted change**, a new hard stop: the PR, or a commit
it applies again, was reverted from main, and the description does not
say what broke and what in the diff fixes it (which the reviewer
confirms by reading the diff).

**Test gates are traced.** Under criterion 1 (Correctness), for every
class: the reviewer traces what a skip, expected failure or other gate
does with its condition's value, on the platforms it names and on the
others, reading the gate's own implementation where the checkout has it
(for `unittest` or `pytest` gates, the condition's own type settles it).
A gate whose effect differs from what its condition says (wider,
narrower, or a no-op, as with a decorator that acts only on a real
`bool` handed a lazily evaluated object) is a finding.

These last three come from replaying the policy against historical
GreenLight PRs that were later reverted. An OpInfo dtype widening broke
a slow-only suite (pytorch/pytorch#198860). A version of a test-gating
change handed a lazily evaluated value to a skip decorator that only
acts on a real `bool`, so the skip did nothing (pytorch/pytorch#198689).
And the reviewer should not stamp re-lands blind. None of the 12 reports
above is affected.

**Also in the skill:**
- The opening says the author "holds merge rights in some part of the
repository".
- Only three hard stops apply on the path alone: executable docs build
configuration, pytorch's `.claude/` and `.agents/` trees and instruction
files, and merge authorization. Every other hard stop is decided by what
the change does.
- **Meta-internal only** covers code and build files only (never
documentation or instruction files), and never a file one of those three
path items names.
- pytorch's AI-assistant instruction files (`CLAUDE.md`,
`CLAUDE.local.md`, `AGENTS.md`, `.cursorrules`,
`.github/copilot-instructions.md`) join the `.claude/` hard stop, and so
does the `.agents/` tree, where pytorch's skills live.
- Established patterns: a defect at a new site is still a defect.
- The examples drop the "Socialization" topic.
- Unchanged: Type annotations, the mechanical-formatting paragraph,
Output Contract fields and reasons, Message format rules, Time budget,
and the rest of Security.

### C12. Eligibility (greenlight code)

A PR is eligible when a valid rule in pytorch/pytorch's
`.github/merge_rules.yaml` names its author in exact case, and trymerge
accepts its base (`main`, a ghstack PR, or a PR in a GitHub-native stack
on `main`), whatever files it changes. The review decides whether it
needs a human.

- `cohort.assess_rules` no longer reads files. A rule whose patterns
trymerge rejects still qualifies nobody (`MergeRule.valid`).
- The scan applies trymerge's base test from the listing's own fields,
with no extra GitHub request. `authority.Authority` becomes a pure
lookup.
- Dropped on purpose, along with the files read:
  - its failure, rate-limit and undetermined paths;
- the head deferral for a push that raced the files read, and the
deferred `--pr` recheck that came with it;
- the reasons "file listing unavailable" and "no single merge rule
naming this login covers all changed files".
- The `--pr` gate checks the author and the base on the PR it already
fetches.
- At record time, `verdict.has_eligible_author` (renamed from
`has_covering_rule`) makes one fresh read. The verdict is authoritative
only when the head is still the reviewed head, the base is accepted and
a valid rule names the author. Catch-all authors get the head and base
check too.
- A PR over 200 files is now dispatched and gets the workflow's canned
`scope_too_large` NO_LAND.
- `TRUSTED_AUTHORS.md`, `STATUS_LABELS.md`, `README.md`, `CLAUDE.md`,
`CHEATSHEET.md`, the CLI help, the workflows' comments and
`tools/torchci/greenlight_decisions/README.md` are updated.

## Why

The 12 open GreenLight feedback reports are all trivial-in-spirit PRs
that GreenLight sent to a human, or never reviewed. The policy had three
parallel decision procedures: the two triviality questions that "outrank
everything", criterion 8, which repeated them, and the Decision bullets.
Fixing one left the others refusing.

Its rules were also built from per-case exceptions, and the open
follow-up stack (#9127-#9130, #9295-#9298) continues that style: one
kind added to one class per case. By its own replays that stack still
leaves #9098, #9093, #9140 and #8885 refused, and it does not touch
#9359, #9358, #9304 or #9329/#9335.

This PR replaces that with broad rules a person can read, each simple
and linear: no rule carves an exception out of another. Easing gates is
the point. Flipping other PRs to LAND along the way is expected, and the
areas where a mistake is costly stay hard stops: security, CI privilege,
merge authorization, publishing, the reviewer's own instructions, and
hiding CI failure.

Judged by reading the policy against each report; no evals or replays
were run for this.

# Notes

- **Supersedes** #9127, #9128, #9130, #9295, #9296, #9297 and #9298.
Their generic parts are folded in: #9128's API definition, #9130's
reported runs, and #9298's defects-only idea, generalized. #9129
(performance grounding) is not needed for these flips and is left as is.
- **Follow-ups once the greenlight-scan release is live**:
- Dr. CI's GreenLight line
(`torchci/lib/greenlight/greenlightEligibility.ts`, a port of
`assess_rules`) still renders "can't be reviewed due to
`merge_rules.yaml` restrictions" for PRs outside an approver's paths. It
is left unchanged here because the HUD deploys on every push to `main`
and would advertise reviews before the scan runs them.
- Dr. CI's port also shows "waiting for review" for an approver named by
a catch-all rule on any base, so once the release is live a PR on a base
trymerge refuses would show that until the port learns the base test.
- pytorch/pytorch `CONTRIBUTING.md` ("## GreenLight") describes the old
eligibility rule.
- **Accepted risks, stated as what is no longer checked**:
- About 80 logins named only by path-scoped merge rules can now land
anywhere on a LAND: GreenLight's approval satisfies the `*` Greenlight
Review Bot rule. The hard stops still send security, CI privilege, merge
authorization, publishing and release plumbing to a human.
- The reviewed base is not bound at land time for any approver: the
"base not bound" exposure in `TRUSTED_AUTHORS.md` now covers every
approver. Binding the reviewed merge base belongs in pytorch's land-time
guard and is a separate change.
- Kernel-configuration changes, private extension points and header-only
linkage changes land without a human (C5, C6).
- Coverage can drop silently in workflows that gate no merge,
label-triggered ones included (C9).
- Runs the description reports are taken as true (C2), and
platform-scoped fixes often have no pre-merge CI on that platform (C4).
- A pattern with a flaw can be copied to new sites of the same kind
(C7).
  - Dropped conditions:
- C3 drops "production code rejects the skipped case" and "no wider than
its guard";
    - C4 drops "no value shared across configurations that differ";
    - C1 drops the cumulative class exclusions;
    - criterion 4 drops "sprawl across many subsystems";
- #9127's job-name rules and #9296's "still runs on full-size devices"
are not carried over.
- A catch-all author's PR on a base trymerge refuses has GreenLight's
approval dismissed. If it is later retargeted to `main`, it is not
re-reviewed until its fingerprint changes. A retarget between the scan
and the record can leave a review shown as not completed.
- **Pushes run the policy replay**: later pushes to this branch run
`greenlight-policy-replay.yml`, because it touches the skill.

This branch was previously deployed

1 inactive deployment
bedrock — 5a91d223 Deployed Oct 30, 2026 by jeanschmidt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants