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

better handle 502 errors when merging PRs #739

Open chdsbd opened 2 years ago

chdsbd commented 2 years ago

When Kodiak starts merging a PR, it enters a loop, polling until the PR is ready to merge. If Kodiak makes a GitHub API request and encounters an error, it will eject from this loop, ignoring the PR and moving on to the next PR in queue.

This is problematic behavior as it can trigger extra updates to PRs. We should gracefully retry on recoverable errors.

Here's where we check for an error: https://github.com/chdsbd/kodiak/blob/afd6e59833f95ec4a28487f95fb09b3a515fd1c6/bot/kodiak/queries/__init__.py#L876-L880

We should audit all of our API requests to ensure we gracefully handle errors.

chdsbd commented 2 years ago

Why do we raise ApiCallException for some errors but not others?

https://github.com/chdsbd/kodiak/blob/b6b543d49acf8b019dcf2819f44d2a6774551bef/bot/kodiak/pull_request.py#L262-L268