Enhance GitHub client with retry/rate-limit and add bot-loop prevention#5
Open
Keramikus-97 wants to merge 2 commits into
Open
Enhance GitHub client with retry/rate-limit and add bot-loop prevention#5Keramikus-97 wants to merge 2 commits into
Keramikus-97 wants to merge 2 commits into
Conversation
- Add handler.py with WebhookProcessor that orchestrates the full webhook processing flow: signature verification, payload parsing, command extraction, and acknowledgement via reaction - Export all public symbols from __init__.py - Add comprehensive tests for the handler module (9 tests)
- GitHubClient: automatic retries with exponential backoff for 429/5xx - GitHubClient: respect Retry-After and X-RateLimit-Reset headers - GitHubClient: RateLimitError raised when retries exhausted on 429 - GitHubClient: new methods create_pull_request, update_file, create_commit_status - WebhookProcessor: ignore_logins parameter for bot-loop prevention - Export RateLimitError from package __init__ - 21 new tests (83 total, all passing)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
GitHubClientnow handles transient failures automatically and theWebhookProcessorprevents bot-loop storms.Retry + rate-limit in
_request: Retries up tomax_retrieson 429/5xx with exponential backoff. RespectsRetry-AfterandX-RateLimit-Resetheaders (capped at 60s). When 429 retries are exhausted, raisesRateLimitError(reset_at=...)instead of genericGitHubAPIError. Non-retryable 4xx errors fail immediately on first attempt.Bot-loop prevention in
WebhookProcessor: Newignore_loginsparameter — comments from those logins returnskipped_reason="ignored_login"before command extraction, preventing the bot from responding to its own comments.New API methods:
create_pull_request,update_file(Contents API),create_commit_status.21 new tests (83 total).
Link to Devin session: https://app.devin.ai/sessions/306b14b0580b4a1d830a4afc1c2dfd86
Requested by: @Keramikus-97