From 2f599350ec67d2a4779fa0546e78ee2d41639512 Mon Sep 17 00:00:00 2001 From: Zezhen Xu Date: Sun, 8 Nov 2026 01:06:14 +0000 Subject: [PATCH] test: wait for the retired lane to release its unit before the rebuilt writer's flush --- test/test_crew_log_writer_lanes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test_crew_log_writer_lanes.py b/test/test_crew_log_writer_lanes.py index f7aa2377d6a0..55259fb25fef 100644 --- a/test/test_crew_log_writer_lanes.py +++ b/test/test_crew_log_writer_lanes.py @@ -518,7 +518,12 @@ def advance(seconds: float) -> None: assert home.steps(unit) == [] finally: release.set() - wait_until(lambda: home.steps(unit) == [1]) + from kiro_crew.crew_log.writer_groups import PROCESS_HOLDS + + # Step 1 lands in the file BEFORE the retired lane lets the unit go (it finishes the + # batch's bookkeeping first). A flush in that window spends its whole fake-clock + # budget against a held unit and returns False, so wait for the hold itself. + wait_until(lambda: home.steps(unit) == [1] and unit not in PROCESS_HOLDS.held()) assert rebuilt.flush(timeout=default_timeout()) assert home.steps(unit) == [1, 2] assert home.max_inside_one_unit == 1