fix(github): resolve follow-up review API issues

- Fix gh_client.py: use query string syntax for `since` parameter instead
  of `-f` flag which sends POST body fields, causing GitHub API errors
- Fix followup_reviewer.py: use raw Anthropic client for message API calls
  instead of ClaudeSDKClient which is for agent sessions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
AndyMik90
2025-12-25 20:45:26 +01:00
parent b005fa5c86
commit f1cc5a09f2
2 changed files with 14 additions and 16 deletions
+6 -4
View File
@@ -665,8 +665,9 @@ class GHClient:
- issue_comments: General PR discussion comments
"""
# Fetch inline review comments
review_endpoint = f"repos/{{owner}}/{{repo}}/pulls/{pr_number}/comments"
review_args = ["api", review_endpoint, "-f", f"since={since_timestamp}"]
# Use query string syntax - the -f flag sends POST body fields, not query params
review_endpoint = f"repos/{{owner}}/{{repo}}/pulls/{pr_number}/comments?since={since_timestamp}"
review_args = ["api", review_endpoint]
review_result = await self.run(review_args, raise_on_error=False)
review_comments = []
@@ -677,8 +678,9 @@ class GHClient:
logger.warning(f"Failed to parse review comments for PR #{pr_number}")
# Fetch general issue comments
issue_endpoint = f"repos/{{owner}}/{{repo}}/issues/{pr_number}/comments"
issue_args = ["api", issue_endpoint, "-f", f"since={since_timestamp}"]
# Use query string syntax - the -f flag sends POST body fields, not query params
issue_endpoint = f"repos/{{owner}}/{{repo}}/issues/{pr_number}/comments?since={since_timestamp}"
issue_args = ["api", issue_endpoint]
issue_result = await self.run(issue_args, raise_on_error=False)
issue_comments = []
@@ -543,10 +543,9 @@ class FollowupReviewer:
Returns parsed AI response with finding resolutions and new findings,
or None if AI review fails.
"""
try:
from ...core.client import create_client
except ImportError:
from core.client import create_client
# Use raw Anthropic client for simple message API calls
# (ClaudeSDKClient is for agent sessions, not direct message calls)
import anthropic
self._report_progress(
"analyzing", 65, "Running AI-powered review...", context.pr_number
@@ -624,16 +623,13 @@ Please analyze this follow-up review context and provide your response in the JS
"""
try:
# Create client and run the review
client = create_client(
project_dir=self.project_dir,
spec_dir=self.github_dir,
model=self.config.model or "claude-sonnet-4-5-20250929",
agent_type="qa_reviewer",
)
# Create Anthropic client for simple message API call
# Note: For agent sessions with tools, use ClaudeSDKClient instead
client = anthropic.AsyncAnthropic()
model = self.config.model or "claude-sonnet-4-5-20250929"
response = await client.messages.create(
model=self.config.model or "claude-sonnet-4-5-20250929",
model=model,
max_tokens=4096,
messages=[{"role": "user", "content": user_message}],
)