Preserve explicit blocked repair outcomes

This commit is contained in:
yoni 2026-09-25 21:12:49 +00:00
parent 9d525ade7f
commit d02b74c3c0
2 changed files with 42 additions and 17 deletions

View file

@ -546,6 +546,23 @@ async def prepare_fix( # noqa: PLR0915
gaps = _verification_gaps(repair_outcome, checks, reproduction, verifier)
gaps = list(dict.fromkeys(gaps))
if repair_outcome.status is RepairStatus.BLOCKED:
manifest, summary, artifact_ref = await manifest_builder(workspace)
return _result(
context,
state=PreparationState.BLOCKED,
reason=repair_outcome.summary,
checks=checks,
reproduction=reproduction,
verifier=verifier,
gaps=gaps,
manifest=manifest,
diff_summary=summary,
artifact_ref=artifact_ref,
attempt_history=attempt_history,
started=started,
)
if _verification_passes(checks, reproduction, verifier):
manifest, summary, artifact_ref = await manifest_builder(workspace)
if not manifest:
@ -589,23 +606,6 @@ async def prepare_fix( # noqa: PLR0915
started=started,
)
if repair_outcome.status is RepairStatus.BLOCKED:
manifest, summary, artifact_ref = await manifest_builder(workspace)
return _result(
context,
state=PreparationState.BLOCKED,
reason=repair_outcome.summary,
checks=checks,
reproduction=reproduction,
verifier=verifier,
gaps=gaps,
manifest=manifest,
diff_summary=summary,
artifact_ref=artifact_ref,
attempt_history=attempt_history,
started=started,
)
if previous_workspace_digest == workspace_digest:
manifest, summary, artifact_ref = await manifest_builder(workspace)
return _result(

View file

@ -488,6 +488,31 @@ async def test_prepare_fix_evaluates_budget_exhausted_patch(tmp_path: Path) -> N
assert result.attempt_history[0].repair.turns_used == 40
@pytest.mark.asyncio
async def test_prepare_fix_preserves_explicit_blocked_outcome(tmp_path: Path) -> None:
workspace, commit = _workspace(tmp_path)
async def blocked(
_context: PreparationContext,
_checks: list[CheckResult],
) -> RepairOutcome:
return RepairOutcome(
status=RepairStatus.BLOCKED,
summary="The repair requires an unavailable generated source file.",
)
result = await prepare_fix(
_request(_candidate(commit)),
workspace,
repair=blocked,
verify=_verified,
)
assert result.state is PreparationState.BLOCKED
assert result.stop_reason == "The repair requires an unavailable generated source file."
assert result.attempts == 1
@pytest.mark.asyncio
async def test_prepare_fix_runs_repair_proposed_reproduction(tmp_path: Path) -> None:
workspace, commit = _workspace(tmp_path)