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,