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

feat(bors.toml): let bors wait for PRs to be green before merging #11609

Closed
wants to merge 2 commits into from

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jan 22, 2022

This makes it reasonable to type bors r+ even while CI is running.


Open in Gitpod

See discussion on Zulip: https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/bors.20and.20pr_status/near/268977363

This makes it reasonable to type `bors r+` even while CI is running.
@bryangingechen bryangingechen added the CI This issue or PR is about continuous integration label Jan 22, 2022
@bryangingechen
Copy link
Collaborator

Let's see if this works the way I think it does...
bors r+

@bors
Copy link

bors bot commented Jan 22, 2022

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Jan 22, 2022
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 22, 2022

Interesting, this means that bors uses the configuration in the PR, not the one in master. Good to know.

@bryangingechen
Copy link
Collaborator

Yep, that feature's been very useful for testing!

@bryangingechen
Copy link
Collaborator

Ah, since bors uses the bors.toml in the PR, I guess that means that even after this is merged, we still can't safely use bors r+ on older PRs (unless they've had master merged into them).

@bryangingechen
Copy link
Collaborator

Looks to me like the required checks passed, but this doesn't seem to be in the bors queue yet. Does it usually take a while?

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 22, 2022

I’m not sure. Maybe we have to wait for the next merge batch?

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 22, 2022

Looks to me like the required checks passed, but this doesn't seem to be in the bors queue yet. Does it usually take a while?

Oh, I remember a problem we had with bors at my previous job: At some point in the past it would timeout in that “waiting state” without notice.

Not 100% related, but if this issue were fixed we’d have more clarity: bors-ng/bors-ng#1140

Are we running our own instance of bors, or is this a hosted github action? Maybe something needs to be configured to allow bors to actually react on a status change?

I can open an issue at the bors repo to ask, but not today…

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 22, 2022

bors ping

@bors
Copy link

bors bot commented Jan 22, 2022

pong

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 22, 2022

Or maybe bors gets confused because the configuration on master is different? (Just guessing)

@bryangingechen
Copy link
Collaborator

We're using the publicly hosted instance of bors at the moment. Let me try again and see what bors has to say:
bors r+

@bryangingechen
Copy link
Collaborator

Ah, that makes sense. If the checks are already green, it goes on the queue automatically. Let me take this off for now.
bors r-

@bors
Copy link

bors bot commented Jan 23, 2022

Canceled.

@bryangingechen
Copy link
Collaborator

If bors is likely to silently timeout while waiting for checks to pass then it's not clear that this will be an improvement. I'd like to have a better understanding of what happened here (and get some more opinions from the other maintainers) before merging this. Joachim, if you don't mind creating an issue that'd be greatly appreciated!

@bryangingechen bryangingechen added awaiting-review The author would like community review of the PR and removed ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) labels Jan 23, 2022
This might fix our problem
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 23, 2022

@bryangingechen, based on reading the bors code, this might fix the problem for us. It’s still suboptimal user experience that if that (huge) timeout is exceeded, that there is no message, but maybe that’s rare enough. If you want a good UI with better insight, we should switch back to mergify ;-)/

@bryangingechen
Copy link
Collaborator

Thanks! Let's go with this for now! I've just rerun the CI jobs on the last commit, so let's see how this goes:
bors r+

@bors
Copy link

bors bot commented Jan 23, 2022

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Jan 23, 2022
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 23, 2022

Nope, still doesn't work, it seem :-(

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 23, 2022

Do we actually need an approving review maybe?

@collares
Copy link
Collaborator

collares commented Jan 23, 2022

It might still work! Bors polls GitHub every 5 minutes according to https://github.com/bors-ng/bors-ng/blob/a1b31786d48839f67fd5691564217e8538f74b24/lib/worker/batcher/bors_toml.ex#L20

Edit: Nope :( And besides, Bors now GitHub polls every minute, the comment just wasn't kept up to date.

@bryangingechen bryangingechen added awaiting-author A reviewer has asked the author a question or requested changes and removed ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) labels Jan 23, 2022
@bryangingechen
Copy link
Collaborator

I'm going to try again with the approving review, but even if it works this time, I think I'll take it off the queue again until we can figure out exactly what the conditions are...
bors r+

