From f861f893c41df88979a028fa1aa70ad4a7ef0817 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 8 Jun 2026 17:40:12 -0700 Subject: [PATCH] Avoid concurrent RPCs in goal cancellation test --- sdk/python/tests/test_app_server_goal_turns.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sdk/python/tests/test_app_server_goal_turns.py b/sdk/python/tests/test_app_server_goal_turns.py index 901e8ab870..7ce8f6d1fd 100644 --- a/sdk/python/tests/test_app_server_goal_turns.py +++ b/sdk/python/tests/test_app_server_goal_turns.py @@ -815,12 +815,15 @@ def test_async_goal_start_cancellation_interrupts_work_and_releases_routing(tmp_ await startup deadline = time.monotonic() + 5 + while codex._client._sync._router._goal_operations: + if time.monotonic() >= deadline: + raise AssertionError("cancelled goal routing was not released") + await asyncio.sleep(0.01) + while True: current = await thread.read() registered_goals = dict(codex._client._sync._router._goal_operations) - if isinstance(current.thread.status.root, IdleThreadStatus) and not ( - registered_goals - ): + if isinstance(current.thread.status.root, IdleThreadStatus): break if time.monotonic() >= deadline: raise AssertionError("cancelled goal turn did not stop")