@@ -236,9 +236,7 @@ def __init__(self, det: WorkflowInstanceDetails) -> None:
236236 temporalio .converter .WorkflowSerializationContext (
237237 namespace = det .info .namespace ,
238238 workflow_id = det .info .workflow_id ,
239- ),
240- self ._context_free_payload_converter ,
241- self ._context_free_failure_converter ,
239+ )
242240 )
243241 )
244242
@@ -918,9 +916,12 @@ def _apply_resolve_nexus_operation_start(
918916 raise RuntimeError (
919917 f"Failed to find nexus operation handle for job sequence number { job .seq } "
920918 )
921- # We not set a serialization context for nexus operations on the caller side because it is
922- # not possible to do so on the handler side.
923- payload_converter , failure_converter = self ._converters_with_context (None )
919+ # We don't set a serialization context for nexus operations on the caller side because it's
920+ # not possible to set a matching context on the handler side.
921+ payload_converter , failure_converter = (
922+ self ._context_free_payload_converter ,
923+ self ._context_free_failure_converter ,
924+ )
924925
925926 if job .HasField ("operation_token" ):
926927 # The nexus operation started asynchronously. A `ResolveNexusOperation` job
@@ -957,7 +958,7 @@ def _apply_resolve_nexus_operation(
957958 # completed / failed, but it has already been resolved.
958959 return
959960
960- # We not set a serialization context for nexus operations on the caller side because it is
961+ # We don't set a serialization context for nexus operations on the caller side because it is
961962 # not possible to do so on the handler side.
962963 payload_converter , failure_converter = (
963964 self ._context_free_payload_converter ,
@@ -2083,25 +2084,18 @@ def _convert_payloads(
20832084
20842085 def _converters_with_context (
20852086 self ,
2086- context : Optional [temporalio .converter .SerializationContext ],
2087- base_payload_converter : Optional [temporalio .converter .PayloadConverter ] = None ,
2088- base_failure_converter : Optional [temporalio .converter .FailureConverter ] = None ,
2087+ context : temporalio .converter .SerializationContext ,
20892088 ) -> Tuple [
20902089 temporalio .converter .PayloadConverter ,
20912090 temporalio .converter .FailureConverter ,
20922091 ]:
20932092 """Construct workflow payload and failure converters with the given context."""
2094- payload_converter = base_payload_converter or self ._payload_converter
2095- failure_converter = base_failure_converter or self ._failure_converter
2096- if context :
2097- if isinstance (
2098- payload_converter , temporalio .converter .WithSerializationContext
2099- ):
2100- payload_converter = payload_converter .with_context (context )
2101- if isinstance (
2102- failure_converter , temporalio .converter .WithSerializationContext
2103- ):
2104- failure_converter = failure_converter .with_context (context )
2093+ payload_converter = self ._context_free_payload_converter
2094+ failure_converter = self ._context_free_failure_converter
2095+ if isinstance (payload_converter , temporalio .converter .WithSerializationContext ):
2096+ payload_converter = payload_converter .with_context (context )
2097+ if isinstance (failure_converter , temporalio .converter .WithSerializationContext ):
2098+ failure_converter = failure_converter .with_context (context )
21052099 return payload_converter , failure_converter
21062100
21072101 # _WorkflowInstanceImpl.get_pending_command_serialization_context
0 commit comments