diff --git a/temporalio/bridge/worker.py b/temporalio/bridge/worker.py index 73935aa35..578d3fa69 100644 --- a/temporalio/bridge/worker.py +++ b/temporalio/bridge/worker.py @@ -275,6 +275,8 @@ async def decode_activation( val.metadata.clear() val.metadata.update(new_payload.metadata) val.data = new_payload.data + elif job.HasField("do_update"): + await _decode_payloads(job.do_update.input, codec) async def encode_completion( @@ -322,3 +324,8 @@ async def encode_completion( ) for val in command.start_child_workflow_execution.memo.values(): await _encode_payload(val, codec) + elif command.HasField("update_response"): + if command.update_response.HasField("completed"): + await _encode_payload(command.update_response.completed, codec) + elif command.update_response.HasField("rejected"): + await codec.encode_failure(command.update_response.rejected) diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index cf92693ec..97ea0bb2d 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -1467,7 +1467,7 @@ async def decode(self, payloads: Sequence[Payload]) -> List[Payload]: return list(wrapper.payloads) -async def test_workflow_with_codec(client: Client): +async def test_workflow_with_codec(client: Client, env: WorkflowEnvironment): # Make client with this codec and run a couple of existing tests config = client.config() config["data_converter"] = DataConverter(payload_codec=SimpleCodec()) @@ -1475,6 +1475,7 @@ async def test_workflow_with_codec(client: Client): await test_workflow_signal_and_query(client) await test_workflow_signal_and_query_errors(client) await test_workflow_simple_activity(client) + await test_workflow_update_handlers_happy(client, env) class CustomWorkflowRunner(WorkflowRunner):