From f31e35a437a42233a708513e2bc7c055c5a48916 Mon Sep 17 00:00:00 2001 From: DABH Date: Thu, 10 Sep 2026 00:21:28 -0500 Subject: [PATCH] Pin task timeout in tests that assume a single workflow task attempt Under CI load the first workflow task of these tests occasionally takes longer than the default 10s workflow task timeout. The server then retries the task, which re-runs the workflow from scratch: the patch activation callback is consulted once per attempt (observed as 'assert 2 == 1' in test_workflow_patch_activation_callback), and after two timed-out attempts the server rejects new updates with 'Workflow Task in failed state' (observed as RPCError in test_workflow_current_update). Both are correct server/SDK behaviors, so make the single-attempt precondition explicit by setting a task timeout that cannot expire within the test's own timeout. --- tests/worker/test_workflow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index 42ba0b69c..63031c866 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -3751,6 +3751,8 @@ async def test_workflow_patch_activation_callback(client: Client): args=["my-patch", False], id=workflow_id, task_queue=worker.task_queue, + # A retried task would consult the callback again + task_timeout=timedelta(hours=1), ) assert result == [True, True] @@ -3771,6 +3773,8 @@ async def test_workflow_patch_activation_callback_can_decline(client: Client): args=["my-patch", False], id=f"workflow-{uuid.uuid4()}", task_queue=worker.task_queue, + # A retried task would consult the callback again + task_timeout=timedelta(hours=1), ) assert await handle.result() == [False, False] @@ -3806,6 +3810,8 @@ async def test_workflow_patch_activation_callback_not_recalled_on_replay( args=["my-patch", True], id=f"workflow-{uuid.uuid4()}", task_queue=worker.task_queue, + # A retried task would consult the callback again + task_timeout=timedelta(hours=1), ) assert result == [False, False] @@ -6606,6 +6612,8 @@ async def test_workflow_current_update(client: Client): CurrentUpdateWorkflow.run, id=f"wf-{uuid.uuid4()}", task_queue=worker.task_queue, + # Updates are rejected once the task has timed out twice + task_timeout=timedelta(hours=1), ) update_ids = await asyncio.gather( handle.execute_update(CurrentUpdateWorkflow.do_update, id="update1"),