fix(eval): inspect worker failures without broad catch (#2785)

Preserve every completed sibling outcome, including worker BaseException cases, without directly catching BaseException.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Gergo Magyar 2026-09-03 07:54:58 +00:00
parent ace95d2715
commit 2cc27dcaa8
2 changed files with 7 additions and 6 deletions

View file

@ -727,17 +727,18 @@ def test_sweep_of_one_worker_never_leaves_the_calling_thread():
assert seen == [caller] * len(CELLS)
def test_sweep_keeps_the_rows_of_cells_that_finished_beside_a_failing_one():
@pytest.mark.parametrize("failure", [KeyError("harness bug"), SystemExit(97)])
def test_sweep_keeps_the_rows_of_cells_that_finished_beside_a_failing_one(failure):
def run(run_idx, arm):
if (run_idx, arm) == (0, "candidate_workflow"):
raise KeyError("harness bug")
raise failure
return _row()
progress = _progress()
# The failing cell's two siblings completed and spent their budget before
# the harness bug surfaced. Reading the futures in order and raising on the
# first failure would drop their rows: money spent, no evidence written.
with pytest.raises(KeyError):
with pytest.raises(type(failure)):
_sweep(CELLS, workers=3, run=run, into=progress)
assert progress.kept == [(0, "workflow"), (1, "workflow")]

View file

@ -687,10 +687,10 @@ def _run_wave(
def _settle(future: Future[dict[str, Any]]) -> CellOutcome:
"""A completed future as (record, error) — exactly one of them is set."""
try:
return future.result(), None
except BaseException as error: # noqa: BLE001 - re-raised by the caller, in order
error = future.exception()
if error is not None:
return None, error
return future.result(), None
def sweep_task_cells(