Skip to content

RFC Automatically close pull requests linked to issues that are not ready for contributions #34252

Closed

Description

@virchan

Disclosure: I used LLM to proofread earlier drafts of this issue. All mistakes are due to me.

TL;DR: This RFC discusses whether pull requests linked to issues not yet ready for contributions should be automatically closed to reduce repetitive reviewer workload.

The Situation

In the current review workflow, reviewers typically start with the following steps before inspecting the changes:

  1. Manually check whether the pull request is linked to an issue that is ready for contributions (e.g., not labelled "Needs Triage").
  2. If the linked issue is not yet ready for a pull request, reviewers need to explain this to the author and then close the pull request.

While this process is straightforward and the decision-making is usually quick, it can become repetitive over time and contribute to reviewer fatigue, increasing the maintenance burden.

#33521 reduces the time needed for step 1. However, explaining to contributors why a pull request is being closed because the linked issue is not ready (including wording and tone) is still time-consuming, and is often repeated in very similar forms. See #32951 (review), #33455 (review), and #33695 (review) for examples.

Proposed Solution

During the 2026 sprint, we (@AnneBeyer, @StefanieSenger, and myself) discussed mitigating step 2 by introducing a bot that automatically closes pull requests linked to issues that are not yet ready for contributions. This builds on #33521, and is relatively straightforward from a technical standpoint.

However, the proposed approach has at least two potential concerns:

  1. It may close pull requests that are intended as PoC for issues still under discussion, such as DEP Deprecate getting binary tree stats #34242.
  2. It may introduce security considerations (e.g., GitHub token handling).

Despite these concerns, we believe this RFC could help address these issues and improve the overall review experience in the long run.