@bors
Copy link

bors bot commented Jan 23, 2022

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jan 23, 2022
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 23, 2022

:-(

@bryangingechen bryangingechen added awaiting-author A reviewer has asked the author a question or requested changes and removed ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) labels Jan 23, 2022
@ericrbg
Copy link
Collaborator

ericrbg commented Jan 27, 2022

agh, this is very sad :( I was excited for this

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 27, 2022

I was hoping that upstream can help us out here, but the issues there have been silent so far.

@bryangingechen
Copy link
Collaborator

The maintainer has kindly helped us out with various issues before; they may just be busy at the moment.

@collares
Copy link
Collaborator

collares commented Jan 27, 2022

Do mathlib maintainers have access to bors logs?

Also, after the tests passed, did anyone check https://app.bors.tech/repositories/24316 to see if this PR was still awaiting review? I guess so, but the reason I ask is because bors sends a comment in every failure case (even timeouts), but it stays silent when it detects PR checks succeeded (the rationale being that the staging commit will reference the PR, which is enough of a notification). If there's an already-running batch, this means nothing will show up here for a few hours.

@bryangingechen
Copy link
Collaborator

@collares We have access to the log page, but as far as I can tell, this PR doesn't appear there (either as a failure or success). Also, I did look at the main page several times and again, I never saw this PR move off "Awaiting Review" status. I haven't looked at the bors code yet, but I would have expected that after the checks pass, this PR should be moved to "Waiting to Run" and then a staging commit should get pushed once all other batches are finished, but that never happened.

@collares
Copy link
Collaborator

collares commented Jan 27, 2022

Ah, that's sad :( So the log doesn't even contain the "Continue Poll Patch #{patch.id} prerun" messages? They are logged once per minute, each time bors polls the check status. I assume every such log message refers to this PR, even if the patch ID is something unrecognizable (could be just a unique ID unrelated to the PR number/commit sha).

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 27, 2022

JFTR, I don't have access to https://app.bors.tech/repositories/24316/log, so i can't help with the sleuthing

@bryangingechen
Copy link
Collaborator

bryangingechen commented Jan 27, 2022

So the log doesn't even contain the "Continue Poll Patch #{patch.id} prerun" messages?

For the record, this is what the log page looks like (I'm only showing the top of the page, but you can keep clicking "Older" at the bottom of the page to load more and more batches):

Screen Shot 2022-01-27 at 9 17 47 AM

Every once in a while, bors crashes and we get something which looks like this:

Screen Shot 2022-01-27 at 9 17 58 AM

PR number 11609 doesn't show up anywhere on that log page, so unfortunately I don't think there's much we can learn from it.

If we want to continue chasing this down on our side, someone could try setting up a private bors instance and trying to reproduce this issue there. I know that @gebner set one up in the past for testing - if it still exists, maybe he can give access?

@gebner
Copy link
Member

gebner commented Jan 27, 2022

if it still exists, maybe he can give access?

Yes, https://borslein.herokuapp.com/ is deployed from https://github.com/gebner/bors-ng

If you want I can give you push access. But it's also super easily to deploy your own instance.

@collares
Copy link
Collaborator

collares commented Jan 29, 2022

Thanks @gebner! It's indeed very easy to deploy it to Heroku; I had to override the Node version to avoid a build error but otherwise it went smoothly.

I reported my findings in the issue filed by @nomeata (bors-ng/bors-ng#1434), but the TL;DR is that bors just randomly stops polling for changes, and typing r+ again wakes it up for a while. If it is awake when the CI checks pass, it creates a batch normally (even if the r+ happened prior to the completion of the CI run, of course). The logs aren't really useful and I don't have any Erlang runtime debugging skills.

EDIT: Turns out bors stops the batch-polling process if it doesn't find any "incomplete" (i.e., waiting to run) batches after a poll, which was a valid optimization before the same process handled polling pr_status checks as well.

@bryangingechen
Copy link
Collaborator

@collares thanks very much for following up on this! Let's hope this moves things forwards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes CI This issue or PR is about continuous integration too-late This PR was ready too late for inclusion in mathlib3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants