Fix bugs, improve validation, and expand test coverage#7
Open
Keramikus-97 wants to merge 1 commit into
Open
Conversation
config.py: - Validate timeout bounds [1, 300], clamp out-of-range values - Log warnings for invalid/out-of-range OPENCODE_TIMEOUT github_client.py: - Add pagination to list_issue_comments (up to 10 pages / 1000 comments) - Reject 3xx redirects explicitly instead of silently accepting - Catch JSON decode errors and wrap in GitHubAPIError - Disable follow_redirects on httpx client webhook_handler.py: - Reject payloads with missing comment_id, sender_login, or issue_number comment_parser.py: - Replace word-boundary with lookahead to support triggers ending in non-word characters (e.g. /oc+) - Document unmatched-quote behavior in split_arguments Tests (17 new): - Pagination, redirects, JSON errors, timeout clamping, field validation, unmatched quotes, special-char triggers, empty responses README.md: - Document usage, configuration, and dev setup Co-Authored-By: dominicpape <dominicpape@gmx.net>
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
Implements all fixes identified during a thorough code review of the codebase. The three most impactful changes:
1.
list_issue_commentsnow paginates — previously only fetched the first page (30 comments), silently dropping data on active issues. Now iterates up tomax_pages(default 10 → 1000 comments at 100/page):2.
_requestnow rejects 3xx and invalid JSON — previously a 301 redirect was treated as success and its body parsed as JSON (likely crashing). Now raisesGitHubAPIErrorfor both cases.follow_redirects=Falseis set on the httpx client.3.
Config.from_envvalidates timeout bounds —OPENCODE_TIMEOUT=-5or999was silently accepted and passed to httpx. Now clamped to[1, 300]with a logged warning.Other fixes:
parse_payloadrejects webhooks withcomment_id=0, emptysender_login, orissue_number=0instead of creating unusableWebhookEventobjectsextract_commandsregex:\b→(?=\s|$)so triggers ending in non-word chars (e.g./oc+) workNote: The workflow file (
.github/workflows/opencode.yml) also needs hardening (actor filtering, concurrency, timeout, full clone). The changes are ready locally but couldn't be pushed due to OAuthworkflowscope restrictions. The recommended workflow diff:Link to Devin session: https://app.devin.ai/sessions/40cdfcb7b4614be1934ac754a3c1d013
Requested by: @Keramikus-97