open-swe/agent
Johannes du Plessis fa147ce256
fix: fetch PR diff via GitHub API to re-enable add_finding validation (#1339)
* reviewer: fetch PR diff via GitHub API to re-enable add_finding validation

The previous hotfix in reviewer.py set diff_line_set=None because the
sandbox-based diff prep was sometimes producing empty diffs. That made
every bad anchor a publish-time 422 instead of a creation-time
rejection — the agent burned tokens producing unanchorable findings,
and we had to add a publish-time retry safety net (#1338) to clean up.

Fetch the PR's unified diff via the GitHub REST API at reviewer
startup and populate diff_text + diff_line_set so add_finding can
reject bad anchors immediately. The API path is reliable and is the
same diff GitHub validates against when posting inline review
comments. If the fetch fails, fall back to the previous behavior
(validation disabled, publish-time retry handles it).

Also extract the PR-diff fetch into reviewer_diff.fetch_pr_diff so
both reviewer.py and publish_review.py share one implementation
instead of two copies.

* reviewer: make diff_line_set validation side-aware

compute_diff_line_set previously returned only new-side line numbers,
so re-enabling add_finding's validation would wrongly reject findings
with side=LEFT (deleted-line bugs whose only anchor is an old-side
line). Return {file: {"RIGHT": {new_lines}, "LEFT": {old_lines}}}
instead, and have is_range_in_diff select the matching side from the
finding's recorded side. add_finding and publish_review's retry
filter both pass the finding's side through.
2026-05-27 17:03:33 +00:00
..
dashboard feat: make PR creation policy opt-in (#1334) 2026-05-26 13:30:18 -07:00
integrations feat: add idle TTL and delete-after-stop sandbox lifecycle controls (#1265) 2026-05-08 00:30:14 -04:00
middleware feat: add Agents chat UI for cloud threads (#1323) 2026-05-22 18:15:59 +00:00
tools fix: fetch PR diff via GitHub API to re-enable add_finding validation (#1339) 2026-05-27 17:03:33 +00:00
utils feat: reconcile reviewer comment lifecycle (#1332) 2026-05-26 16:24:34 -07:00
_patch_messages_reducer.py feat: add Agents chat UI for cloud threads (#1323) 2026-05-22 18:15:59 +00:00
encryption.py feat: support TOKEN_ENCRYPTION_KEY rotation via MultiFernet [closes AB-2323] (#1275) 2026-05-08 14:29:23 -07:00
prompt.py feat: make PR creation policy opt-in (#1334) 2026-05-26 13:30:18 -07:00
review_style_analyzer.py feat: add Agents chat UI for cloud threads (#1323) 2026-05-22 18:15:59 +00:00
review_style_collector.py feat: tune reviewer for precision — web/wiki tools + recalibrated prompt (#1312) 2026-05-20 18:35:00 +00:00
review_style_guidance.py feat: tune reviewer for precision — web/wiki tools + recalibrated prompt (#1312) 2026-05-20 18:35:00 +00:00
reviewer.py fix: fetch PR diff via GitHub API to re-enable add_finding validation (#1339) 2026-05-27 17:03:33 +00:00
reviewer_diff.py fix: fetch PR diff via GitHub API to re-enable add_finding validation (#1339) 2026-05-27 17:03:33 +00:00
reviewer_findings.py feat: reconcile reviewer comment lifecycle (#1332) 2026-05-26 16:24:34 -07:00
reviewer_publish.py fix: publish_review HTTP 422 "Path/Line could not be resolved" — agent retries with identical args instead of dropping unresolvable findings (#1338) 2026-05-26 18:37:56 -07:00
reviewer_reconcile.py feat: reconcile reviewer comment lifecycle (#1332) 2026-05-26 16:24:34 -07:00
server.py feat: make PR creation policy opt-in (#1334) 2026-05-26 13:30:18 -07:00
webapp.py fix: treat ready-for-review as reviewer re-review (#1336) 2026-05-26 18:16:11 -07:00