Conversation
Add base reviewer instructions to prevent common LLM missteps: focus on code changes not project decisions, don't make uncertain factual claims, don't repeat prior comments, be sparing. Fix hunk header parsing to capture all four components (old_start, old_count, new_start, new_count) so the LLM sees accurate diff context. Add HTTP timeouts to GitHub (30s) and Gemini (120s) clients.
| } | ||
|
|
||
| lineNum := hunk.StartLine | ||
| lineNum := hunk.NewStartLine |
There was a problem hiding this comment.
praise: Changing hunk.StartLine to hunk.NewStartLine is correct. This ensures line numbers for added and context lines are tracked relative to the new file, which is essential for accurate commenting.
| @@ -109,29 +109,57 @@ func resolvePathFromHeaders(lines []string, start int, fallback string) string { | |||
| return fallback | |||
There was a problem hiding this comment.
praise: The refactor of parseHunkHeader and the introduction of parseRange significantly improve the accuracy and robustness of diff hunk header parsing. This is a critical correctness fix for handling the full @@ -old_start,old_count +new_start,new_count @@ format.
| @@ -15,8 +15,11 @@ type Line struct { | |||
| } | |||
|
|
|||
| type Hunk struct { | |||
There was a problem hiding this comment.
praise: Updating the Hunk struct to include OldStartLine, OldLineCount, NewStartLine, and NewLineCount is a good design choice, allowing for a more complete and accurate representation of diff hunks.
| @@ -70,7 +72,8 @@ func New(apiKey string, model string) provider.ReviewFunc { | |||
|
|
|||
There was a problem hiding this comment.
praise: Similar to the GitHub client, adding an httpTimeout to the Gemini HTTP client is a good improvement for robustness.
Summary
Fixes from the bot's own review of the initial PR:
Hunkstruct now captures all four components (OldStartLine,OldLineCount,NewStartLine,NewLineCount), producing correct@@ -old,count +new,count @@headers in the promptio.ReadAllerror before unmarshalling in comment fetcherTest plan