fix: use incremental diff per iteration instead of cumulative base diff

After each iteration's _commit_iteration, record the new HEAD SHA and use
it as the diff anchor for the next iteration. Previously capture_diff
always diffed against the initial base commit, causing every iteration to
return the same full cumulative diff — reviewers couldn't see what changed
between iterations, leading to repeated feedback and stuck FAIL loops.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chungyeong
2026-03-15 10:07:11 +09:00
parent bf64d19123
commit 28efd5bb8f
3 changed files with 42 additions and 41 deletions

View File

@@ -413,11 +413,13 @@ class TestInvokeAgenticRuntime(unittest.TestCase):
class TestPipelineHelpers(unittest.TestCase):
@patch("cross_eval.worktree.get_current_head", return_value="a" * 40)
@patch("cross_eval.worktree.commit_worktree", return_value=True)
def test_commit_iteration_logs_only_when_committed(self, mock_commit: MagicMock) -> None:
def test_commit_iteration_logs_only_when_committed(self, mock_commit: MagicMock, mock_head: MagicMock) -> None:
with tempfile.TemporaryDirectory() as tmpdir:
_commit_iteration(Path(tmpdir), "review-fix", 2, "PASS")
new_head = _commit_iteration(Path(tmpdir), "review-fix", 2, "PASS")
mock_commit.assert_called_once()
self.assertEqual(new_head, "a" * 40)
def test_snapshot_repo_state_includes_untracked_digest(self) -> None:
with tempfile.TemporaryDirectory() as tmpdir: