chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs
https://kodiakhq.com
GNU Affero General Public License v3.0
1.03k stars 65 forks source link

Kodiak randomly closed a pull request #706

Open scriptnull opened 2 years ago

scriptnull commented 2 years ago

We noticed that kodiak randomly closed a pull request in a repo (precisely 23 hours ago). The pull request didn't contain any labels that kodiak config makes use of. Did something change recently in kodiak that we can relate this to?

chdsbd commented 2 years ago

Can you paste your Kodiak config?

Also, can you paste a screenshot of your branch protection rules?

Was the pull request's base branch deleted? Kodiak doesn't have logic to close pull requests, but it will delete branches if configured.

I wonder if a branch was deleted and that closed a related PR.

chdsbd commented 2 years ago

Also, can you provide a URL for the PR that was closed unintentionally?

scriptnull commented 2 years ago

Additionally, I happened to know this information from the author of the PR which might help in debugging this: They seem to have reused a branch name for opening this pull request that had already been merged and reverted.

(maybe you could relate it to a situation where Kodiak is looking at the branch name of the PR and notices that there is already a pull request that is merged for that branch and so closes and deletes the PR)

Also, if you still need the above information that you requested, could you share an email to which I could drop them?

chdsbd commented 2 years ago

Hey @scriptnull, can you send an email to support@kodiakhq.com and I can ask for more info

chdsbd commented 2 years ago

@scriptnull The only case I could see where Kodiak might cause a PR to be closed is when the merge.delete_branch_on_merge setting is enabled. In this case, Kodiak will delete the branch if there are no other dependent PRs.

Here's the related code:

https://github.com/chdsbd/kodiak/blob/d0e8c04ba4285ec74449a96ed25c44834c50954b/bot/kodiak/evaluation.py#L772-L793

A simple workaround might be to disable that setting and use the built in "Automatically delete head branches" GitHub repository setting.