From 51991547b67c47fe34c9dd8f7e336faeb2a6fc41 Mon Sep 17 00:00:00 2001 From: Zongwei9888 Date: Wed, 9 Sep 2026 17:37:59 +0800 Subject: [PATCH] test: synchronize legacy automation race before interruption --- tests/application/test_automation_goal_runs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/application/test_automation_goal_runs.py b/tests/application/test_automation_goal_runs.py index 1111d9f3..7dfd9545 100644 --- a/tests/application/test_automation_goal_runs.py +++ b/tests/application/test_automation_goal_runs.py @@ -1041,6 +1041,13 @@ def inject_unreserved_turn(*args, **kwargs): assert foreign.prompt == "A legacy client won the race" assert foreign.id != execution.run.turn_id + # Submission can return before the Agent consumes its scripted step. + # Interrupt only after that step is claimed, so the Automation receives + # the second (completing) step rather than the foreign Turn's gate. + _wait_until( + lambda: factory.started_prompts == [foreign.prompt], + "foreign Agent to consume its scripted step", + ) accepted, interrupted = application.turns.interrupt( automation.thread_id, foreign.id,