Skip to content

Commit b6c0f86

Browse files
committed
Fix assertion error when workflow initialization fails
The serialization context changes introduced an incorrect 'assert workflow' statement that would fail when workflow initialization fails (e.g., when the workflow class isn't registered). This caused tests to hang with an unhandled AssertionError. The workflow variable can legitimately be None when initialization fails, and we only need it when applying a payload codec. Changed to check for workflow existence as part of the condition for applying the codec.
1 parent 8f90a61 commit b6c0f86

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

temporalio/worker/_workflow.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,9 @@ async def _handle_activation(
354354
)
355355

356356
completion.run_id = act.run_id
357-
assert workflow
358357

359358
# Encode completion
360-
if data_converter.payload_codec:
359+
if data_converter.payload_codec and workflow:
361360
payload_codec = _CommandAwarePayloadCodec(workflow.instance)
362361
try:
363362
await temporalio.bridge.worker.encode_completion(

0 commit comments

Comments
 (0)