Skip to content

[CI][Docs] Pull requests closed by the PR limit workflow cannot be reopened by their authors #54696

Open

Description

@pearu

Describe the bug, including details regarding any error messages, version, and platform.

The PR limit workflow closes a pull request that takes a contributor over the limit, and both its comment (.github/workflows/pr_limit/comment.md: "you are welcome to reopen this one") and the docs (docs/source/developers/bug_reports.rst: "Once one of your other pull requests has been merged or closed, you can reopen it") say that the author can reopen it later.

In practice the author cannot. After #54656 was merged, which brought me below the limit, reopening #54657 (closed by the workflow) fails:

$ gh pr reopen 54657 -R apache/arrow
API call failed: GraphQL: Could not open the pull request. (reopenPullRequest)

Presumably GitHub does not let an author without repository access reopen a pull request that was closed by an account with write access.

Either the comment and the docs could ask the author to request a reopen from a committer or collaborator (the workflow already leaves alone a pull request reopened by someone with repository access, see .github/workflows/pr_limit/check.js), or the workflow could let authors reopen their pull requests, e.g. by reopening them itself once the author is below the limit.

Component(s)

Continuous Integration, Documentation

Activity

  1. pearu commented on Oct 20, 2026

    @pearu
    ContributorAuthor

    Some data on the bot workflow so far, covering all 232 pull requests created since it was introduced on 2026-09-14:

    • 35 pull requests were closed by the workflow.
    • 2 were reopened, both on the first day: one by its author while the limit still applied to collaborators, and one by a maintainer. None was reopened by an author without repository access.
    • For 5 of them, the author opened a new pull request for the same issue instead (4 resubmissions).
    • The remaining 28 have not been reopened or resubmitted.

    Using a previously merged pull request in apache/arrow as a sign of an established contributor:

    • 12 of the 35 closures (34%) hit authors with at least one merged pull request before the closure;
    • 23 of the 35 closures (66%) hit authors without a previously merged pull request. This group also includes genuine first-time contributors.

    In summary, the bot catches likely AI slop that is about 10 % of all PRs, while about 70 % of the genuine contributors it hits have not returned so far.

  2. pearu commented on Oct 21, 2026

    @pearu
    ContributorAuthor

    A possible improvement, based on the data above: exempt contributors with a few merged pull requests in this repository from the limit. In the period above, all 12 closures that hit an author with a previously merged pull request would have been avoided with a threshold of 1, and 6 of them with a threshold of 3, while all 23 other closures would have been kept. A threshold higher than 1 makes it harder to get exempted with a single trivial pull request.

    The merged count is available with the same search API that the workflow already uses for the open count, and is only needed when a contributor is over the limit. A sketch with a threshold of 3:

    Diff
    diff --git a/.github/workflows/pr_limit/check.js b/.github/workflows/pr_limit/check.js
    --- a/.github/workflows/pr_limit/check.js
    +++ b/.github/workflows/pr_limit/check.js
    @@ -62,6 +62,18 @@ async function countOpenPullRequests(github, context, username) {
       return data.total_count;
     }
     
    +/**
    + * Returns the number of merged pull requests authored by the user in this
    + * repository.
    + */
    +async function countMergedPullRequests(github, context, username) {
    +  const {data} = await github.rest.search.issuesAndPullRequests({
    +    q: `repo:${context.repo.owner}/${context.repo.repo} is:pr is:merged author:${username}`,
    +    per_page: 1
    +  });
    +  return data.total_count;
    +}
    +
     /**
      * Comments on the pull request explaining the limit, then closes it.
      *
    @@ -125,6 +137,13 @@ module.exports = async ({github, context, core}) => {
         return;
       }
     
    +  // Contributors with at least 3 merged pull requests are not limited.
    +  const merged = await countMergedPullRequests(github, context, user.login);
    +  if (merged >= 3) {
    +    core.info(`Skipping: ${user.login} has ${merged} merged pull request(s).`);
    +    return;
    +  }
    +
       core.info(`Closing #${pullRequestNumber}: over the limit.`);
       await commentAndClose(github, context, pullRequestNumber, user.login, limit, count);
     };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions