Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] add bot to lock inactive issues and PRs #6037

Merged
merged 3 commits into from
Aug 15, 2023
Merged

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Aug 13, 2023

Proposes adding a bot that runs once a week and does the following for any closed issues and PRs that have not had any new activity in the previous 90 days, and which don't have the feature request label...

  • removes any of the following labels:
    • awaiting response
    • awaiting review
    • blocking
    • in progress
  • posts a comment encouraging anyone looking at it to open a new issue
  • locks conversation on the issue/PR (so only maintainers can post further comments)

Benefit of this change

Keeps focus on active conversations and PRs, that everyone looking at the repo can see.

Prevents the situation where people ask questions by commenting on old, closed discussions like this: #4803 (comment). In those situations, only people who were already subscribed to that particular conversation are notified.

Notes for Reviewers

We used to run a bot for this purpose in LightGBM, but it was turned off over 2 years ago, in #4251.

At the time, I recommended that we might switch from https://github.com/dessant/lock-threads-app (archived in 2021) to https://github.com/dessant/lock-threads (active): #4251 (comment)

But then we just never did that... I got busy with other things and forgot 😅

This PR proposes finally doing that. https://github.com/dessant/lock-threads is actively maintained (most recent rerlease in June 2023), and importantly doesn't require any new permissions changes in the repo, since it is able to run as a GitHub Actions workflow.

See https://github.com/dessant/lock-threads/blob/main/README.md#available-input-parameters for documentation on this configuration.

on:
schedule:
# midnight UTC, every Wednesday
- cron: '0 0 * * 3'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Running once a week should be plenty. I want to be respectful of GitHub's resources, and minimize the impact on our GitHub Actions quota for this specific repo.

github-token: ${{ github.token }}
# after how many days of inactivity should a closed issue/PR be locked?
issue-inactive-days: '90'
pr-inactive-days: '90'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that we use to close issues after only 60 days of inactivity: #4251.

I think 90 is a good balance of allowing for recent discussions to be revived while also encouraging the creation of new discussions.

Please also note that this about locking 90 days AFTER an issue/PR is closed, and that we have a separate bot that automatically closes issues after 30 days waiting for a response:

daysUntilClose: 30

Comment on lines +31 to +32
remove-issue-labels: 'awaiting response,awaiting review,blocking,in progress'
remove-pr-labels: 'awaiting response,awaiting review,blocking,in progress'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if this will work with labels with spaces in the names... but I think the only way to test iis to merge to master.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'll work. I just ran this (GH CLI):

gh api \     
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/microsoft/LightGBM/issues/6033

and this is the labels section

"labels": [
    {
      "id": 466962712,
      "node_id": "MDU6TGFiZWw0NjY5NjI3MTI=",
      "url": "https://api.github.com/repos/microsoft/LightGBM/labels/feature%20request",
      "name": "feature request",
      "color": "1d76db",
      "default": false,
      "description": ""
    }
],

and it seems that this action takes the name of the label:
https://github.com/dessant/lock-threads/blob/be8aa5be94131386884a6da4189effda9b14aa21/src/index.js#L93
But yeah, we'll have to see it in action haha.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh cool idea to use the GitHub CLI! I'd never used that before.

@shiyu1994
Copy link
Collaborator

shiyu1994 commented Aug 15, 2023

Surprisingly this should fail due to the bug of quantized training... It's my bad.

================================== FAILURES ===================================
___________________________ test_quantized_training ___________________________
    def test_quantized_training():
        X, y = make_synthetic_regression()
        ds = lgb.Dataset(X, label=y)
        bst_params = {'num_leaves': 15, 'verbose': -1, 'seed': 0}
        bst = lgb.train(bst_params, ds, num_boost_round=10)
        rmse = np.sqrt(np.mean((bst.predict(X) - y) ** 2))
        bst_params.update({
            'use_quantized_grad': True,
            'num_grad_quant_bins': 30,
            'quant_train_renew_leaf': True,
        })
>       quant_bst = lgb.train(bst_params, ds, num_boost_round=10)
tests\python_package_test\test_engine.py:4132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\appveyor\AppData\Roaming\Python\Python38\site-packages\lightgbm\engine.py:276: in train
    booster.update(fobj=fobj)
C:\Users\appveyor\AppData\Roaming\Python\Python38\site-packages\lightgbm\basic.py:3602: in update
    _safe_call(_LIB.LGBM_BoosterUpdateOneIter(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ret = -1
    def _safe_call(ret: int) -> None:
        """Check the return value from C API call.
    
        Parameters
        ----------
        ret : int
            The return value from C API calls.
        """
        if ret != 0:
>           raise LightGBMError(_LIB.LGBM_GetLastError().decode('utf-8'))
E           lightgbm.basic.LightGBMError: Check failed: (best_split_info.left_count) > (0) at C:\projects\lightgbm\lightgbm-python\src\treelearner\serial_tree_learner.cpp, line 845 .
C:\Users\appveyor\AppData\Roaming\Python\Python38\site-packages\lightgbm\basic.py:238: LightGBMError
---------------------------- Captured stderr call -----------------------------
[LightGBM] [Fatal] Check failed: (best_split_info.left_count) > (0) at C:\projects\lightgbm\lightgbm-python\src\treelearner\serial_tree_learner.cpp, line 845 .

Link #5982.

@jameslamb
Copy link
Collaborator Author

Thanks for linking that issue and pasting the logs here! I agree, it looks like that issue.

No problem, it doesn't need to block this PR... I just retriggered the job, hopefully it will pass on a second run. We should try to fix that, but as long as it usually succeeds and a retry gets past the occasional failure, it isn't high-urgency.

Comment on lines +31 to +32
remove-issue-labels: 'awaiting response,awaiting review,blocking,in progress'
remove-pr-labels: 'awaiting response,awaiting review,blocking,in progress'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'll work. I just ran this (GH CLI):

gh api \     
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/microsoft/LightGBM/issues/6033

and this is the labels section

"labels": [
    {
      "id": 466962712,
      "node_id": "MDU6TGFiZWw0NjY5NjI3MTI=",
      "url": "https://api.github.com/repos/microsoft/LightGBM/labels/feature%20request",
      "name": "feature request",
      "color": "1d76db",
      "default": false,
      "description": ""
    }
],

and it seems that this action takes the name of the label:
https://github.com/dessant/lock-threads/blob/be8aa5be94131386884a6da4189effda9b14aa21/src/index.js#L93
But yeah, we'll have to see it in action haha.

@jameslamb jameslamb merged commit 7a801f7 into master Aug 15, 2023
@jameslamb jameslamb deleted the ci/add-lockbot branch August 15, 2023 20:12
@jameslamb
Copy link
Collaborator Author

I just triggered a run right now with workflow_dispatch... let's see what happens.

https://github.com/microsoft/LightGBM/actions/runs/5871302631

@jameslamb
Copy link
Collaborator Author

jameslamb commented Aug 15, 2023

It somewhat worked. I saw about 100 things get locked, and the comment posted looks correct.

#5665 (comment)

And the bot did remove labels correctly! For example, #5800 had awaiting review on it still even though it had been merged, and the bot removed it.

image

problem 1: it only locked some things

Screenshot 2023-08-15 at 3 23 40 PM

I'd expected it to be a lot more. There have been more than 100 issues closed + PRs merged in the last 2 years here!

I see a mix of PRs (e.g. #5665) and issues (e.g. #5574), so it's not like it's "just locked PRs" or "just locked issues".

I just triggered a new run, to see if maybe there's some limit in the number of issues/PRs it'll touch per run (to avoid hitting GitHub API limits, maybe?).

problem 2: it locked some issues with feature request in the labels

Like this one: #3200.

@jameslamb
Copy link
Collaborator Author

I just triggered a new run, to see if maybe there's some limit in the number of issues/PRs it'll touch per run (to avoid hitting GitHub API limits, maybe?).

Ok yes! Triggered https://github.com/microsoft/LightGBM/actions/runs/5871480057/job/15920921845

and it locked around another 100 issues.

So I guess there must be a per-run limit in that job. I'll stop manually triggering runs for now, so we can maybe use future runs to test fixes for the problems I stated above

Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants