Skip to content

Proposal: relax PR merge rules, enforce them via CI - #5512

Merged
kolyshkin merged 2 commits into
opencontainers:mainfrom
kolyshkin:review-policy
Oct 15, 2026
Merged

kolyshkin merged 2 commits into
opencontainers:mainfrom
kolyshkin:review-policy

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

This is a proposal. Maintainers, please share your opinion (or LGTM, if you agree).

Problem

We have quite a few maintainers, but most of us are busy with other things, so
reviews are scarce. As a result, many pull requests stay open for weeks or
months waiting for two LGTMs, which slows down the development a lot
(or requires a lot of pinging).

Proposal

Relax the merge rules (see the MAINTAINERS_GUIDE.md change for exact wording).
A pull request can be merged once it has:

  • two LGTMs from maintainers (as now); or
  • one LGTM, if it is a routine change: opened by Dependabot, or only
    changing documentation and/or CI configuration; or
  • one LGTM from another maintainer, if the author is a maintainer and the
    pull request has been open for review (not a draft) for at least 7 days
    (14 days if it changes more than 100 lines, not counting vendor/),
    giving other maintainers a chance to review and object.

Governance changes (MAINTAINERS, top-level *.md files other than
README.md and CHANGELOG.md, and the review-policy workflow) always
require two LGTMs.

In all cases, a maintainer requesting changes blocks the merge.

The guide also clarifies a few things which are current practice but are not
written down: an LGTM is a PR approval, and the author's own LGTM is not counted.

Enforcement

GitHub can't require a different number of approvals depending on who the
author is, or what files are changed. So the second commit adds a
review-policy check which evaluates the above rules.

Update: following the concerns about pull_request_target, the check was
rewritten to be as unprivileged as possible. It is now a single
pull_request_review workflow with a read-only token (contents: read,
pull-requests: read), which evaluates the current state of the PR via the
GitHub API, and passes or fails accordingly. No pull_request_target, no
workflow_run, no schedule, no write permissions, no secrets, no checkout.

Using pull_request_review as the only trigger is deliberate. I tested it on
my fork, and found that branch protection requires the latest run for each
event type
to pass, so if the check also ran on pull_request, a failed run
from a push (say, "needs an LGTM") would keep blocking the merge even after a
review fixes it. The consequences are:

  • after pushing to a PR, the check is missing (so the PR can't be merged)
    until a review is submitted; a comment-only review is fine, and the author
    can submit it, too (e.g. "rebased");
  • if the check fails because of a review period, it needs to be re-run
    manually once the period is over.

The price for being unprivileged is that, like any pull_request_review
workflow, the check runs from the PR itself, so a PR can modify it. To
mitigate, the workflow is a governance file (so changing it requires two
LGTMs), and GitHub's own required approval stays as a backstop.

A nice side effect is that only approvals from current MAINTAINERS are
counted. Currently GitHub also counts approvals from anyone with write access,
which includes a few emeritus maintainers (being fixed in
opencontainers/tob#160).

After merging

A repo admin needs to update the main branch protection:

  1. Add review-policy (from GitHub Actions) as a required status check.
  2. Lower the required number of approvals from 2 to 1.

Once the check is required, open PRs won't have it until someone reviews
them (a comment-only review is enough).

Note that since enforce_admins is currently disabled, and all maintainers
are repo admins, any of us can still merge bypassing the rules. Whether to
change that is a separate discussion.

cc @mrunalp @cyphar @AkihiroSuda @thaJeztah @lifubang @rata

Comment thread MAINTAINERS_GUIDE.md Outdated
* one LGTM from a maintainer, if it is a routine change; or
* one LGTM from another maintainer, if the author is a maintainer, the pull
request is not a governance change, and it has been open for review (that
is, not a draft) for at least 7 days. This gives other maintainers a chance

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A large PR (e.g., > 100 lines) should require a longer period?

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.

What do you have in mind? A month?

Also, a maintainer can submit require changes and just ask for more time.

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.

I looked at the sizes of last 50 PRs (both opened and merged), to check lines added + removed, excluding vendor/, here's what I got:

Lines (except vendor/) Last 50 merged PRs Last 50 open PRs
≤ 20 33 7
21–100 12 18
101–300 4 15
> 300 1 10
median 11 ~100

So small PRs get merged, and it's the large ones that get stuck. That's exactly where a longer review period makes sense. So your threshold of 100 lines affects only 10% of what we merge, but half of what's waiting, and it seems right to me.

I've added this: a maintainer's PR with one LGTM can be merged after 14 days instead of 7 if it has more than 100 lines changed (not counting vendor/).

NOTE tests are counted. Let me know if you think they shouldn't be.

@rata

rata commented Oct 5, 2026

Copy link
Copy Markdown
Member

I agree with the idea. It's EOD here now, I'd like my AI friend to take a closer look tomorrow.

A nice side effect is that only approvals from current MAINTAINERS are
counted. Currently GitHub also counts approvals from anyone with write access,
which includes a few emeritus maintainers.

Let's remove their access. Nothing good can come out of that, right? We can always give access to people that need it. But I guess we need to ask some LF people to do that?

@kolyshkin

Copy link
Copy Markdown
Contributor Author

I agree with the idea. It's EOD here now, I'd like my AI friend to take a closer look tomorrow.

A nice side effect is that only approvals from current MAINTAINERS are
counted. Currently GitHub also counts approvals from anyone with write access,
which includes a few emeritus maintainers.

Let's remove their access. Nothing good can come out of that, right? We can always give access to people that need it. But I guess we need to ask some LF people to do that?

Yes, one needs to be an org admin to do that. I can only file a bug in the org: opencontainers/tob#160

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left a few minor comments. Thanks a lot for proposing this and automating it!

Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@rata thanks for the detailed review -- I think I've addressed all the comments, PTAL.

@opencontainers/runc-maintainers PTAL, this is an important process change.

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

I'd add a few more comments to make sure all the precautions to keep this safe (never run from the PR branch, etc.) are not lifted by mistake

Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
Comment thread .github/workflows/review-policy.yml Resolved
@thaJeztah

Copy link
Copy Markdown
Member

In general, I'm in favor of relaxing the approval requirements (as enforced by branch protection rules). I think it's reasonable to enforce a single approval, and leave it to the maintainers' discretion to decide if additional reviews are needed.

Someone who was given maintainer status was given that status based on trust, which (IMO) includes the trust to decide whether a change has risk, and because of that requires more eyes (which can be a review of a specific person / domain expert, or more review than enforced). At times, I wish GitHub reviews were not a "binary" approval; there's been many pull requests (across projects) where I'm not a domain expert, and my review / approval may be "best judgement". GitHub doesn't really have mechanisms to communicate that, beyond writing it in words ("LGTM" with some explanation 😂).

Requiring two (or "majority") approvals for governance or policy changes makes sense.

I'm not sure if the LOC and waiting period complexity is needed; in my experience, a single-line change can be just as risky (or riskier) than a large change; they sometimes are more risky because they may appear innocuous, so get merged without verifying the impact 😂

That said; I wouldn't mind some "nag" automation to ping maintainers for a (second) review. My notification inbox tends to fill up pretty fast, so "review requested" PRs may end up at page 2 or 3 of my notifications within a day.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

I'm not sure if the LOC and waiting period complexity is needed; in my experience, a single-line change can be just as risky (or riskier) than a large change; they sometimes are more risky because they may appear innocuous, so get merged without verifying the impact 😂

So this is not about the risk but about the complexity of doing a review. We assume that changes with smaller LOC require less maintainer's time to be reviewed, and big PRs with more LOC changed call for more review time. While this is not always the case, usually it is. So we (rather arbitrarily) divide all PRs into two categories, big and small, and set the rule that big PRs need more time to review than the small ones. It's not perfect but there is no way to have it perfect (in a perfect world you wake up and all your PRs from yesterday are reviewed by all other maintainers).

The other thing is, small PRs gets merged and larger ones gets stuck (see some statistics at #5512 (comment)). The two-week "deadline" is here to help with that.

I wouldn't mind some "nag" automation to ping maintainers for a (second) review.

I use @thaJeztah PTAL for that, occasionally adding a 🙏🏻, so I don't need any automation here. In fact I'd rather be against it, as I have too much emails in my inbox already. But I might be wrong and we can implement some nagging and pinging later as a followup.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

@lifubang @cyphar WDYT? This is an important change, I don't want to push it without you having a look.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

@thaJeztah also, if you agree with this in principle, please LGTM (we can address pinging and nagging in a followup)

@lifubang lifubang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM
I totally agree. My apologies, I just returned from a long holiday and have fallen behind on a lot of work. I will make time to catch up. Besides, another factor affecting reviews is that PRs are getting bigger and harder to review. We really need an AI assistant to make reviews manageable.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

We really need an AI assistant to make reviews manageable.

We have copilot here but I don't like it much. I will look for alternatives.

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@cyphar

cyphar commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

We really need an AI assistant to make reviews manageable.

We have copilot here but I don't like it much. I will look for alternatives.

My experience with using Opus and Fable for reviews (and seeing how systemd has done with their new Claude-powered review system) is that they do tend to find annoying mistakes quite well but I don't think they are any good at making higher-level decisions or catching non-obvious flaws. Yeah, people say you can write skills to improve their behaviour but I still find them severely lacking and still review the code (meaning the workload hasn't really gone down as much).

By the way, we can all get access to the open source maintainer programs from OpenAI and Anthropic.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

We have 5 out of 7 LGTMs from maintainers (me included), so I'm going to merge this tomorrow. If there are any changes or additions needed, we can always address those in followup PRs.

@cyphar cyphar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure that encoding this as a CI job is really that necessary and pull_request_target gives me the willies, but on the whole I'm fine with this.

@kolyshkin has been doing a lot of work recently and a few maintainers (myself included) being very busy for the past year isn't really a great reason to excessively slow down that work.

@cyphar

cyphar commented Oct 14, 2026

Copy link
Copy Markdown
Member

But yeah to be honest my GitHub notifications are basically unmanageable at this stage -- I would probably need to spend a week doing nothing but reviews to clear everything and I unfortunately can't carve out that much time. I feel quite awful about being such an absentee maintainer recently...

It would be really nice if there was a way to tag a PR as "important" when pinging so I could just look at those with the little time I have but no such luck on GitHub. :/

@lifubang

Copy link
Copy Markdown
Member

It would be really nice if there was a way to tag a PR as "important" when pinging so I could just look at those with the little time I have but no such luck on GitHub. :/

+1

@thaJeztah

Copy link
Copy Markdown
Member

I'm not sure that encoding this as a CI job is really that necessary and pull_request_target gives me the willies

Agreed on this part. @kolyshkin - wondering if we should/could keep the CI scope more minimal? Could we use (e.g.) a needs-second-review label, and for that to block/unblock CI? (thinking out loud here if there's options to make it less privileged).

But yeah to be honest my GitHub notifications are basically unmanageable at this stage -- I would probably need to spend a week doing nothing but reviews to clear everything and I unfortunately can't carve out that much time. I feel quite awful about being such an absentee maintainer recently...

+1 I unfortunately also get a ton of "code-owner" review requests (internal policies requiring them); many of which don't actually need my attention (but still make my notifications run at the speed of light).

It would be really nice if there was a way to tag a PR as "important" when pinging so I could just look at those with the little time I have but no such luck on GitHub. :/

Perhaps labels (or custom properties) could help for this 🤔 also might be worth looking if GitHub has thoughts on improvements in this area 🤔

Many pull requests stay open for weeks waiting for a second review,
which slows down development considerably.

Spell out the merge rules, and relax them for maintainers: a pull
request authored by a maintainer can be merged with a single LGTM
from another maintainer, provided it has been open for review for at
least 7 days (14 days for large changes, i.e. more than 100 lines not
counting vendor/), so that other maintainers had a chance to object.

Also, allow routine pull requests (opened by Dependabot, or only
changing documentation and/or CI configuration) to be merged with a
single LGTM.

Neither of the above applies to governance changes, i.e. changes to
the project rules (such as this document) or their enforcement, which
always require two LGTMs.

While at it, clarify that:
 - an LGTM is a pull request approval;
 - the author's own LGTM does not count;
 - a maintainer requesting changes blocks the merge.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin

kolyshkin commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@cyphar @thaJeztah Reworked the check per your concerns. It now fails a CI job.

Upside is pull_request_target, workflow_run, statuses: write are no more.

Downside is is requires more from maintainers. First, once the review period is over, if it's still one LGTM, a maintainer who wants to merge the PR need to re-run it. Second, the check's own code is run from a PR, so any PR can change its code (that's the price for being unpriviledged).

Hope it addresses all concerns. Will merge tomorrow.

Add a check enforcing the pull request merge rules from
MAINTAINERS_GUIDE.md, to be used as a required status check (in
addition to the GitHub's required number of approvals, which can not
depend on who the author is, and also counts approvals from anyone
having write access, not just from current maintainers).

The check is a pull_request_review workflow with a read-only token,
which evaluates the current state of the pull request using the GitHub
API. No other triggers are used, since branch protection requires the
latest run for each event type to pass, so a failed run triggered by,
say, a push would keep blocking the merge after a review fixes it.

As a result, the check needs a review (a comment-only one is fine) to
be run after a push, and it needs to be re-run manually once a review
period is over.

Note that since the workflow runs from the pull request, a pull request
can change it. This is the price for not using privileged triggers
(pull_request_target or workflow_run) and write permissions. To
mitigate, the workflow is a governance file (so changing it requires
two LGTMs), and GitHub's own required approval stays as a backstop.

Signed-off-by: Kir Kolyshkin <[email protected]>

@kolyshkin kolyshkin left a comment

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.

The added review-policy check is triggered by any review comment. Three ways to add a review comment:

  • Submit a review (Comment / Approve / Request changes);
  • Comment on a specific line(s) of code;
  • Reply to a comment on a specific line(s) of code.

@kolyshkin
kolyshkin merged commit d501604 into opencontainers:main Oct 15, 2026
93 checks passed
@kolyshkin

Copy link
Copy Markdown
Contributor Author

A repo admin needs to update the main branch protection:

  1. Add review-policy (from GitHub Actions) as a required status check.
  2. Lower the required number of approvals from 2 to 1.

Done, and tested on #5553 that it works as expected.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Also checked in #5547, see #5547 (comment)

@kolyshkin

Copy link
Copy Markdown
Contributor Author

well the biggest downside of read-only approach is we always have red CI (unless we have two LGTMs), so it's indistinguishable from real CI failures when looking at the list of PRs.

kolyshkin added a commit to kolyshkin/oc-cgroups that referenced this pull request Oct 23, 2026
Add a check enforcing the pull request merge rules from
MAINTAINERS_GUIDE.md, to be used as a required status check (in
addition to the GitHub's required number of approvals, which can not
depend on who the author is, and also counts approvals from anyone
having write access, not just from current maintainers).

The check is a pull_request_review workflow with a read-only token,
which evaluates the current state of the pull request using the GitHub
API. No other triggers are used, since branch protection requires the
latest run for each event type to pass, so a failed run triggered by,
say, a push would keep blocking the merge after a review fixes it.

As a result, the check needs a review (a comment-only one is fine) to
be run after a push, and it needs to be re-run manually once a review
period is over.

Note that since the workflow runs from the pull request, a pull request
can change it. This is the price for not using privileged triggers
(pull_request_target or workflow_run) and write permissions. To
mitigate, the workflow is a governance file (so changing it requires
two LGTMs), and GitHub's own required approval stays as a backstop.

The check itself is the runc one (see opencontainers/runc#5512), used
as a reusable workflow (made so in opencontainers/runc#5573), pinned to
a commit. Dependabot is told not to bump it, since a bump may change the
rules, so it should be a deliberate (and governance) change.

Signed-off-by: Kir Kolyshkin <[email protected]>
kolyshkin added a commit to kolyshkin/oc-cgroups that referenced this pull request Nov 3, 2026
Many pull requests stay open for weeks waiting for a second review,
which slows down development considerably.

Spell out the merge rules, and relax them for maintainers: a pull
request authored by a maintainer can be merged with a single LGTM
from another maintainer, provided it has been open for review for at
least 7 days (14 days for large changes, i.e. more than 100 lines),
so that other maintainers had a chance to object.

Also, allow routine pull requests (opened by Dependabot, or only
changing documentation and/or CI configuration) to be merged with a
single LGTM.

Neither of the above applies to governance changes, i.e. changes to
the project rules (such as this document) or their enforcement, which
always require two LGTMs.

While at it, clarify that:
 - an LGTM is a pull request approval;
 - a maintainer requesting changes blocks the merge.

This is the same as done in runc (see opencontainers/runc#5512).

Signed-off-by: Kir Kolyshkin <[email protected]>
kolyshkin added a commit to kolyshkin/oc-cgroups that referenced this pull request Nov 3, 2026
Add a check enforcing the pull request merge rules from
MAINTAINERS_GUIDE.md, to be used as a required status check (in
addition to the GitHub's required number of approvals, which can not
depend on who the author is, and also counts approvals from anyone
having write access, not just from current maintainers).

The check is a pull_request_review workflow with a read-only token,
which evaluates the current state of the pull request using the GitHub
API. No other triggers are used, since branch protection requires the
latest run for each event type to pass, so a failed run triggered by,
say, a push would keep blocking the merge after a review fixes it.

As a result, the check needs a review (a comment-only one is fine) to
be run after a push, and it needs to be re-run manually once a review
period is over.

Note that since the workflow runs from the pull request, a pull request
can change it. This is the price for not using privileged triggers
(pull_request_target or workflow_run) and write permissions. To
mitigate, the workflow is a governance file (so changing it requires
two LGTMs), and GitHub's own required approval stays as a backstop.

The check itself is the runc one (see opencontainers/runc#5512), used
as a reusable workflow (made so in opencontainers/runc#5573), pinned to
a commit. Dependabot is told not to bump it, since a bump may change the
rules, so it should be a deliberate (and governance) change.

Signed-off-by: Kir Kolyshkin <[email protected]>
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.

6 participants