Completing a re-run failed batch un-fails the task 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-07 11:10:43 +00:00
parent 30e3054146
commit d0439dd11e

View file

@ -263,6 +263,29 @@ def test_run_subtasks_isolates_a_failing_item_and_continues(
assert harness.tasks.get(task.id).status is TaskStatus.FAILED
def test_completing_a_rerun_failed_subtask_unfails_the_task(
harness: Harness,
) -> None:
"""A failed batch is re-run by re-sending its own inputs; when the re-run
completes, the parent Task recomputes to COMPLETE (ADR-0055)."""
# arrange — two children: one failed (task FAILED), the other complete
task, failed_batch = harness.orchestrator.create_task_with_subtask(
task_source="manual:test"
)
healthy_batch = harness.orchestrator.create_child_subtask(task.id)
harness.orchestrator.complete_subtask(healthy_batch.id)
harness.orchestrator.fail_subtask(failed_batch.id, RuntimeError("boom"))
assert harness.tasks.get(task.id).status is TaskStatus.FAILED
# act — the re-run of the failed batch
harness.orchestrator.run_subtask(failed_batch.id, work=lambda: "fixed")
# assert — no failed children remain, so the task un-fails to COMPLETE
task_after = harness.tasks.get(task.id)
assert task_after.status is TaskStatus.COMPLETE
assert task_after.job_completed is not None
def test_cascade_short_circuits_once_task_already_failed(harness: Harness) -> None:
"""Once the Task is FAILED, completing another SubTask leaves it FAILED — the
terminal state is not recomputed away."""