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:
@@ -62,18 +62,20 @@ def _commit_iteration(
|
||||
label: str,
|
||||
iteration: int,
|
||||
verdict: str | None,
|
||||
) -> None:
|
||||
) -> str:
|
||||
"""Intermediate commit after each agentic iteration.
|
||||
|
||||
This resets the diff baseline so the next iteration only captures new changes.
|
||||
Returns the new HEAD SHA to use as the base_commit for the next iteration.
|
||||
"""
|
||||
from cross_eval.worktree import commit_worktree
|
||||
from cross_eval.worktree import commit_worktree, get_current_head
|
||||
committed = commit_worktree(
|
||||
worktree_path,
|
||||
f"cross-eval: {label} v{iteration} ({verdict or 'no-verdict'})",
|
||||
)
|
||||
if committed:
|
||||
logger.debug(" Intermediate commit: v%d (%s)", iteration, verdict)
|
||||
return get_current_head(worktree_path)
|
||||
|
||||
|
||||
def _has_agentic_steps(config: PipelineConfig, steps: list[StepConfig]) -> bool:
|
||||
@@ -388,7 +390,7 @@ def _run_simple_pipeline(
|
||||
|
||||
# Intermediate commit so next iteration's diff only shows new changes
|
||||
if worktree_path is not None:
|
||||
_commit_iteration(worktree_path, config.preset_name, i, verdict)
|
||||
agentic_base_commit = _commit_iteration(worktree_path, config.preset_name, i, verdict)
|
||||
|
||||
iter_result = IterationResult(
|
||||
iteration=i,
|
||||
@@ -588,7 +590,7 @@ def _run_phased_pipeline(
|
||||
|
||||
# Intermediate commit so next iteration's diff only shows new changes
|
||||
if worktree_path is not None:
|
||||
_commit_iteration(
|
||||
agentic_base_commit = _commit_iteration(
|
||||
worktree_path, f"{config.preset_name}/{phase.name}",
|
||||
global_iter, verdict,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user