Skip to content

Commit 2c3abcf

Browse files
committed
🚀 CRITICAL FIX: Resolve GitHub diff API header issue
🐛 ROOT CAUSE IDENTIFIED: - GitHub API was returning JSON metadata instead of diff content - Session headers were set to 'application/vnd.github.v3+json' - This caused 16,951 characters of PR JSON data instead of actual diff 🔧 SOLUTION: - Override Accept header in get_pr_diff() method specifically - Use 'application/vnd.github.v3.diff' for diff requests - Maintain JSON format for other API calls ✅ EXPECTED RESULT: - Should now receive actual Git diff content - Unidiff parser will find files to process - Code review will work as intended This resolves the core issue where PatchSet was empty despite having 'content' - we were parsing JSON instead of diff format.
1 parent 33d2e57 commit 2c3abcf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gemini_reviewer/github_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ def get_pr_diff(self, owner: str, repo: str, pull_number: int) -> str:
175175
# Use direct API call for diff
176176
api_url = f"{self.config.api_base_url}/repos/{repo_name}/pulls/{pull_number}.diff"
177177

178+
# Override Accept header to specifically request diff format
179+
diff_headers = {
180+
'Accept': 'application/vnd.github.v3.diff'
181+
}
182+
178183
logger.debug(f"Making diff API request to: {api_url}")
179-
response = self._session.get(api_url, timeout=self.config.timeout)
184+
response = self._session.get(api_url, headers=diff_headers, timeout=self.config.timeout)
180185

181186
if response.status_code == 200:
182187
diff = response.text

0 commit comments

Comments
 (0)