From 4e90eccc8bfdad33613fe8ea0a5f33153e215075 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Thu, 29 Jan 2026 13:42:14 -0800 Subject: [PATCH 01/10] upgrade on CAN (needs test) --- .../workflow_activation_pb2.py | 104 +++++++++--------- .../workflow_activation_pb2.pyi | 17 +++ .../workflow_commands_pb2.py | 80 +++++++------- .../workflow_commands_pb2.pyi | 11 ++ temporalio/bridge/sdk-core | 2 +- temporalio/worker/_interceptor.py | 3 +- temporalio/worker/_workflow_instance.py | 10 +- temporalio/workflow.py | 52 +++++++++ 8 files changed, 184 insertions(+), 95 deletions(-) diff --git a/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.py b/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.py index 52f62ac8c..337d51735 100644 --- a/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.py +++ b/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.py @@ -44,7 +44,7 @@ ) DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\x1a#temporal/sdk/core/nexus/nexus.proto"\x94\x03\n\x12WorkflowActivation\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cis_replaying\x18\x03 \x01(\x08\x12\x16\n\x0ehistory_length\x18\x04 \x01(\r\x12@\n\x04jobs\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.WorkflowActivationJob\x12 \n\x18\x61vailable_internal_flags\x18\x06 \x03(\r\x12\x1a\n\x12history_size_bytes\x18\x07 \x01(\x04\x12!\n\x19\x63ontinue_as_new_suggested\x18\x08 \x01(\x08\x12T\n#deployment_version_for_current_task\x18\t \x01(\x0b\x32\'.coresdk.common.WorkerDeploymentVersion\x12\x18\n\x10last_sdk_version\x18\n \x01(\t"\xe0\n\n\x15WorkflowActivationJob\x12N\n\x13initialize_workflow\x18\x01 \x01(\x0b\x32/.coresdk.workflow_activation.InitializeWorkflowH\x00\x12<\n\nfire_timer\x18\x02 \x01(\x0b\x32&.coresdk.workflow_activation.FireTimerH\x00\x12K\n\x12update_random_seed\x18\x04 \x01(\x0b\x32-.coresdk.workflow_activation.UpdateRandomSeedH\x00\x12\x44\n\x0equery_workflow\x18\x05 \x01(\x0b\x32*.coresdk.workflow_activation.QueryWorkflowH\x00\x12\x46\n\x0f\x63\x61ncel_workflow\x18\x06 \x01(\x0b\x32+.coresdk.workflow_activation.CancelWorkflowH\x00\x12\x46\n\x0fsignal_workflow\x18\x07 \x01(\x0b\x32+.coresdk.workflow_activation.SignalWorkflowH\x00\x12H\n\x10resolve_activity\x18\x08 \x01(\x0b\x32,.coresdk.workflow_activation.ResolveActivityH\x00\x12G\n\x10notify_has_patch\x18\t \x01(\x0b\x32+.coresdk.workflow_activation.NotifyHasPatchH\x00\x12q\n&resolve_child_workflow_execution_start\x18\n \x01(\x0b\x32?.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartH\x00\x12\x66\n resolve_child_workflow_execution\x18\x0b \x01(\x0b\x32:.coresdk.workflow_activation.ResolveChildWorkflowExecutionH\x00\x12\x66\n resolve_signal_external_workflow\x18\x0c \x01(\x0b\x32:.coresdk.workflow_activation.ResolveSignalExternalWorkflowH\x00\x12u\n(resolve_request_cancel_external_workflow\x18\r \x01(\x0b\x32\x41.coresdk.workflow_activation.ResolveRequestCancelExternalWorkflowH\x00\x12:\n\tdo_update\x18\x0e \x01(\x0b\x32%.coresdk.workflow_activation.DoUpdateH\x00\x12`\n\x1dresolve_nexus_operation_start\x18\x0f \x01(\x0b\x32\x37.coresdk.workflow_activation.ResolveNexusOperationStartH\x00\x12U\n\x17resolve_nexus_operation\x18\x10 \x01(\x0b\x32\x32.coresdk.workflow_activation.ResolveNexusOperationH\x00\x12I\n\x11remove_from_cache\x18\x32 \x01(\x0b\x32,.coresdk.workflow_activation.RemoveFromCacheH\x00\x42\t\n\x07variant"\xd9\n\n\x12InitializeWorkflow\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x17\n\x0frandomness_seed\x18\x04 \x01(\x04\x12M\n\x07headers\x18\x05 \x03(\x0b\x32<.coresdk.workflow_activation.InitializeWorkflow.HeadersEntry\x12\x10\n\x08identity\x18\x06 \x01(\t\x12I\n\x14parent_workflow_info\x18\x07 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12=\n\x1aworkflow_execution_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\'\n\x1f\x63ontinued_from_execution_run_id\x18\x0b \x01(\t\x12J\n\x13\x63ontinued_initiator\x18\x0c \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\r \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1e\n\x16\x66irst_execution_run_id\x18\x0f \x01(\t\x12\x39\n\x0cretry_policy\x18\x10 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x11 \x01(\x05\x12\x15\n\rcron_schedule\x18\x12 \x01(\t\x12\x46\n"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n"cron_schedule_to_schedule_interval\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x15 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x16 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\nstart_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\rroot_workflow\x18\x18 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x32\n\x08priority\x18\x19 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x18\n\tFireTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r"m\n\x0fResolveActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.activity_result.ActivityResolution\x12\x10\n\x08is_local\x18\x03 \x01(\x08"\xd1\x02\n"ResolveChildWorkflowExecutionStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12[\n\tsucceeded\x18\x02 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartSuccessH\x00\x12X\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartFailureH\x00\x12]\n\tcancelled\x18\x04 \x01(\x0b\x32H.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelledH\x00\x42\x08\n\x06status";\n)ResolveChildWorkflowExecutionStartSuccess\x12\x0e\n\x06run_id\x18\x01 \x01(\t"\xa6\x01\n)ResolveChildWorkflowExecutionStartFailure\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x15\n\rworkflow_type\x18\x02 \x01(\t\x12M\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32>.coresdk.child_workflow.StartChildWorkflowExecutionFailedCause"`\n+ResolveChildWorkflowExecutionStartCancelled\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"i\n\x1dResolveChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.child_workflow.ChildWorkflowResult"+\n\x10UpdateRandomSeed\x12\x17\n\x0frandomness_seed\x18\x01 \x01(\x04"\x84\x02\n\rQueryWorkflow\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12\x12\n\nquery_type\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12H\n\x07headers\x18\x05 \x03(\x0b\x32\x37.coresdk.workflow_activation.QueryWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01" \n\x0e\x43\x61ncelWorkflow\x12\x0e\n\x06reason\x18\x01 \x01(\t"\x83\x02\n\x0eSignalWorkflow\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12.\n\x05input\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x10\n\x08identity\x18\x03 \x01(\t\x12I\n\x07headers\x18\x05 \x03(\x0b\x32\x38.coresdk.workflow_activation.SignalWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01""\n\x0eNotifyHasPatch\x12\x10\n\x08patch_id\x18\x01 \x01(\t"_\n\x1dResolveSignalExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"f\n$ResolveRequestCancelExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xcb\x02\n\x08\x44oUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1c\n\x14protocol_instance_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x43\n\x07headers\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.DoUpdate.HeadersEntry\x12*\n\x04meta\x18\x06 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x15\n\rrun_validator\x18\x07 \x01(\x08\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x9a\x01\n\x1aResolveNexusOperationStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x19\n\x0foperation_token\x18\x02 \x01(\tH\x00\x12\x16\n\x0cstarted_sync\x18\x03 \x01(\x08H\x00\x12\x32\n\x06\x66\x61iled\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\x08\n\x06status"Y\n\x15ResolveNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x33\n\x06result\x18\x02 \x01(\x0b\x32#.coresdk.nexus.NexusOperationResult"\xe0\x02\n\x0fRemoveFromCache\x12\x0f\n\x07message\x18\x01 \x01(\t\x12K\n\x06reason\x18\x02 \x01(\x0e\x32;.coresdk.workflow_activation.RemoveFromCache.EvictionReason"\xee\x01\n\x0e\x45victionReason\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nCACHE_FULL\x10\x01\x12\x0e\n\nCACHE_MISS\x10\x02\x12\x12\n\x0eNONDETERMINISM\x10\x03\x12\r\n\tLANG_FAIL\x10\x04\x12\x12\n\x0eLANG_REQUESTED\x10\x05\x12\x12\n\x0eTASK_NOT_FOUND\x10\x06\x12\x15\n\x11UNHANDLED_COMMAND\x10\x07\x12\t\n\x05\x46\x41TAL\x10\x08\x12\x1f\n\x1bPAGINATION_OR_HISTORY_FETCH\x10\t\x12\x1d\n\x19WORKFLOW_EXECUTION_ENDING\x10\nB8\xea\x02\x35Temporalio::Internal::Bridge::Api::WorkflowActivationb\x06proto3' + b'\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\x1a#temporal/sdk/core/nexus/nexus.proto"\xf0\x03\n\x12WorkflowActivation\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cis_replaying\x18\x03 \x01(\x08\x12\x16\n\x0ehistory_length\x18\x04 \x01(\r\x12@\n\x04jobs\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.WorkflowActivationJob\x12 \n\x18\x61vailable_internal_flags\x18\x06 \x03(\r\x12\x1a\n\x12history_size_bytes\x18\x07 \x01(\x04\x12!\n\x19\x63ontinue_as_new_suggested\x18\x08 \x01(\x08\x12T\n#deployment_version_for_current_task\x18\t \x01(\x0b\x32\'.coresdk.common.WorkerDeploymentVersion\x12\x18\n\x10last_sdk_version\x18\n \x01(\t\x12Z\n\x1fsuggest_continue_as_new_reasons\x18\x0b \x03(\x0e\x32\x31.temporal.api.enums.v1.SuggestContinueAsNewReason"\xe0\n\n\x15WorkflowActivationJob\x12N\n\x13initialize_workflow\x18\x01 \x01(\x0b\x32/.coresdk.workflow_activation.InitializeWorkflowH\x00\x12<\n\nfire_timer\x18\x02 \x01(\x0b\x32&.coresdk.workflow_activation.FireTimerH\x00\x12K\n\x12update_random_seed\x18\x04 \x01(\x0b\x32-.coresdk.workflow_activation.UpdateRandomSeedH\x00\x12\x44\n\x0equery_workflow\x18\x05 \x01(\x0b\x32*.coresdk.workflow_activation.QueryWorkflowH\x00\x12\x46\n\x0f\x63\x61ncel_workflow\x18\x06 \x01(\x0b\x32+.coresdk.workflow_activation.CancelWorkflowH\x00\x12\x46\n\x0fsignal_workflow\x18\x07 \x01(\x0b\x32+.coresdk.workflow_activation.SignalWorkflowH\x00\x12H\n\x10resolve_activity\x18\x08 \x01(\x0b\x32,.coresdk.workflow_activation.ResolveActivityH\x00\x12G\n\x10notify_has_patch\x18\t \x01(\x0b\x32+.coresdk.workflow_activation.NotifyHasPatchH\x00\x12q\n&resolve_child_workflow_execution_start\x18\n \x01(\x0b\x32?.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartH\x00\x12\x66\n resolve_child_workflow_execution\x18\x0b \x01(\x0b\x32:.coresdk.workflow_activation.ResolveChildWorkflowExecutionH\x00\x12\x66\n resolve_signal_external_workflow\x18\x0c \x01(\x0b\x32:.coresdk.workflow_activation.ResolveSignalExternalWorkflowH\x00\x12u\n(resolve_request_cancel_external_workflow\x18\r \x01(\x0b\x32\x41.coresdk.workflow_activation.ResolveRequestCancelExternalWorkflowH\x00\x12:\n\tdo_update\x18\x0e \x01(\x0b\x32%.coresdk.workflow_activation.DoUpdateH\x00\x12`\n\x1dresolve_nexus_operation_start\x18\x0f \x01(\x0b\x32\x37.coresdk.workflow_activation.ResolveNexusOperationStartH\x00\x12U\n\x17resolve_nexus_operation\x18\x10 \x01(\x0b\x32\x32.coresdk.workflow_activation.ResolveNexusOperationH\x00\x12I\n\x11remove_from_cache\x18\x32 \x01(\x0b\x32,.coresdk.workflow_activation.RemoveFromCacheH\x00\x42\t\n\x07variant"\xd9\n\n\x12InitializeWorkflow\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x17\n\x0frandomness_seed\x18\x04 \x01(\x04\x12M\n\x07headers\x18\x05 \x03(\x0b\x32<.coresdk.workflow_activation.InitializeWorkflow.HeadersEntry\x12\x10\n\x08identity\x18\x06 \x01(\t\x12I\n\x14parent_workflow_info\x18\x07 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12=\n\x1aworkflow_execution_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\'\n\x1f\x63ontinued_from_execution_run_id\x18\x0b \x01(\t\x12J\n\x13\x63ontinued_initiator\x18\x0c \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\r \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1e\n\x16\x66irst_execution_run_id\x18\x0f \x01(\t\x12\x39\n\x0cretry_policy\x18\x10 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x11 \x01(\x05\x12\x15\n\rcron_schedule\x18\x12 \x01(\t\x12\x46\n"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n"cron_schedule_to_schedule_interval\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x15 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x16 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\nstart_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\rroot_workflow\x18\x18 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x32\n\x08priority\x18\x19 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x18\n\tFireTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r"m\n\x0fResolveActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.activity_result.ActivityResolution\x12\x10\n\x08is_local\x18\x03 \x01(\x08"\xd1\x02\n"ResolveChildWorkflowExecutionStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12[\n\tsucceeded\x18\x02 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartSuccessH\x00\x12X\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartFailureH\x00\x12]\n\tcancelled\x18\x04 \x01(\x0b\x32H.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelledH\x00\x42\x08\n\x06status";\n)ResolveChildWorkflowExecutionStartSuccess\x12\x0e\n\x06run_id\x18\x01 \x01(\t"\xa6\x01\n)ResolveChildWorkflowExecutionStartFailure\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x15\n\rworkflow_type\x18\x02 \x01(\t\x12M\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32>.coresdk.child_workflow.StartChildWorkflowExecutionFailedCause"`\n+ResolveChildWorkflowExecutionStartCancelled\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"i\n\x1dResolveChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.child_workflow.ChildWorkflowResult"+\n\x10UpdateRandomSeed\x12\x17\n\x0frandomness_seed\x18\x01 \x01(\x04"\x84\x02\n\rQueryWorkflow\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12\x12\n\nquery_type\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12H\n\x07headers\x18\x05 \x03(\x0b\x32\x37.coresdk.workflow_activation.QueryWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01" \n\x0e\x43\x61ncelWorkflow\x12\x0e\n\x06reason\x18\x01 \x01(\t"\x83\x02\n\x0eSignalWorkflow\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12.\n\x05input\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x10\n\x08identity\x18\x03 \x01(\t\x12I\n\x07headers\x18\x05 \x03(\x0b\x32\x38.coresdk.workflow_activation.SignalWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01""\n\x0eNotifyHasPatch\x12\x10\n\x08patch_id\x18\x01 \x01(\t"_\n\x1dResolveSignalExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"f\n$ResolveRequestCancelExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xcb\x02\n\x08\x44oUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1c\n\x14protocol_instance_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x43\n\x07headers\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.DoUpdate.HeadersEntry\x12*\n\x04meta\x18\x06 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x15\n\rrun_validator\x18\x07 \x01(\x08\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x9a\x01\n\x1aResolveNexusOperationStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x19\n\x0foperation_token\x18\x02 \x01(\tH\x00\x12\x16\n\x0cstarted_sync\x18\x03 \x01(\x08H\x00\x12\x32\n\x06\x66\x61iled\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\x08\n\x06status"Y\n\x15ResolveNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x33\n\x06result\x18\x02 \x01(\x0b\x32#.coresdk.nexus.NexusOperationResult"\xe0\x02\n\x0fRemoveFromCache\x12\x0f\n\x07message\x18\x01 \x01(\t\x12K\n\x06reason\x18\x02 \x01(\x0e\x32;.coresdk.workflow_activation.RemoveFromCache.EvictionReason"\xee\x01\n\x0e\x45victionReason\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nCACHE_FULL\x10\x01\x12\x0e\n\nCACHE_MISS\x10\x02\x12\x12\n\x0eNONDETERMINISM\x10\x03\x12\r\n\tLANG_FAIL\x10\x04\x12\x12\n\x0eLANG_REQUESTED\x10\x05\x12\x12\n\x0eTASK_NOT_FOUND\x10\x06\x12\x15\n\x11UNHANDLED_COMMAND\x10\x07\x12\t\n\x05\x46\x41TAL\x10\x08\x12\x1f\n\x1bPAGINATION_OR_HISTORY_FETCH\x10\t\x12\x1d\n\x19WORKFLOW_EXECUTION_ENDING\x10\nB8\xea\x02\x35Temporalio::Internal::Bridge::Api::WorkflowActivationb\x06proto3' ) @@ -377,55 +377,55 @@ _DOUPDATE_HEADERSENTRY._options = None _DOUPDATE_HEADERSENTRY._serialized_options = b"8\001" _WORKFLOWACTIVATION._serialized_start = 532 - _WORKFLOWACTIVATION._serialized_end = 936 - _WORKFLOWACTIVATIONJOB._serialized_start = 939 - _WORKFLOWACTIVATIONJOB._serialized_end = 2315 - _INITIALIZEWORKFLOW._serialized_start = 2318 - _INITIALIZEWORKFLOW._serialized_end = 3687 - _INITIALIZEWORKFLOW_HEADERSENTRY._serialized_start = 3608 - _INITIALIZEWORKFLOW_HEADERSENTRY._serialized_end = 3687 - _FIRETIMER._serialized_start = 3689 - _FIRETIMER._serialized_end = 3713 - _RESOLVEACTIVITY._serialized_start = 3715 - _RESOLVEACTIVITY._serialized_end = 3824 - _RESOLVECHILDWORKFLOWEXECUTIONSTART._serialized_start = 3827 - _RESOLVECHILDWORKFLOWEXECUTIONSTART._serialized_end = 4164 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTSUCCESS._serialized_start = 4166 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTSUCCESS._serialized_end = 4225 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTFAILURE._serialized_start = 4228 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTFAILURE._serialized_end = 4394 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTCANCELLED._serialized_start = 4396 - _RESOLVECHILDWORKFLOWEXECUTIONSTARTCANCELLED._serialized_end = 4492 - _RESOLVECHILDWORKFLOWEXECUTION._serialized_start = 4494 - _RESOLVECHILDWORKFLOWEXECUTION._serialized_end = 4599 - _UPDATERANDOMSEED._serialized_start = 4601 - _UPDATERANDOMSEED._serialized_end = 4644 - _QUERYWORKFLOW._serialized_start = 4647 - _QUERYWORKFLOW._serialized_end = 4907 - _QUERYWORKFLOW_HEADERSENTRY._serialized_start = 3608 - _QUERYWORKFLOW_HEADERSENTRY._serialized_end = 3687 - _CANCELWORKFLOW._serialized_start = 4909 - _CANCELWORKFLOW._serialized_end = 4941 - _SIGNALWORKFLOW._serialized_start = 4944 - _SIGNALWORKFLOW._serialized_end = 5203 - _SIGNALWORKFLOW_HEADERSENTRY._serialized_start = 3608 - _SIGNALWORKFLOW_HEADERSENTRY._serialized_end = 3687 - _NOTIFYHASPATCH._serialized_start = 5205 - _NOTIFYHASPATCH._serialized_end = 5239 - _RESOLVESIGNALEXTERNALWORKFLOW._serialized_start = 5241 - _RESOLVESIGNALEXTERNALWORKFLOW._serialized_end = 5336 - _RESOLVEREQUESTCANCELEXTERNALWORKFLOW._serialized_start = 5338 - _RESOLVEREQUESTCANCELEXTERNALWORKFLOW._serialized_end = 5440 - _DOUPDATE._serialized_start = 5443 - _DOUPDATE._serialized_end = 5774 - _DOUPDATE_HEADERSENTRY._serialized_start = 3608 - _DOUPDATE_HEADERSENTRY._serialized_end = 3687 - _RESOLVENEXUSOPERATIONSTART._serialized_start = 5777 - _RESOLVENEXUSOPERATIONSTART._serialized_end = 5931 - _RESOLVENEXUSOPERATION._serialized_start = 5933 - _RESOLVENEXUSOPERATION._serialized_end = 6022 - _REMOVEFROMCACHE._serialized_start = 6025 - _REMOVEFROMCACHE._serialized_end = 6377 - _REMOVEFROMCACHE_EVICTIONREASON._serialized_start = 6139 - _REMOVEFROMCACHE_EVICTIONREASON._serialized_end = 6377 + _WORKFLOWACTIVATION._serialized_end = 1028 + _WORKFLOWACTIVATIONJOB._serialized_start = 1031 + _WORKFLOWACTIVATIONJOB._serialized_end = 2407 + _INITIALIZEWORKFLOW._serialized_start = 2410 + _INITIALIZEWORKFLOW._serialized_end = 3779 + _INITIALIZEWORKFLOW_HEADERSENTRY._serialized_start = 3700 + _INITIALIZEWORKFLOW_HEADERSENTRY._serialized_end = 3779 + _FIRETIMER._serialized_start = 3781 + _FIRETIMER._serialized_end = 3805 + _RESOLVEACTIVITY._serialized_start = 3807 + _RESOLVEACTIVITY._serialized_end = 3916 + _RESOLVECHILDWORKFLOWEXECUTIONSTART._serialized_start = 3919 + _RESOLVECHILDWORKFLOWEXECUTIONSTART._serialized_end = 4256 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTSUCCESS._serialized_start = 4258 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTSUCCESS._serialized_end = 4317 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTFAILURE._serialized_start = 4320 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTFAILURE._serialized_end = 4486 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTCANCELLED._serialized_start = 4488 + _RESOLVECHILDWORKFLOWEXECUTIONSTARTCANCELLED._serialized_end = 4584 + _RESOLVECHILDWORKFLOWEXECUTION._serialized_start = 4586 + _RESOLVECHILDWORKFLOWEXECUTION._serialized_end = 4691 + _UPDATERANDOMSEED._serialized_start = 4693 + _UPDATERANDOMSEED._serialized_end = 4736 + _QUERYWORKFLOW._serialized_start = 4739 + _QUERYWORKFLOW._serialized_end = 4999 + _QUERYWORKFLOW_HEADERSENTRY._serialized_start = 3700 + _QUERYWORKFLOW_HEADERSENTRY._serialized_end = 3779 + _CANCELWORKFLOW._serialized_start = 5001 + _CANCELWORKFLOW._serialized_end = 5033 + _SIGNALWORKFLOW._serialized_start = 5036 + _SIGNALWORKFLOW._serialized_end = 5295 + _SIGNALWORKFLOW_HEADERSENTRY._serialized_start = 3700 + _SIGNALWORKFLOW_HEADERSENTRY._serialized_end = 3779 + _NOTIFYHASPATCH._serialized_start = 5297 + _NOTIFYHASPATCH._serialized_end = 5331 + _RESOLVESIGNALEXTERNALWORKFLOW._serialized_start = 5333 + _RESOLVESIGNALEXTERNALWORKFLOW._serialized_end = 5428 + _RESOLVEREQUESTCANCELEXTERNALWORKFLOW._serialized_start = 5430 + _RESOLVEREQUESTCANCELEXTERNALWORKFLOW._serialized_end = 5532 + _DOUPDATE._serialized_start = 5535 + _DOUPDATE._serialized_end = 5866 + _DOUPDATE_HEADERSENTRY._serialized_start = 3700 + _DOUPDATE_HEADERSENTRY._serialized_end = 3779 + _RESOLVENEXUSOPERATIONSTART._serialized_start = 5869 + _RESOLVENEXUSOPERATIONSTART._serialized_end = 6023 + _RESOLVENEXUSOPERATION._serialized_start = 6025 + _RESOLVENEXUSOPERATION._serialized_end = 6114 + _REMOVEFROMCACHE._serialized_start = 6117 + _REMOVEFROMCACHE._serialized_end = 6469 + _REMOVEFROMCACHE_EVICTIONREASON._serialized_start = 6231 + _REMOVEFROMCACHE_EVICTIONREASON._serialized_end = 6469 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.pyi b/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.pyi index 0c0c54733..d38346d77 100644 --- a/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.pyi +++ b/temporalio/bridge/proto/workflow_activation/workflow_activation_pb2.pyi @@ -93,6 +93,7 @@ class WorkflowActivation(google.protobuf.message.Message): CONTINUE_AS_NEW_SUGGESTED_FIELD_NUMBER: builtins.int DEPLOYMENT_VERSION_FOR_CURRENT_TASK_FIELD_NUMBER: builtins.int LAST_SDK_VERSION_FIELD_NUMBER: builtins.int + SUGGEST_CONTINUE_AS_NEW_REASONS_FIELD_NUMBER: builtins.int run_id: builtins.str """The id of the currently active run of the workflow. Also used as a cache key. There may only ever be one active workflow task (and hence activation) of a run at one time. @@ -139,6 +140,16 @@ class WorkflowActivation(google.protobuf.message.Message): """ last_sdk_version: builtins.str """The last seen SDK version from the most recent WFT completed event""" + @property + def suggest_continue_as_new_reasons( + self, + ) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[ + temporalio.api.enums.v1.workflow_pb2.SuggestContinueAsNewReason.ValueType + ]: + """Experimental. Optionally decide the versioning behavior that the first task of the new run should use. + For example, choose to AutoUpgrade on continue-as-new instead of inheriting the pinned version + of the previous run. + """ def __init__( self, *, @@ -153,6 +164,10 @@ class WorkflowActivation(google.protobuf.message.Message): deployment_version_for_current_task: temporalio.bridge.proto.common.common_pb2.WorkerDeploymentVersion | None = ..., last_sdk_version: builtins.str = ..., + suggest_continue_as_new_reasons: collections.abc.Iterable[ + temporalio.api.enums.v1.workflow_pb2.SuggestContinueAsNewReason.ValueType + ] + | None = ..., ) -> None: ... def HasField( self, @@ -184,6 +199,8 @@ class WorkflowActivation(google.protobuf.message.Message): b"last_sdk_version", "run_id", b"run_id", + "suggest_continue_as_new_reasons", + b"suggest_continue_as_new_reasons", "timestamp", b"timestamp", ], diff --git a/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.py b/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.py index 6176f33a7..31d5dbd5e 100644 --- a/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.py +++ b/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.py @@ -42,7 +42,7 @@ ) DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n;temporal/sdk/core/workflow_commands/workflow_commands.proto\x12\x19\x63oresdk.workflow_commands\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a#temporal/sdk/core/nexus/nexus.proto\x1a%temporal/sdk/core/common/common.proto"\xe5\x0f\n\x0fWorkflowCommand\x12\x38\n\ruser_metadata\x18\x64 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12<\n\x0bstart_timer\x18\x01 \x01(\x0b\x32%.coresdk.workflow_commands.StartTimerH\x00\x12H\n\x11schedule_activity\x18\x02 \x01(\x0b\x32+.coresdk.workflow_commands.ScheduleActivityH\x00\x12\x42\n\x10respond_to_query\x18\x03 \x01(\x0b\x32&.coresdk.workflow_commands.QueryResultH\x00\x12S\n\x17request_cancel_activity\x18\x04 \x01(\x0b\x32\x30.coresdk.workflow_commands.RequestCancelActivityH\x00\x12>\n\x0c\x63\x61ncel_timer\x18\x05 \x01(\x0b\x32&.coresdk.workflow_commands.CancelTimerH\x00\x12[\n\x1b\x63omplete_workflow_execution\x18\x06 \x01(\x0b\x32\x34.coresdk.workflow_commands.CompleteWorkflowExecutionH\x00\x12S\n\x17\x66\x61il_workflow_execution\x18\x07 \x01(\x0b\x32\x30.coresdk.workflow_commands.FailWorkflowExecutionH\x00\x12g\n"continue_as_new_workflow_execution\x18\x08 \x01(\x0b\x32\x39.coresdk.workflow_commands.ContinueAsNewWorkflowExecutionH\x00\x12W\n\x19\x63\x61ncel_workflow_execution\x18\t \x01(\x0b\x32\x32.coresdk.workflow_commands.CancelWorkflowExecutionH\x00\x12\x45\n\x10set_patch_marker\x18\n \x01(\x0b\x32).coresdk.workflow_commands.SetPatchMarkerH\x00\x12`\n\x1estart_child_workflow_execution\x18\x0b \x01(\x0b\x32\x36.coresdk.workflow_commands.StartChildWorkflowExecutionH\x00\x12\x62\n\x1f\x63\x61ncel_child_workflow_execution\x18\x0c \x01(\x0b\x32\x37.coresdk.workflow_commands.CancelChildWorkflowExecutionH\x00\x12w\n*request_cancel_external_workflow_execution\x18\r \x01(\x0b\x32\x41.coresdk.workflow_commands.RequestCancelExternalWorkflowExecutionH\x00\x12h\n"signal_external_workflow_execution\x18\x0e \x01(\x0b\x32:.coresdk.workflow_commands.SignalExternalWorkflowExecutionH\x00\x12Q\n\x16\x63\x61ncel_signal_workflow\x18\x0f \x01(\x0b\x32/.coresdk.workflow_commands.CancelSignalWorkflowH\x00\x12S\n\x17schedule_local_activity\x18\x10 \x01(\x0b\x32\x30.coresdk.workflow_commands.ScheduleLocalActivityH\x00\x12^\n\x1drequest_cancel_local_activity\x18\x11 \x01(\x0b\x32\x35.coresdk.workflow_commands.RequestCancelLocalActivityH\x00\x12\x66\n!upsert_workflow_search_attributes\x18\x12 \x01(\x0b\x32\x39.coresdk.workflow_commands.UpsertWorkflowSearchAttributesH\x00\x12Y\n\x1amodify_workflow_properties\x18\x13 \x01(\x0b\x32\x33.coresdk.workflow_commands.ModifyWorkflowPropertiesH\x00\x12\x44\n\x0fupdate_response\x18\x14 \x01(\x0b\x32).coresdk.workflow_commands.UpdateResponseH\x00\x12U\n\x18schedule_nexus_operation\x18\x15 \x01(\x0b\x32\x31.coresdk.workflow_commands.ScheduleNexusOperationH\x00\x12`\n\x1erequest_cancel_nexus_operation\x18\x16 \x01(\x0b\x32\x36.coresdk.workflow_commands.RequestCancelNexusOperationH\x00\x42\t\n\x07variant"S\n\nStartTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x1a\n\x0b\x43\x61ncelTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r"\xb8\x06\n\x10ScheduleActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x15\n\ractivity_type\x18\x03 \x01(\t\x12\x12\n\ntask_queue\x18\x05 \x01(\t\x12I\n\x07headers\x18\x06 \x03(\x0b\x32\x38.coresdk.workflow_commands.ScheduleActivity.HeadersEntry\x12\x32\n\targuments\x18\x07 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12N\n\x11\x63\x61ncellation_type\x18\r \x01(\x0e\x32\x33.coresdk.workflow_commands.ActivityCancellationType\x12\x1e\n\x16\x64o_not_eagerly_execute\x18\x0e \x01(\x08\x12;\n\x11versioning_intent\x18\x0f \x01(\x0e\x32 .coresdk.common.VersioningIntent\x12\x32\n\x08priority\x18\x10 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\xee\x05\n\x15ScheduleLocalActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x15\n\ractivity_type\x18\x03 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x04 \x01(\r\x12:\n\x16original_schedule_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12N\n\x07headers\x18\x06 \x03(\x0b\x32=.coresdk.workflow_commands.ScheduleLocalActivity.HeadersEntry\x12\x32\n\targuments\x18\x07 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x38\n\x15local_retry_threshold\x18\x0c \x01(\x0b\x32\x19.google.protobuf.Duration\x12N\n\x11\x63\x61ncellation_type\x18\r \x01(\x0e\x32\x33.coresdk.workflow_commands.ActivityCancellationType\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"$\n\x15RequestCancelActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r")\n\x1aRequestCancelLocalActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r"\x9c\x01\n\x0bQueryResult\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12<\n\tsucceeded\x18\x02 \x01(\x0b\x32\'.coresdk.workflow_commands.QuerySuccessH\x00\x12\x32\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\t\n\x07variant"A\n\x0cQuerySuccess\x12\x31\n\x08response\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload"L\n\x19\x43ompleteWorkflowExecution\x12/\n\x06result\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload"J\n\x15\x46\x61ilWorkflowExecution\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xfb\x06\n\x1e\x43ontinueAsNewWorkflowExecution\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x37\n\x14workflow_run_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12Q\n\x04memo\x18\x06 \x03(\x0b\x32\x43.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.MemoEntry\x12W\n\x07headers\x18\x07 \x03(\x0b\x32\x46.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.HeadersEntry\x12j\n\x11search_attributes\x18\x08 \x03(\x0b\x32O.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.SearchAttributesEntry\x12\x39\n\x0cretry_policy\x18\t \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12;\n\x11versioning_intent\x18\n \x01(\x0e\x32 .coresdk.common.VersioningIntent\x1aL\n\tMemoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x19\n\x17\x43\x61ncelWorkflowExecution"6\n\x0eSetPatchMarker\x12\x10\n\x08patch_id\x18\x01 \x01(\t\x12\x12\n\ndeprecated\x18\x02 \x01(\x08"\x94\n\n\x1bStartChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x03 \x01(\t\x12\x15\n\rworkflow_type\x18\x04 \x01(\t\x12\x12\n\ntask_queue\x18\x05 \x01(\t\x12.\n\x05input\x18\x06 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12=\n\x1aworkflow_execution_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x46\n\x13parent_close_policy\x18\n \x01(\x0e\x32).coresdk.child_workflow.ParentClosePolicy\x12N\n\x18workflow_id_reuse_policy\x18\x0c \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\r \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x0e \x01(\t\x12T\n\x07headers\x18\x0f \x03(\x0b\x32\x43.coresdk.workflow_commands.StartChildWorkflowExecution.HeadersEntry\x12N\n\x04memo\x18\x10 \x03(\x0b\x32@.coresdk.workflow_commands.StartChildWorkflowExecution.MemoEntry\x12g\n\x11search_attributes\x18\x11 \x03(\x0b\x32L.coresdk.workflow_commands.StartChildWorkflowExecution.SearchAttributesEntry\x12P\n\x11\x63\x61ncellation_type\x18\x12 \x01(\x0e\x32\x35.coresdk.child_workflow.ChildWorkflowCancellationType\x12;\n\x11versioning_intent\x18\x13 \x01(\x0e\x32 .coresdk.common.VersioningIntent\x12\x32\n\x08priority\x18\x14 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aL\n\tMemoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"J\n\x1c\x43\x61ncelChildWorkflowExecution\x12\x1a\n\x12\x63hild_workflow_seq\x18\x01 \x01(\r\x12\x0e\n\x06reason\x18\x02 \x01(\t"\x8e\x01\n&RequestCancelExternalWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12G\n\x12workflow_execution\x18\x02 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t"\x8f\x03\n\x1fSignalExternalWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12I\n\x12workflow_execution\x18\x02 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecutionH\x00\x12\x1b\n\x11\x63hild_workflow_id\x18\x03 \x01(\tH\x00\x12\x13\n\x0bsignal_name\x18\x04 \x01(\t\x12-\n\x04\x61rgs\x18\x05 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12X\n\x07headers\x18\x06 \x03(\x0b\x32G.coresdk.workflow_commands.SignalExternalWorkflowExecution.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x42\x08\n\x06target"#\n\x14\x43\x61ncelSignalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r"\xe6\x01\n\x1eUpsertWorkflowSearchAttributes\x12j\n\x11search_attributes\x18\x01 \x03(\x0b\x32O.coresdk.workflow_commands.UpsertWorkflowSearchAttributes.SearchAttributesEntry\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"O\n\x18ModifyWorkflowProperties\x12\x33\n\rupserted_memo\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xd2\x01\n\x0eUpdateResponse\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12*\n\x08\x61\x63\x63\x65pted\x18\x02 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00\x12\x34\n\x08rejected\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x34\n\tcompleted\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x42\n\n\x08response"\x9a\x04\n\x16ScheduleNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07service\x18\x03 \x01(\t\x12\x11\n\toperation\x18\x04 \x01(\t\x12.\n\x05input\x18\x05 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12X\n\x0cnexus_header\x18\x07 \x03(\x0b\x32\x42.coresdk.workflow_commands.ScheduleNexusOperation.NexusHeaderEntry\x12H\n\x11\x63\x61ncellation_type\x18\x08 \x01(\x0e\x32-.coresdk.nexus.NexusOperationCancellationType\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"*\n\x1bRequestCancelNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r*X\n\x18\x41\x63tivityCancellationType\x12\x0e\n\nTRY_CANCEL\x10\x00\x12\x1f\n\x1bWAIT_CANCELLATION_COMPLETED\x10\x01\x12\x0b\n\x07\x41\x42\x41NDON\x10\x02\x42\x36\xea\x02\x33Temporalio::Internal::Bridge::Api::WorkflowCommandsb\x06proto3' + b'\n;temporal/sdk/core/workflow_commands/workflow_commands.proto\x12\x19\x63oresdk.workflow_commands\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a%temporal/api/failure/v1/message.proto\x1a\'temporal/api/sdk/v1/user_metadata.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a#temporal/sdk/core/nexus/nexus.proto\x1a%temporal/sdk/core/common/common.proto"\xe5\x0f\n\x0fWorkflowCommand\x12\x38\n\ruser_metadata\x18\x64 \x01(\x0b\x32!.temporal.api.sdk.v1.UserMetadata\x12<\n\x0bstart_timer\x18\x01 \x01(\x0b\x32%.coresdk.workflow_commands.StartTimerH\x00\x12H\n\x11schedule_activity\x18\x02 \x01(\x0b\x32+.coresdk.workflow_commands.ScheduleActivityH\x00\x12\x42\n\x10respond_to_query\x18\x03 \x01(\x0b\x32&.coresdk.workflow_commands.QueryResultH\x00\x12S\n\x17request_cancel_activity\x18\x04 \x01(\x0b\x32\x30.coresdk.workflow_commands.RequestCancelActivityH\x00\x12>\n\x0c\x63\x61ncel_timer\x18\x05 \x01(\x0b\x32&.coresdk.workflow_commands.CancelTimerH\x00\x12[\n\x1b\x63omplete_workflow_execution\x18\x06 \x01(\x0b\x32\x34.coresdk.workflow_commands.CompleteWorkflowExecutionH\x00\x12S\n\x17\x66\x61il_workflow_execution\x18\x07 \x01(\x0b\x32\x30.coresdk.workflow_commands.FailWorkflowExecutionH\x00\x12g\n"continue_as_new_workflow_execution\x18\x08 \x01(\x0b\x32\x39.coresdk.workflow_commands.ContinueAsNewWorkflowExecutionH\x00\x12W\n\x19\x63\x61ncel_workflow_execution\x18\t \x01(\x0b\x32\x32.coresdk.workflow_commands.CancelWorkflowExecutionH\x00\x12\x45\n\x10set_patch_marker\x18\n \x01(\x0b\x32).coresdk.workflow_commands.SetPatchMarkerH\x00\x12`\n\x1estart_child_workflow_execution\x18\x0b \x01(\x0b\x32\x36.coresdk.workflow_commands.StartChildWorkflowExecutionH\x00\x12\x62\n\x1f\x63\x61ncel_child_workflow_execution\x18\x0c \x01(\x0b\x32\x37.coresdk.workflow_commands.CancelChildWorkflowExecutionH\x00\x12w\n*request_cancel_external_workflow_execution\x18\r \x01(\x0b\x32\x41.coresdk.workflow_commands.RequestCancelExternalWorkflowExecutionH\x00\x12h\n"signal_external_workflow_execution\x18\x0e \x01(\x0b\x32:.coresdk.workflow_commands.SignalExternalWorkflowExecutionH\x00\x12Q\n\x16\x63\x61ncel_signal_workflow\x18\x0f \x01(\x0b\x32/.coresdk.workflow_commands.CancelSignalWorkflowH\x00\x12S\n\x17schedule_local_activity\x18\x10 \x01(\x0b\x32\x30.coresdk.workflow_commands.ScheduleLocalActivityH\x00\x12^\n\x1drequest_cancel_local_activity\x18\x11 \x01(\x0b\x32\x35.coresdk.workflow_commands.RequestCancelLocalActivityH\x00\x12\x66\n!upsert_workflow_search_attributes\x18\x12 \x01(\x0b\x32\x39.coresdk.workflow_commands.UpsertWorkflowSearchAttributesH\x00\x12Y\n\x1amodify_workflow_properties\x18\x13 \x01(\x0b\x32\x33.coresdk.workflow_commands.ModifyWorkflowPropertiesH\x00\x12\x44\n\x0fupdate_response\x18\x14 \x01(\x0b\x32).coresdk.workflow_commands.UpdateResponseH\x00\x12U\n\x18schedule_nexus_operation\x18\x15 \x01(\x0b\x32\x31.coresdk.workflow_commands.ScheduleNexusOperationH\x00\x12`\n\x1erequest_cancel_nexus_operation\x18\x16 \x01(\x0b\x32\x36.coresdk.workflow_commands.RequestCancelNexusOperationH\x00\x42\t\n\x07variant"S\n\nStartTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x38\n\x15start_to_fire_timeout\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x1a\n\x0b\x43\x61ncelTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r"\xb8\x06\n\x10ScheduleActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x15\n\ractivity_type\x18\x03 \x01(\t\x12\x12\n\ntask_queue\x18\x05 \x01(\t\x12I\n\x07headers\x18\x06 \x03(\x0b\x32\x38.coresdk.workflow_commands.ScheduleActivity.HeadersEntry\x12\x32\n\targuments\x18\x07 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x34\n\x11heartbeat_timeout\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0c \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12N\n\x11\x63\x61ncellation_type\x18\r \x01(\x0e\x32\x33.coresdk.workflow_commands.ActivityCancellationType\x12\x1e\n\x16\x64o_not_eagerly_execute\x18\x0e \x01(\x08\x12;\n\x11versioning_intent\x18\x0f \x01(\x0e\x32 .coresdk.common.VersioningIntent\x12\x32\n\x08priority\x18\x10 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\xee\x05\n\x15ScheduleLocalActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x13\n\x0b\x61\x63tivity_id\x18\x02 \x01(\t\x12\x15\n\ractivity_type\x18\x03 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x04 \x01(\r\x12:\n\x16original_schedule_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12N\n\x07headers\x18\x06 \x03(\x0b\x32=.coresdk.workflow_commands.ScheduleLocalActivity.HeadersEntry\x12\x32\n\targuments\x18\x07 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x0cretry_policy\x18\x0b \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x38\n\x15local_retry_threshold\x18\x0c \x01(\x0b\x32\x19.google.protobuf.Duration\x12N\n\x11\x63\x61ncellation_type\x18\r \x01(\x0e\x32\x33.coresdk.workflow_commands.ActivityCancellationType\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"$\n\x15RequestCancelActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r")\n\x1aRequestCancelLocalActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r"\x9c\x01\n\x0bQueryResult\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12<\n\tsucceeded\x18\x02 \x01(\x0b\x32\'.coresdk.workflow_commands.QuerySuccessH\x00\x12\x32\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\t\n\x07variant"A\n\x0cQuerySuccess\x12\x31\n\x08response\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload"L\n\x19\x43ompleteWorkflowExecution\x12/\n\x06result\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload"J\n\x15\x46\x61ilWorkflowExecution\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure"\xd8\x07\n\x1e\x43ontinueAsNewWorkflowExecution\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x12\n\ntask_queue\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x37\n\x14workflow_run_timeout\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12Q\n\x04memo\x18\x06 \x03(\x0b\x32\x43.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.MemoEntry\x12W\n\x07headers\x18\x07 \x03(\x0b\x32\x46.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.HeadersEntry\x12j\n\x11search_attributes\x18\x08 \x03(\x0b\x32O.coresdk.workflow_commands.ContinueAsNewWorkflowExecution.SearchAttributesEntry\x12\x39\n\x0cretry_policy\x18\t \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12;\n\x11versioning_intent\x18\n \x01(\x0e\x32 .coresdk.common.VersioningIntent\x12[\n\x1binitial_versioning_behavior\x18\x0b \x01(\x0e\x32\x36.temporal.api.enums.v1.ContinueAsNewVersioningBehavior\x1aL\n\tMemoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"\x19\n\x17\x43\x61ncelWorkflowExecution"6\n\x0eSetPatchMarker\x12\x10\n\x08patch_id\x18\x01 \x01(\t\x12\x12\n\ndeprecated\x18\x02 \x01(\x08"\x94\n\n\x1bStartChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x03 \x01(\t\x12\x15\n\rworkflow_type\x18\x04 \x01(\t\x12\x12\n\ntask_queue\x18\x05 \x01(\t\x12.\n\x05input\x18\x06 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12=\n\x1aworkflow_execution_timeout\x18\x07 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x46\n\x13parent_close_policy\x18\n \x01(\x0e\x32).coresdk.child_workflow.ParentClosePolicy\x12N\n\x18workflow_id_reuse_policy\x18\x0c \x01(\x0e\x32,.temporal.api.enums.v1.WorkflowIdReusePolicy\x12\x39\n\x0cretry_policy\x18\r \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x15\n\rcron_schedule\x18\x0e \x01(\t\x12T\n\x07headers\x18\x0f \x03(\x0b\x32\x43.coresdk.workflow_commands.StartChildWorkflowExecution.HeadersEntry\x12N\n\x04memo\x18\x10 \x03(\x0b\x32@.coresdk.workflow_commands.StartChildWorkflowExecution.MemoEntry\x12g\n\x11search_attributes\x18\x11 \x03(\x0b\x32L.coresdk.workflow_commands.StartChildWorkflowExecution.SearchAttributesEntry\x12P\n\x11\x63\x61ncellation_type\x18\x12 \x01(\x0e\x32\x35.coresdk.child_workflow.ChildWorkflowCancellationType\x12;\n\x11versioning_intent\x18\x13 \x01(\x0e\x32 .coresdk.common.VersioningIntent\x12\x32\n\x08priority\x18\x14 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aL\n\tMemoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"J\n\x1c\x43\x61ncelChildWorkflowExecution\x12\x1a\n\x12\x63hild_workflow_seq\x18\x01 \x01(\r\x12\x0e\n\x06reason\x18\x02 \x01(\t"\x8e\x01\n&RequestCancelExternalWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12G\n\x12workflow_execution\x18\x02 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12\x0e\n\x06reason\x18\x03 \x01(\t"\x8f\x03\n\x1fSignalExternalWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12I\n\x12workflow_execution\x18\x02 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecutionH\x00\x12\x1b\n\x11\x63hild_workflow_id\x18\x03 \x01(\tH\x00\x12\x13\n\x0bsignal_name\x18\x04 \x01(\t\x12-\n\x04\x61rgs\x18\x05 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12X\n\x07headers\x18\x06 \x03(\x0b\x32G.coresdk.workflow_commands.SignalExternalWorkflowExecution.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\x42\x08\n\x06target"#\n\x14\x43\x61ncelSignalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r"\xe6\x01\n\x1eUpsertWorkflowSearchAttributes\x12j\n\x11search_attributes\x18\x01 \x03(\x0b\x32O.coresdk.workflow_commands.UpsertWorkflowSearchAttributes.SearchAttributesEntry\x1aX\n\x15SearchAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01"O\n\x18ModifyWorkflowProperties\x12\x33\n\rupserted_memo\x18\x01 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo"\xd2\x01\n\x0eUpdateResponse\x12\x1c\n\x14protocol_instance_id\x18\x01 \x01(\t\x12*\n\x08\x61\x63\x63\x65pted\x18\x02 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00\x12\x34\n\x08rejected\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x34\n\tcompleted\x18\x04 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x42\n\n\x08response"\x9a\x04\n\x16ScheduleNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x10\n\x08\x65ndpoint\x18\x02 \x01(\t\x12\x0f\n\x07service\x18\x03 \x01(\t\x12\x11\n\toperation\x18\x04 \x01(\t\x12.\n\x05input\x18\x05 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12<\n\x19schedule_to_close_timeout\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12X\n\x0cnexus_header\x18\x07 \x03(\x0b\x32\x42.coresdk.workflow_commands.ScheduleNexusOperation.NexusHeaderEntry\x12H\n\x11\x63\x61ncellation_type\x18\x08 \x01(\x0e\x32-.coresdk.nexus.NexusOperationCancellationType\x12<\n\x19schedule_to_start_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x39\n\x16start_to_close_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x1a\x32\n\x10NexusHeaderEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"*\n\x1bRequestCancelNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r*X\n\x18\x41\x63tivityCancellationType\x12\x0e\n\nTRY_CANCEL\x10\x00\x12\x1f\n\x1bWAIT_CANCELLATION_COMPLETED\x10\x01\x12\x0b\n\x07\x41\x42\x41NDON\x10\x02\x42\x36\xea\x02\x33Temporalio::Internal::Bridge::Api::WorkflowCommandsb\x06proto3' ) _ACTIVITYCANCELLATIONTYPE = DESCRIPTOR.enum_types_by_name["ActivityCancellationType"] @@ -526,8 +526,8 @@ _UPSERTWORKFLOWSEARCHATTRIBUTES_SEARCHATTRIBUTESENTRY._serialized_options = b"8\001" _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._options = None _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._serialized_options = b"8\001" - _ACTIVITYCANCELLATIONTYPE._serialized_start = 8701 - _ACTIVITYCANCELLATIONTYPE._serialized_end = 8789 + _ACTIVITYCANCELLATIONTYPE._serialized_start = 8794 + _ACTIVITYCANCELLATIONTYPE._serialized_end = 8882 _WORKFLOWCOMMAND._serialized_start = 472 _WORKFLOWCOMMAND._serialized_end = 2493 _STARTTIMER._serialized_start = 2495 @@ -555,47 +555,47 @@ _FAILWORKFLOWEXECUTION._serialized_start = 4573 _FAILWORKFLOWEXECUTION._serialized_end = 4647 _CONTINUEASNEWWORKFLOWEXECUTION._serialized_start = 4650 - _CONTINUEASNEWWORKFLOWEXECUTION._serialized_end = 5541 - _CONTINUEASNEWWORKFLOWEXECUTION_MEMOENTRY._serialized_start = 5294 - _CONTINUEASNEWWORKFLOWEXECUTION_MEMOENTRY._serialized_end = 5370 + _CONTINUEASNEWWORKFLOWEXECUTION._serialized_end = 5634 + _CONTINUEASNEWWORKFLOWEXECUTION_MEMOENTRY._serialized_start = 5387 + _CONTINUEASNEWWORKFLOWEXECUTION_MEMOENTRY._serialized_end = 5463 _CONTINUEASNEWWORKFLOWEXECUTION_HEADERSENTRY._serialized_start = 3354 _CONTINUEASNEWWORKFLOWEXECUTION_HEADERSENTRY._serialized_end = 3433 - _CONTINUEASNEWWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_start = 5453 - _CONTINUEASNEWWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_end = 5541 - _CANCELWORKFLOWEXECUTION._serialized_start = 5543 - _CANCELWORKFLOWEXECUTION._serialized_end = 5568 - _SETPATCHMARKER._serialized_start = 5570 - _SETPATCHMARKER._serialized_end = 5624 - _STARTCHILDWORKFLOWEXECUTION._serialized_start = 5627 - _STARTCHILDWORKFLOWEXECUTION._serialized_end = 6927 + _CONTINUEASNEWWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_start = 5546 + _CONTINUEASNEWWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_end = 5634 + _CANCELWORKFLOWEXECUTION._serialized_start = 5636 + _CANCELWORKFLOWEXECUTION._serialized_end = 5661 + _SETPATCHMARKER._serialized_start = 5663 + _SETPATCHMARKER._serialized_end = 5717 + _STARTCHILDWORKFLOWEXECUTION._serialized_start = 5720 + _STARTCHILDWORKFLOWEXECUTION._serialized_end = 7020 _STARTCHILDWORKFLOWEXECUTION_HEADERSENTRY._serialized_start = 3354 _STARTCHILDWORKFLOWEXECUTION_HEADERSENTRY._serialized_end = 3433 - _STARTCHILDWORKFLOWEXECUTION_MEMOENTRY._serialized_start = 5294 - _STARTCHILDWORKFLOWEXECUTION_MEMOENTRY._serialized_end = 5370 - _STARTCHILDWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_start = 5453 - _STARTCHILDWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_end = 5541 - _CANCELCHILDWORKFLOWEXECUTION._serialized_start = 6929 - _CANCELCHILDWORKFLOWEXECUTION._serialized_end = 7003 - _REQUESTCANCELEXTERNALWORKFLOWEXECUTION._serialized_start = 7006 - _REQUESTCANCELEXTERNALWORKFLOWEXECUTION._serialized_end = 7148 - _SIGNALEXTERNALWORKFLOWEXECUTION._serialized_start = 7151 - _SIGNALEXTERNALWORKFLOWEXECUTION._serialized_end = 7550 + _STARTCHILDWORKFLOWEXECUTION_MEMOENTRY._serialized_start = 5387 + _STARTCHILDWORKFLOWEXECUTION_MEMOENTRY._serialized_end = 5463 + _STARTCHILDWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_start = 5546 + _STARTCHILDWORKFLOWEXECUTION_SEARCHATTRIBUTESENTRY._serialized_end = 5634 + _CANCELCHILDWORKFLOWEXECUTION._serialized_start = 7022 + _CANCELCHILDWORKFLOWEXECUTION._serialized_end = 7096 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTION._serialized_start = 7099 + _REQUESTCANCELEXTERNALWORKFLOWEXECUTION._serialized_end = 7241 + _SIGNALEXTERNALWORKFLOWEXECUTION._serialized_start = 7244 + _SIGNALEXTERNALWORKFLOWEXECUTION._serialized_end = 7643 _SIGNALEXTERNALWORKFLOWEXECUTION_HEADERSENTRY._serialized_start = 3354 _SIGNALEXTERNALWORKFLOWEXECUTION_HEADERSENTRY._serialized_end = 3433 - _CANCELSIGNALWORKFLOW._serialized_start = 7552 - _CANCELSIGNALWORKFLOW._serialized_end = 7587 - _UPSERTWORKFLOWSEARCHATTRIBUTES._serialized_start = 7590 - _UPSERTWORKFLOWSEARCHATTRIBUTES._serialized_end = 7820 - _UPSERTWORKFLOWSEARCHATTRIBUTES_SEARCHATTRIBUTESENTRY._serialized_start = 5453 - _UPSERTWORKFLOWSEARCHATTRIBUTES_SEARCHATTRIBUTESENTRY._serialized_end = 5541 - _MODIFYWORKFLOWPROPERTIES._serialized_start = 7822 - _MODIFYWORKFLOWPROPERTIES._serialized_end = 7901 - _UPDATERESPONSE._serialized_start = 7904 - _UPDATERESPONSE._serialized_end = 8114 - _SCHEDULENEXUSOPERATION._serialized_start = 8117 - _SCHEDULENEXUSOPERATION._serialized_end = 8655 - _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._serialized_start = 8605 - _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._serialized_end = 8655 - _REQUESTCANCELNEXUSOPERATION._serialized_start = 8657 - _REQUESTCANCELNEXUSOPERATION._serialized_end = 8699 + _CANCELSIGNALWORKFLOW._serialized_start = 7645 + _CANCELSIGNALWORKFLOW._serialized_end = 7680 + _UPSERTWORKFLOWSEARCHATTRIBUTES._serialized_start = 7683 + _UPSERTWORKFLOWSEARCHATTRIBUTES._serialized_end = 7913 + _UPSERTWORKFLOWSEARCHATTRIBUTES_SEARCHATTRIBUTESENTRY._serialized_start = 5546 + _UPSERTWORKFLOWSEARCHATTRIBUTES_SEARCHATTRIBUTESENTRY._serialized_end = 5634 + _MODIFYWORKFLOWPROPERTIES._serialized_start = 7915 + _MODIFYWORKFLOWPROPERTIES._serialized_end = 7994 + _UPDATERESPONSE._serialized_start = 7997 + _UPDATERESPONSE._serialized_end = 8207 + _SCHEDULENEXUSOPERATION._serialized_start = 8210 + _SCHEDULENEXUSOPERATION._serialized_end = 8748 + _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._serialized_start = 8698 + _SCHEDULENEXUSOPERATION_NEXUSHEADERENTRY._serialized_end = 8748 + _REQUESTCANCELNEXUSOPERATION._serialized_start = 8750 + _REQUESTCANCELNEXUSOPERATION._serialized_end = 8792 # @@protoc_insertion_point(module_scope) diff --git a/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.pyi b/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.pyi index 786a048e8..cde407d53 100644 --- a/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.pyi +++ b/temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.pyi @@ -963,6 +963,7 @@ class ContinueAsNewWorkflowExecution(google.protobuf.message.Message): SEARCH_ATTRIBUTES_FIELD_NUMBER: builtins.int RETRY_POLICY_FIELD_NUMBER: builtins.int VERSIONING_INTENT_FIELD_NUMBER: builtins.int + INITIAL_VERSIONING_BEHAVIOR_FIELD_NUMBER: builtins.int workflow_type: builtins.str """The identifier the lang-specific sdk uses to execute workflow code""" task_queue: builtins.str @@ -1016,6 +1017,13 @@ class ContinueAsNewWorkflowExecution(google.protobuf.message.Message): temporalio.bridge.proto.common.common_pb2.VersioningIntent.ValueType ) """Whether the continued workflow should run on a worker with a compatible build id or not.""" + initial_versioning_behavior: ( + temporalio.api.enums.v1.workflow_pb2.ContinueAsNewVersioningBehavior.ValueType + ) + """Experimental. Optionally decide the versioning behavior that the first task of the new run should use. + For example, choose to AutoUpgrade on continue-as-new instead of inheriting the pinned version + of the previous run. + """ def __init__( self, *, @@ -1041,6 +1049,7 @@ class ContinueAsNewWorkflowExecution(google.protobuf.message.Message): | None = ..., retry_policy: temporalio.api.common.v1.message_pb2.RetryPolicy | None = ..., versioning_intent: temporalio.bridge.proto.common.common_pb2.VersioningIntent.ValueType = ..., + initial_versioning_behavior: temporalio.api.enums.v1.workflow_pb2.ContinueAsNewVersioningBehavior.ValueType = ..., ) -> None: ... def HasField( self, @@ -1060,6 +1069,8 @@ class ContinueAsNewWorkflowExecution(google.protobuf.message.Message): b"arguments", "headers", b"headers", + "initial_versioning_behavior", + b"initial_versioning_behavior", "memo", b"memo", "retry_policy", diff --git a/temporalio/bridge/sdk-core b/temporalio/bridge/sdk-core index 9dedad111..f837d73ec 160000 --- a/temporalio/bridge/sdk-core +++ b/temporalio/bridge/sdk-core @@ -1 +1 @@ -Subproject commit 9dedad1115ab64a0ffb8decf3ad3f338979dea9f +Subproject commit f837d73ec1908679573ced8734e9a778f89956aa diff --git a/temporalio/worker/_interceptor.py b/temporalio/worker/_interceptor.py index d0d83da20..2da5465bf 100644 --- a/temporalio/worker/_interceptor.py +++ b/temporalio/worker/_interceptor.py @@ -21,7 +21,7 @@ import temporalio.nexus import temporalio.nexus._util import temporalio.workflow -from temporalio.workflow import VersioningIntent +from temporalio.workflow import ContinueAsNewVersioningBehavior, VersioningIntent class Interceptor: @@ -172,6 +172,7 @@ class ContinueAsNewInput: ) headers: Mapping[str, temporalio.api.common.v1.Payload] versioning_intent: VersioningIntent | None + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None # The types may be absent arg_types: list[type] | None diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 4ef6e8f10..736257a56 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -50,7 +50,6 @@ import temporalio.bridge.proto.activity_result import temporalio.bridge.proto.child_workflow import temporalio.bridge.proto.common -import temporalio.bridge.proto.nexus import temporalio.bridge.proto.workflow_activation import temporalio.bridge.proto.workflow_commands import temporalio.bridge.proto.workflow_completion @@ -251,6 +250,7 @@ def __init__(self, det: WorkflowInstanceDetails) -> None: self._current_history_length = 0 self._current_history_size = 0 self._continue_as_new_suggested = False + self._suggested_continue_as_new_reasons: Sequence[temporalio.api.enums.v1.SuggestContinueAsNewReason.ValueType] = [] # Lazily loaded self._untyped_converted_memo: MutableMapping[str, Any] | None = None # Handles which are ready to run on the next event loop iteration @@ -403,6 +403,7 @@ def activate( self._current_history_length = act.history_length self._current_history_size = act.history_size_bytes self._continue_as_new_suggested = act.continue_as_new_suggested + self._suggested_continue_as_new_reasons = act.suggest_continue_as_new_reasons self._time_ns = act.timestamp.ToNanoseconds() self._is_replaying = act.is_replaying self._current_thread_id = threading.get_ident() @@ -1120,6 +1121,7 @@ def workflow_continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ), versioning_intent: temporalio.workflow.VersioningIntent | None, + initial_versioning_behavior: temporalio.workflow.ContinueAsNewVersioningBehavior | None ) -> NoReturn: self._assert_not_read_only("continue as new") # Use definition if callable @@ -1147,6 +1149,7 @@ def workflow_continue_as_new( headers={}, arg_types=arg_types, versioning_intent=versioning_intent, + initial_versioning_behavior=initial_versioning_behavior ) ) @@ -1215,6 +1218,9 @@ def workflow_instance(self) -> Any: def workflow_is_continue_as_new_suggested(self) -> bool: return self._continue_as_new_suggested + + def workflow_get_suggested_continue_as_new_reasons(self) -> Sequence[temporalio.workflow.SuggestContinueAsNewReason]: + return [temporalio.workflow.SuggestContinueAsNewReason(r) for r in self._suggested_continue_as_new_reasons] def workflow_is_replaying(self) -> bool: return self._is_replaying @@ -3388,6 +3394,8 @@ def _apply_command(self) -> None: ) if self._input.versioning_intent: v.versioning_intent = self._input.versioning_intent._to_proto() + if self._input.initial_versioning_behavior: + v.initial_versioning_behavior = self._input.initial_versioning_behavior._to_proto() def _encode_search_attributes( diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 1fbcc0717..8b04b1515 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -50,6 +50,8 @@ ) import temporalio.api.common.v1 +import temporalio.api.enums +import temporalio.api.enums.v1 import temporalio.bridge.proto.child_workflow import temporalio.bridge.proto.common import temporalio.bridge.proto.nexus @@ -604,6 +606,9 @@ def is_continue_as_new_suggested(self) -> bool: """ return _Runtime.current().workflow_is_continue_as_new_suggested() + def get_suggested_continue_as_new_reasons(self) -> Sequence[SuggestContinueAsNewReason]: + """Get reason(s) why continue as new is suggested""" + return _Runtime.current().workflow_get_suggested_continue_as_new_reasons() @dataclass(frozen=True) class ParentInfo: @@ -693,6 +698,7 @@ def workflow_continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ), versioning_intent: VersioningIntent | None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None, ) -> NoReturn: ... @abstractmethod @@ -738,6 +744,9 @@ def workflow_instance(self) -> Any: ... @abstractmethod def workflow_is_continue_as_new_suggested(self) -> bool: ... + @abstractmethod + def workflow_get_suggested_continue_as_new_reasons(self) -> Sequence[Any]: ... + @abstractmethod def workflow_is_replaying(self) -> bool: ... @@ -4826,6 +4835,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None ) -> NoReturn: """Stop the workflow immediately and continue as new. @@ -4867,6 +4877,7 @@ def continue_as_new( memo=memo, search_attributes=search_attributes, versioning_intent=versioning_intent, + initial_versioning_behavior=initial_versioning_behavior ) @@ -5282,6 +5293,47 @@ def _to_proto(self) -> temporalio.bridge.proto.common.VersioningIntent.ValueType return temporalio.bridge.proto.common.VersioningIntent.DEFAULT return temporalio.bridge.proto.common.VersioningIntent.UNSPECIFIED +class ContinueAsNewVersioningBehavior(IntEnum): + """Experimental. Optionally decide the versioning behavior that the first task of the new run should use. + For example, choose to AutoUpgrade on continue-as-new instead of inheriting the pinned version + of the previous run. + """ + UNSPECIFIED = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED) + + AUTO_UPGRADE = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE) + """Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at + start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever + Versioning Behavior the workflow is annotated with in the workflow code. + + Note that if the previous workflow had a Pinned override, that override will be inherited by the + new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new + command. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade + behavior, the base version of the new run will be the Target Version as described above, but the + effective version will be whatever is specified by the Versioning Override until the override is removed. + """ + + def _to_proto(self) -> temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.ValueType: + if self == ContinueAsNewVersioningBehavior.AUTO_UPGRADE: + return temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE + return temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED + + +class SuggestContinueAsNewReason(IntEnum): + """SuggestContinueAsNewReason specifies a reason why continue as new is true.""" + SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) + + SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE) + """Workflow History size is getting too large.""" + + SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS) + """Workflow History event count is getting too large.""" + + SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES) + """Workflow's count of completed plus in-flight updates is too large.""" + + SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED) + """Workflow's Target Worker Deployment Version is different from its current Version and the workflow is versioned.""" + ServiceT = TypeVar("ServiceT") From f430d3034e535449e525884b5c7683d5a00d1545 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Mon, 2 Feb 2026 15:28:19 -0800 Subject: [PATCH 02/10] fix CAN overloads (add initial_version_behavior), add test --- temporalio/workflow.py | 7 +- tests/worker/test_worker.py | 166 ++++++++++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 1 deletion(-) diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 8b04b1515..167044955 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -4742,6 +4742,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: ... @@ -4760,6 +4761,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: ... @@ -4779,6 +4781,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: ... @@ -4798,6 +4801,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: ... @@ -4817,6 +4821,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: ... @@ -4835,7 +4840,7 @@ def continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ) = None, versioning_intent: VersioningIntent | None = None, - initial_versioning_behavior: ContinueAsNewVersioningBehavior | None + initial_versioning_behavior: ContinueAsNewVersioningBehavior | None = None, ) -> NoReturn: """Stop the workflow immediately and continue as new. diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index b1b65112d..17fd8508b 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -27,6 +27,7 @@ ) from temporalio.client import ( Client, + WorkflowHandle, ) from temporalio.common import PinnedVersioningOverride, RawValue, VersioningBehavior from temporalio.runtime import ( @@ -1151,6 +1152,39 @@ async def set_ramping_version( return response +async def wait_for_worker_deployment_routing_config_propagation( + client: Client, + deployment_name: str, + expected_current_build_id: str, + expected_ramping_build_id: str = "", +) -> None: + """Wait for routing config to be propagated to all task queues.""" + import temporalio.api.enums.v1 + + async def check() -> bool: + resp = await client.workflow_service.describe_worker_deployment( + DescribeWorkerDeploymentRequest( + namespace=client.namespace, + deployment_name=deployment_name, + ) + ) + routing_config = resp.worker_deployment_info.routing_config + if routing_config.current_deployment_version.build_id != expected_current_build_id: + return False + if routing_config.ramping_deployment_version.build_id != expected_ramping_build_id: + return False + state = resp.worker_deployment_info.routing_config_update_state + if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_COMPLETED: + return True + if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED: + return True # unimplemented + if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS: + return False + return False + + await assert_eventually(check) + + def create_worker( client: Client, on_fatal_error: Callable[[BaseException], Awaitable[None]] | None = None, @@ -1256,3 +1290,135 @@ def test_fork_use_worker( nexus_service_handlers=[], ) self.run(mp_fork_ctx) + + +# Workflows for continue-as-new with version upgrade test +@workflow.defn( + name="ContinueAsNewWithVersionUpgrade", + versioning_behavior=VersioningBehavior.PINNED, +) +class ContinueAsNewWithVersionUpgradeV1: + @workflow.run + async def run(self, attempt: int) -> str: + print("IN WORKFLOW") + if attempt > 0: + print("ATTEMPT > 1") + return "v1.0" + + # Loop waiting for CAN suggestion with version change reason + while True: + # Trigger a WFT when timer expires, thereby refreshing the continue-as-new-suggested flag + await asyncio.sleep(0.01) + info = workflow.info() + if info.is_continue_as_new_suggested(): + print("WORKFLOW CAN") + for reason in info.get_suggested_continue_as_new_reasons(): + if ( + reason + == workflow.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED + ): + print("WORKFLOW CAN BECAUSE VERSION UPGRADE") + workflow.continue_as_new( + arg=attempt + 1, + initial_versioning_behavior=workflow.ContinueAsNewVersioningBehavior.AUTO_UPGRADE, + ) + + +@workflow.defn( + name="ContinueAsNewWithVersionUpgrade", + versioning_behavior=VersioningBehavior.PINNED, +) +class ContinueAsNewWithVersionUpgradeV2: + @workflow.run + async def run(self, attempt: int) -> str: + print("IN V2") + return "v2.0" + + +async def wait_for_workflow_running_on_version( + handle: WorkflowHandle[Any, Any], expected_build_id: str +) -> None: + """Wait until workflow is RUNNING with expected build ID.""" + + async def check() -> bool: + desc = await handle.describe() + if ( + desc.status + != temporalio.api.enums.v1.WorkflowExecutionStatus.WORKFLOW_EXECUTION_STATUS_RUNNING + ): + return False + versioning_info = desc.raw_description.workflow_execution_info.versioning_info + if not versioning_info.HasField("deployment_version"): + return False + return versioning_info.deployment_version.build_id == expected_build_id + + await assert_eventually(check) + + +async def test_continue_as_new_with_version_upgrade( + client: Client, env: WorkflowEnvironment +): + if env.supports_time_skipping: + pytest.skip("Test Server doesn't support worker deployments") + + deployment_name = f"deployment-can-upgrade-{uuid.uuid4()}" + v1 = WorkerDeploymentVersion(deployment_name=deployment_name, build_id="1.0") + v2 = WorkerDeploymentVersion(deployment_name=deployment_name, build_id="2.0") + + async with ( + new_worker( + client, + ContinueAsNewWithVersionUpgradeV1, + deployment_config=WorkerDeploymentConfig( + version=v1, + use_worker_versioning=True, + ), + ) as w1, + new_worker( + client, + ContinueAsNewWithVersionUpgradeV2, + deployment_config=WorkerDeploymentConfig( + version=v2, + use_worker_versioning=True, + ), + task_queue=w1.task_queue, + ), + ): + # Wait for the deployment to be ready + describe_resp = await wait_until_worker_deployment_visible(client, v1) + + # Set version 1.0 as current + resp2 = await set_current_deployment_version( + client, describe_resp.conflict_token, v1 + ) + + # Wait for v1.0-as-Current routing config to be propagated + await wait_for_worker_deployment_routing_config_propagation( + client, deployment_name, v1.build_id + ) + + # Start workflow with v1 as current + handle = await client.start_workflow( + "ContinueAsNewWithVersionUpgrade", + 0, + id=f"test-can-version-upgrade-{uuid.uuid4()}", + task_queue=w1.task_queue, + ) + + # Wait for workflow to complete one WFT on v1.0 + await wait_for_workflow_running_on_version(handle, v1.build_id) + + # Wait for version 2.0 to be ready + await wait_until_worker_deployment_visible(client, v2) + + # Set version 2.0 as current + await set_current_deployment_version(client, resp2.conflict_token, v2) + + # Wait for v2.0-as-Current routing config to be propagated + await wait_for_worker_deployment_routing_config_propagation( + client, deployment_name, v2.build_id + ) + + # Expect workflow to return "v2.0", indicating that it continued-as-new and completed on v2 + result = await handle.result() + assert result == "v2.0" From 5d91a4e3a1c6987beec8bd3af943893bbde06e9a Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 08:21:40 -0800 Subject: [PATCH 03/10] Add PR suggestions, add test to check CAN suggested reasons persist across WFTs --- temporalio/bridge/sdk-core | 2 +- temporalio/worker/_workflow_instance.py | 5 ++- temporalio/workflow.py | 10 +++--- tests/worker/test_worker.py | 7 +---- tests/worker/test_workflow.py | 41 +++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/temporalio/bridge/sdk-core b/temporalio/bridge/sdk-core index f837d73ec..5045af358 160000 --- a/temporalio/bridge/sdk-core +++ b/temporalio/bridge/sdk-core @@ -1 +1 @@ -Subproject commit f837d73ec1908679573ced8734e9a778f89956aa +Subproject commit 5045af358a717167225b7d0d567ee668a2239e9b diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 736257a56..2c3eb2163 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -3395,7 +3395,10 @@ def _apply_command(self) -> None: if self._input.versioning_intent: v.versioning_intent = self._input.versioning_intent._to_proto() if self._input.initial_versioning_behavior: - v.initial_versioning_behavior = self._input.initial_versioning_behavior._to_proto() + v.initial_versioning_behavior = cast( + "temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.ValueType", + int(self._input.initial_versioning_behavior), + ) def _encode_search_attributes( diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 167044955..007ae4684 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -5325,18 +5325,18 @@ def _to_proto(self) -> temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.V class SuggestContinueAsNewReason(IntEnum): """SuggestContinueAsNewReason specifies a reason why continue as new is true.""" - SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) + UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) - SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE) + HISTORY_SIZE_TOO_LARGE = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE) """Workflow History size is getting too large.""" - SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS) + TOO_MANY_HISTORY_EVENTS = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS) """Workflow History event count is getting too large.""" - SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES) + TOO_MANY_UPDATES = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES) """Workflow's count of completed plus in-flight updates is too large.""" - SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED) + TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED) """Workflow's Target Worker Deployment Version is different from its current Version and the workflow is versioned.""" diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index 17fd8508b..9e7249b8c 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -1292,7 +1292,6 @@ def test_fork_use_worker( self.run(mp_fork_ctx) -# Workflows for continue-as-new with version upgrade test @workflow.defn( name="ContinueAsNewWithVersionUpgrade", versioning_behavior=VersioningBehavior.PINNED, @@ -1300,9 +1299,7 @@ def test_fork_use_worker( class ContinueAsNewWithVersionUpgradeV1: @workflow.run async def run(self, attempt: int) -> str: - print("IN WORKFLOW") if attempt > 0: - print("ATTEMPT > 1") return "v1.0" # Loop waiting for CAN suggestion with version change reason @@ -1311,13 +1308,11 @@ async def run(self, attempt: int) -> str: await asyncio.sleep(0.01) info = workflow.info() if info.is_continue_as_new_suggested(): - print("WORKFLOW CAN") for reason in info.get_suggested_continue_as_new_reasons(): if ( reason - == workflow.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED + == workflow.SuggestContinueAsNewReason.TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED ): - print("WORKFLOW CAN BECAUSE VERSION UPGRADE") workflow.continue_as_new( arg=attempt + 1, initial_versioning_behavior=workflow.ContinueAsNewVersioningBehavior.AUTO_UPGRADE, diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index b597a85ab..bdd2f9b95 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -279,6 +279,7 @@ class HistoryInfo: history_length: int history_size: int continue_as_new_suggested: bool + continue_as_new_suggested_reasons: Sequence[temporalio.workflow.SuggestContinueAsNewReason] @workflow.defn @@ -300,6 +301,7 @@ def get_history_info(self) -> HistoryInfo: history_length=workflow.info().get_current_history_length(), history_size=workflow.info().get_current_history_size(), continue_as_new_suggested=workflow.info().is_continue_as_new_suggested(), + continue_as_new_suggested_reasons=workflow.info().get_suggested_continue_as_new_reasons(), ) @@ -335,6 +337,45 @@ async def test_workflow_history_info( assert new_info.history_size > orig_info.history_size assert new_info.continue_as_new_suggested +# Test that CAN suggested reasons/suggestion are persistent across WFTs +async def test_workflow_continue_as_new_reasons_persistent( + client: Client, env: WorkflowEnvironment, continue_as_new_suggest_history_count: int +): + if env.supports_time_skipping: + pytest.skip("Java test server does not support should continue as new") + async with new_worker(client, HistoryInfoWorkflow) as worker: + handle = await client.start_workflow( + HistoryInfoWorkflow.run, + id=f"workflow-{uuid.uuid4()}", + task_queue=worker.task_queue, + ) + + await handle.query(HistoryInfoWorkflow.get_history_info) + + # Send a lot of events (trigger CAN suggestion for too many history events) + await handle.signal( + HistoryInfoWorkflow.bunch_of_events, continue_as_new_suggest_history_count + ) + # Send one more event to trigger the WFT update. We have to do this + # because just a query will have a stale representation of history + # counts, but signal forces a new WFT. + await handle.signal(HistoryInfoWorkflow.bunch_of_events, 1) + # Get wf info + info = await handle.query(HistoryInfoWorkflow.get_history_info) + # Assert CAN expectations + assert info.continue_as_new_suggested + assert len(info.continue_as_new_suggested_reasons) == 1 + assert info.continue_as_new_suggested_reasons[0] == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + # Send another signal to create a new WFT + await handle.signal(HistoryInfoWorkflow.bunch_of_events, 1) + # Get fresh info + info = await handle.query(HistoryInfoWorkflow.get_history_info) + # Expect CAN to still be suggested + assert info.continue_as_new_suggested + # Expected reasons to still be populated + assert len(info.continue_as_new_suggested_reasons) == 1 + assert info.continue_as_new_suggested_reasons[0] == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + @workflow.defn class SignalAndQueryWorkflow: From 8b6a91f31a603f8c6df11f5c0c61c396ca00e2b3 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 08:41:07 -0800 Subject: [PATCH 04/10] add docs to UNSPECIFIED enums for suggested CAN reasons and initial versioning behavior --- temporalio/workflow.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 007ae4684..94170d2e7 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -5304,6 +5304,9 @@ class ContinueAsNewVersioningBehavior(IntEnum): of the previous run. """ UNSPECIFIED = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED) + """An initial versioning behavior is not set, follow the existing continue-as-new inheritance semantics. + See https://docs.temporal.io/worker-versioning#inheritance-semantics for more detail. + """ AUTO_UPGRADE = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE) """Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at @@ -5326,6 +5329,7 @@ def _to_proto(self) -> temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.V class SuggestContinueAsNewReason(IntEnum): """SuggestContinueAsNewReason specifies a reason why continue as new is true.""" UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) + """Continue as new is suggested but the reason is unknown""" HISTORY_SIZE_TOO_LARGE = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE) """Workflow History size is getting too large.""" From c477bd49294beb0b74f9f90c9e0463526147e4ce Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 08:44:36 -0800 Subject: [PATCH 05/10] remove unused _to_proto (casting instead) --- temporalio/workflow.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 94170d2e7..ec2e37cfd 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -5320,12 +5320,6 @@ class ContinueAsNewVersioningBehavior(IntEnum): effective version will be whatever is specified by the Versioning Override until the override is removed. """ - def _to_proto(self) -> temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.ValueType: - if self == ContinueAsNewVersioningBehavior.AUTO_UPGRADE: - return temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE - return temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED - - class SuggestContinueAsNewReason(IntEnum): """SuggestContinueAsNewReason specifies a reason why continue as new is true.""" UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) From be0ef366e955db13cba287492e324e3d15ca8ed6 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 08:47:46 -0800 Subject: [PATCH 06/10] formattign --- temporalio/worker/_workflow_instance.py | 26 ++++++++++------ temporalio/workflow.py | 41 +++++++++++++++++++------ tests/worker/test_worker.py | 27 ++++++++++++---- tests/worker/test_workflow.py | 15 +++++++-- 4 files changed, 81 insertions(+), 28 deletions(-) diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 2c3eb2163..0558ff799 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -250,7 +250,9 @@ def __init__(self, det: WorkflowInstanceDetails) -> None: self._current_history_length = 0 self._current_history_size = 0 self._continue_as_new_suggested = False - self._suggested_continue_as_new_reasons: Sequence[temporalio.api.enums.v1.SuggestContinueAsNewReason.ValueType] = [] + self._suggested_continue_as_new_reasons: Sequence[ + temporalio.api.enums.v1.SuggestContinueAsNewReason.ValueType + ] = [] # Lazily loaded self._untyped_converted_memo: MutableMapping[str, Any] | None = None # Handles which are ready to run on the next event loop iteration @@ -1121,7 +1123,8 @@ def workflow_continue_as_new( temporalio.common.SearchAttributes | temporalio.common.TypedSearchAttributes ), versioning_intent: temporalio.workflow.VersioningIntent | None, - initial_versioning_behavior: temporalio.workflow.ContinueAsNewVersioningBehavior | None + initial_versioning_behavior: temporalio.workflow.ContinueAsNewVersioningBehavior + | None, ) -> NoReturn: self._assert_not_read_only("continue as new") # Use definition if callable @@ -1149,7 +1152,7 @@ def workflow_continue_as_new( headers={}, arg_types=arg_types, versioning_intent=versioning_intent, - initial_versioning_behavior=initial_versioning_behavior + initial_versioning_behavior=initial_versioning_behavior, ) ) @@ -1218,9 +1221,14 @@ def workflow_instance(self) -> Any: def workflow_is_continue_as_new_suggested(self) -> bool: return self._continue_as_new_suggested - - def workflow_get_suggested_continue_as_new_reasons(self) -> Sequence[temporalio.workflow.SuggestContinueAsNewReason]: - return [temporalio.workflow.SuggestContinueAsNewReason(r) for r in self._suggested_continue_as_new_reasons] + + def workflow_get_suggested_continue_as_new_reasons( + self, + ) -> Sequence[temporalio.workflow.SuggestContinueAsNewReason]: + return [ + temporalio.workflow.SuggestContinueAsNewReason(r) + for r in self._suggested_continue_as_new_reasons + ] def workflow_is_replaying(self) -> bool: return self._is_replaying @@ -3396,9 +3404,9 @@ def _apply_command(self) -> None: v.versioning_intent = self._input.versioning_intent._to_proto() if self._input.initial_versioning_behavior: v.initial_versioning_behavior = cast( - "temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.ValueType", - int(self._input.initial_versioning_behavior), - ) + "temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.ValueType", + int(self._input.initial_versioning_behavior), + ) def _encode_search_attributes( diff --git a/temporalio/workflow.py b/temporalio/workflow.py index ec2e37cfd..4dc63e7dc 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -606,10 +606,13 @@ def is_continue_as_new_suggested(self) -> bool: """ return _Runtime.current().workflow_is_continue_as_new_suggested() - def get_suggested_continue_as_new_reasons(self) -> Sequence[SuggestContinueAsNewReason]: + def get_suggested_continue_as_new_reasons( + self, + ) -> Sequence[SuggestContinueAsNewReason]: """Get reason(s) why continue as new is suggested""" return _Runtime.current().workflow_get_suggested_continue_as_new_reasons() + @dataclass(frozen=True) class ParentInfo: """Information about the parent workflow.""" @@ -4882,7 +4885,7 @@ def continue_as_new( memo=memo, search_attributes=search_attributes, versioning_intent=versioning_intent, - initial_versioning_behavior=initial_versioning_behavior + initial_versioning_behavior=initial_versioning_behavior, ) @@ -5298,17 +5301,23 @@ def _to_proto(self) -> temporalio.bridge.proto.common.VersioningIntent.ValueType return temporalio.bridge.proto.common.VersioningIntent.DEFAULT return temporalio.bridge.proto.common.VersioningIntent.UNSPECIFIED + class ContinueAsNewVersioningBehavior(IntEnum): """Experimental. Optionally decide the versioning behavior that the first task of the new run should use. For example, choose to AutoUpgrade on continue-as-new instead of inheriting the pinned version of the previous run. """ - UNSPECIFIED = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED) + + UNSPECIFIED = int( + temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED + ) """An initial versioning behavior is not set, follow the existing continue-as-new inheritance semantics. See https://docs.temporal.io/worker-versioning#inheritance-semantics for more detail. """ - AUTO_UPGRADE = int(temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE) + AUTO_UPGRADE = int( + temporalio.api.enums.v1.ContinueAsNewVersioningBehavior.CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE + ) """Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever Versioning Behavior the workflow is annotated with in the workflow code. @@ -5320,23 +5329,35 @@ class ContinueAsNewVersioningBehavior(IntEnum): effective version will be whatever is specified by the Versioning Override until the override is removed. """ + class SuggestContinueAsNewReason(IntEnum): """SuggestContinueAsNewReason specifies a reason why continue as new is true.""" - UNSPECIFIED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED) + + UNSPECIFIED = int( + temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_UNSPECIFIED + ) """Continue as new is suggested but the reason is unknown""" - HISTORY_SIZE_TOO_LARGE = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE) + HISTORY_SIZE_TOO_LARGE = int( + temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_HISTORY_SIZE_TOO_LARGE + ) """Workflow History size is getting too large.""" - TOO_MANY_HISTORY_EVENTS = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS) + TOO_MANY_HISTORY_EVENTS = int( + temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_HISTORY_EVENTS + ) """Workflow History event count is getting too large.""" - TOO_MANY_UPDATES = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES) + TOO_MANY_UPDATES = int( + temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES + ) """Workflow's count of completed plus in-flight updates is too large.""" - TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED = int(temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED) + TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED = int( + temporalio.api.enums.v1.SuggestContinueAsNewReason.SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED + ) """Workflow's Target Worker Deployment Version is different from its current Version and the workflow is versioned.""" - + ServiceT = TypeVar("ServiceT") diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index 9e7249b8c..4cdf4cb14 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -1169,16 +1169,31 @@ async def check() -> bool: ) ) routing_config = resp.worker_deployment_info.routing_config - if routing_config.current_deployment_version.build_id != expected_current_build_id: + if ( + routing_config.current_deployment_version.build_id + != expected_current_build_id + ): return False - if routing_config.ramping_deployment_version.build_id != expected_ramping_build_id: + if ( + routing_config.ramping_deployment_version.build_id + != expected_ramping_build_id + ): return False state = resp.worker_deployment_info.routing_config_update_state - if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_COMPLETED: + if ( + state + == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_COMPLETED + ): return True - if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED: - return True # unimplemented - if state == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS: + if ( + state + == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED + ): + return True # unimplemented + if ( + state + == temporalio.api.enums.v1.RoutingConfigUpdateState.ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS + ): return False return False diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index bdd2f9b95..87cfd293e 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -279,7 +279,9 @@ class HistoryInfo: history_length: int history_size: int continue_as_new_suggested: bool - continue_as_new_suggested_reasons: Sequence[temporalio.workflow.SuggestContinueAsNewReason] + continue_as_new_suggested_reasons: Sequence[ + temporalio.workflow.SuggestContinueAsNewReason + ] @workflow.defn @@ -337,6 +339,7 @@ async def test_workflow_history_info( assert new_info.history_size > orig_info.history_size assert new_info.continue_as_new_suggested + # Test that CAN suggested reasons/suggestion are persistent across WFTs async def test_workflow_continue_as_new_reasons_persistent( client: Client, env: WorkflowEnvironment, continue_as_new_suggest_history_count: int @@ -365,7 +368,10 @@ async def test_workflow_continue_as_new_reasons_persistent( # Assert CAN expectations assert info.continue_as_new_suggested assert len(info.continue_as_new_suggested_reasons) == 1 - assert info.continue_as_new_suggested_reasons[0] == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + assert ( + info.continue_as_new_suggested_reasons[0] + == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + ) # Send another signal to create a new WFT await handle.signal(HistoryInfoWorkflow.bunch_of_events, 1) # Get fresh info @@ -374,7 +380,10 @@ async def test_workflow_continue_as_new_reasons_persistent( assert info.continue_as_new_suggested # Expected reasons to still be populated assert len(info.continue_as_new_suggested_reasons) == 1 - assert info.continue_as_new_suggested_reasons[0] == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + assert ( + info.continue_as_new_suggested_reasons[0] + == temporalio.workflow.SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS + ) @workflow.defn From b85b0a614254351e675e5d1774beb51a97f1e51e Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 09:16:08 -0800 Subject: [PATCH 07/10] add missing proto.nexus import --- temporalio/worker/_workflow_instance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 0558ff799..7bbebc224 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -50,6 +50,7 @@ import temporalio.bridge.proto.activity_result import temporalio.bridge.proto.child_workflow import temporalio.bridge.proto.common +import temporalio.bridge.proto.nexus import temporalio.bridge.proto.workflow_activation import temporalio.bridge.proto.workflow_commands import temporalio.bridge.proto.workflow_completion From fafc61090b613a6658fcefa931d6c4d293481001 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 12:18:41 -0800 Subject: [PATCH 08/10] fix lint - remove misc print --- tests/worker/test_worker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index 4cdf4cb14..f71c28806 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -1340,8 +1340,7 @@ async def run(self, attempt: int) -> str: ) class ContinueAsNewWithVersionUpgradeV2: @workflow.run - async def run(self, attempt: int) -> str: - print("IN V2") + async def run(self) -> str: return "v2.0" From 20eafbc06cd05c7e8aeafe9bd22ee325258ec814 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 12:28:56 -0800 Subject: [PATCH 09/10] add param to v2, add unused param suppression --- tests/worker/test_worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index f71c28806..a5759c3c3 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -1340,7 +1340,7 @@ async def run(self, attempt: int) -> str: ) class ContinueAsNewWithVersionUpgradeV2: @workflow.run - async def run(self) -> str: + async def run(self, attempt: int) -> str: # type:ignore[reportUnusedParameter] return "v2.0" From 1eb251525f31d9afb72875384d82f2366c67a703 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 3 Feb 2026 13:55:51 -0800 Subject: [PATCH 10/10] get again formatting --- tests/worker/test_worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/worker/test_worker.py b/tests/worker/test_worker.py index a5759c3c3..bce3be655 100644 --- a/tests/worker/test_worker.py +++ b/tests/worker/test_worker.py @@ -1340,7 +1340,7 @@ async def run(self, attempt: int) -> str: ) class ContinueAsNewWithVersionUpgradeV2: @workflow.run - async def run(self, attempt: int) -> str: # type:ignore[reportUnusedParameter] + async def run(self, attempt: int) -> str: # type:ignore[reportUnusedParameter] return "v2.0"