Activity

  1. added
    workflow
    on Jun 11, 2026
  2. AnneBeyer commented on Jun 11, 2026

    @AnneBeyer
    Member

    +1, but for a slightly more restricted version that limits this action to new contributors (at least in a first iteration), which will likely resolve the first concern.

  3. StefanieSenger commented on Jun 12, 2026

    @StefanieSenger
    Member

    +1, I'd be happy about having this tool just as described.

    It may close pull requests that are intended as PoC for issues still under discussion,

    A way around having our PoCs closed is to describe everything in the PR description and not use an issue, or not link to it (which new contributors are discouraged from doing).

  4. StefanieSenger commented on Jun 12, 2026

    @StefanieSenger
    Member

    What do other people think, @scikit-learn/documentation-team, @scikit-learn/core-devs, @scikit-learn/contributor-experience-team?

  5. glemaitre commented on Jun 12, 2026

    @glemaitre
    Member

    +1 for closing a bit more aggressively. I think that we can handle the PoC Pars with a label. I think the number of false positive closing will not be that harmful.

  6. glemaitre commented on Jun 12, 2026

    @glemaitre
    Member

    In regards with Anne's comment, could we get a quick statistics to see how many of those noisy PR are from new contributor and from returning contributor.

    If we have vast majority (>80%), I would be inclined with Anne's proposal and it will even reduce false positive.

  7. lucyleeow commented on Jun 12, 2026

    @lucyleeow
    Member

    +1 for bot closing - only concern is security - what permissions would the bot need to have?

  8. StefanieSenger commented on Jun 12, 2026

    @StefanieSenger
    Member

    what permissions would the bot need to have?

    Probably the pull_request_target one: https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_target

    The security warning reads intimidating, though I cannot really evaluate this. In the past we have introduced a few of these.

  9. adrinjalali commented on Jun 12, 2026

    @adrinjalali
    Member

    yeah I like this, and also making sure we leave a scary sounding message as the bot closes them. It'd be also nice to keep track of how many of such PRs from each contributor are closed, so that we ban the ones who reach a certain number semi-automatically.

  10. GaelVaroquaux commented on Jun 12, 2026

    @GaelVaroquaux
    Member
  11. ArturoAmorQ commented on Jun 12, 2026

    @ArturoAmorQ
    Member

    I don't think it would be healthy for the project in the long term to discourage contributions with a "scary" message. That can also hurt how real humans perceive us, even before contributing.

    What if the issue's OP doesn't mark it as ready for contributions for whatever reason (partial consensus or simply by omission) and then a valuable contribution gets closed with absolute no attention from reviewers?

    But what worries me the most is that bots may just learn that not linking the related issue at all leads to better chances for the PR?

  12. StefanieSenger commented on Jun 12, 2026

    @StefanieSenger
    Member

    a valuable contribution gets closed with absolute no attention from reviewers?

    They can reopen their PR once the corresponding issue got triaged. Valuable contributions always have human beings behind that have skin in the game and will therefore care about this.

    But what worries me the most is that bots may just learn that not linking the related issue at all leads to better chances for the PR?

    Then we close these as well.

  13. glemaitre commented on Jun 12, 2026

    @glemaitre
    Member

    But what worries me the most is that bots may just learn that not linking the related issue at all leads to better chances for the PR?

    From the proposal, I read:

    to an issue that is ready for contributions (e.g., not labelled "Needs Triage").

    So the important thing here is the "Need Triage" part which means that linking is not enough and the criterion is the issue needs to be ready.

  14. 3 remaining items

  15. jeremiedbb commented on Jun 12, 2026

    @jeremiedbb
    Member

    It may close pull requests that are intended as PoC for issues still under discussion, such as #34242.

    That's a good point, sometimes it's desirable to have the PR before taking a decision on the issue because it helps take that decision.

  16. DeaMariaLeon commented on Jun 13, 2026

    @DeaMariaLeon
    Member

    Thank you for working on this @virchan, @AnneBeyer, and @StefanieSenger!

    +1: the whole note should be as polite as possible.


    a valuable contribution gets closed with absolute no attention from reviewers?

    They can reopen their PR once the corresponding issue got triaged. Valuable contributions always have human beings behind that have skin in the game and will therefore care about this.

    Could we add a note explicitly stating that they can reopen the PR if they address the requested feedback (e.g., if x, y, and z are done)? Someone who doesn't use scikit-learn, but wants to contribute anyway, may not have "skin in the game". Having their PR closed could discourage them from ever trying again.


    As context: I started contributing through "good first issues", and there wasn't anything specific that I wanted to fix.

    It's a bit sad to read in other discussions that those kinds of contributions are not considered valuable. Or that truly "valuable contributors" are expected to come with specific things they want to fix.

    I understand that AI-generated contributions have made things more difficult for maintainers, but what about new contributors? it's becoming harder for them as well. They may get lost in the sea of noise, or feel like they're knocking on closed doors.

    I may sound touchy-feely, but let's try to maintain the welcoming and inclusive image that this project has built over the years.

  17. lucyleeow commented on Jun 13, 2026

    @lucyleeow
    Member

    I understand your reservations @DeaMariaLeon and I used R more when I started contributing too.

    We have tried to be fairly clear, e.g. bot comment, pleading to not open a PR to issues that have not been triaged yet. Why would a person who genuinely wants to contribute ignore such a request? Since it comments in the issue, even the small group of people that do not use scikit learn but are genuinely keen to contribute should see it. Further, we've tried to give advice to new contributors in the docs, e.g. starting by reviewing PRs to gain more of an understanding of the project and norm. Non code contributions are still valuable.

    (Edit: I agree the comment should be nice and encouraging, but I don't think closing this type of PR will happen to genuine contributors)


    With regard to restricting to first time contributors, I know opinions will vary on this but some maintainers have become more cautious about merging small typo fix PRs to take care about who gains the contributor status. Just wanted to raise the notion

  18. DeaMariaLeon commented on Jun 13, 2026

    @DeaMariaLeon
    Member

    Why would a person who genuinely wants to contribute ignore such a request?

    Good point. :)

  19. AnneBeyer commented on Jun 13, 2026

    @AnneBeyer
    Member

    Regarding the message, I would follow @virchan's answer template and keep it rather neutral. We can still start with a "thank you" and basically copy the text from the warning note into the closing comment, that contains enough pointers for what they could do instead (if they bother to click on the links).

  20. StefanieSenger commented on Jun 15, 2026

    @StefanieSenger
    Member

    what about new contributors? it's becoming harder for them as well. They may get lost in the sea of noise, or feel like they're knocking on closed doors.

    Your point is very appreciated and important.

    My hope is that being stricter enforcing rules of communication and netiquettes will help us focus more on the new contributors that are genuine. I know how much resource I have available for triage and reviewing work and if I spend 90% of it evaluating PRs that aren't based on conscious decisions (but rather on an AI agent's best guess), comparing it with the issue and check if there are other PRs doing the same, then the new contributors that actually put in thought and effort are invisible to me.

  21. betatim commented on Jun 15, 2026

    @betatim
    Member

    I like the suggestion. I think the message from the bot needs to be polite and state facts. No opinion/value judgement. It can conclude with "sometimes this automation gets it wrong, for example for requested proof-of-concepts. Apologies if this happened to you" - maybe we need to add that people should post in the original issue that they made a POC PR?? But maybe people would figure this out by themselves??

    I think limiting the bot to new contributors is the way to go. It will reduce a lot of the workload and reduce the false positives.

    Can we set it up as a pull_request workflow instead of the more powerful pull_request_target? The latter has many warnings and is a popular way for attacks, so avoiding it would be great as it reduces the number of ways we can make a mistake and then get hacked.

  22. lucyleeow commented on Jun 19, 2026

    @lucyleeow
    Member
  23. shipitdev commented on Jun 21, 2026

    @shipitdev
    Contributor

    +1 to this proposal, and I strongly agree with @AnneBeyer's suggestion to restrict it to new contributors initially. That solves the concern about blocking PoC PRs from regular contributors

    Coming from the contributor side, I wanted to mention that this would be extremely helpful for issue authors. As stated, Right now there is a race condition where automated PRs are being opened the second an issue goes live.
    For example, I recently opened a minor doc issue (#34315). Before the Needs Triage label could even be evaluated, a premature PR was opened against it, where i saw @virchan step in and mark it as SPAM / purely AI generated content.

    Having an auto-close mechanism that immediately leaves a polite 'Please wait for triage' message would be a huge win. It saves the maintainers' time, stops the race condition, and keeps the issue thread clean so actual triage can happen.

  24. webdevpraveen commented on Jul 5, 2026

    @webdevpraveen
  25. virchan commented on Jul 15, 2026

    @virchan
    MemberAuthor

    Thanks, everyone, for your input!

    It looks like there is consensus around the proposed solution, so I'll remove the RFC label and start working on it.

  26. StefanieSenger commented on Jul 18, 2026

    @StefanieSenger
    Member

    Removing the sprint label so people don't confuse it with the EuroPython sprint label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    workflow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions