fix: give final acceptance a shared retry budget and diagnostics

This commit is contained in:
chenmingxuan committed 2026-10-18 20:51:19 +08:00
1 parent 50638d4130
commit 32441e79c4
18 files changed
+779 -40

No files matched your search

+21 -1
View File
@@ -111,16 +111,36 @@ async def test_flash_reuses_checker_with_original_prompt_and_final_report(
@pytest.mark.asyncio
async def test_acceptance_timeout_finishes_with_unknown_verdict(tmp_path, monkeypatch):
from artemis.llm import final_review
async def hanging_check(*args, **kwargs):
await asyncio.Event().wait()
monkeypatch.setattr(flash, "run_final_check", hanging_check)
monkeypatch.setattr(final_review, "MAX_FINAL_REVIEW_SECONDS", 0.01)
data = await flash.settle_flash_outcome(
context(tmp_path, checkpoint_timeout=0.01), "任务", {"status": "completed"}
)
assert data["task_status"] == "completed"
assert data["test_result"]["status"] == "inconclusive"
assert "0.01 秒" in data["test_result"]["reason"]
assert "总预算已用尽(0.01 秒)" in data["test_result"]["reason"]
@pytest.mark.asyncio
async def test_flash_final_review_can_outlast_midway_checkpoint_timeout(tmp_path, monkeypatch):
async def slower_review(*args, **kwargs):
await asyncio.sleep(0.02)
return CheckReport(
test_result=CaseTestResult(
status="passed", reason="完整核对实际证据", evidence=["步骤 1 截图"]
)
)
monkeypatch.setattr(flash, "run_final_check", slower_review)
data = await flash.settle_flash_outcome(
context(tmp_path, checkpoint_timeout=0.001), "任务", {"status": "completed"}
)
assert data["test_result"]["status"] == "passed"
@pytest.mark.asyncio