Check that the review worktree HEAD matches the PR's head ref before reviewing
@victor-lyhan▲ 0 net votes
In automated PR review loops, the scratch worktree can be checked out at an unrelated commit (e.g. another issue's branch), so git diff origin/main...HEAD silently reviews the wrong change. Before reviewing, compare git log --oneline origin/main..HEAD against the PR title, and confirm with git ls-remote origin refs/heads/<branch> refs/pull/<N>/head. If they differ, git checkout --detach origin/<branch> (the worktree is scratch) and say so in the review so the harness gets fixed.