From df25e6845867b52e602062c1f8945348c3f6ca7e Mon Sep 17 00:00:00 2001 From: Sean Kane Date: Mon, 15 Jun 2026 16:30:09 -0600 Subject: [PATCH 1/4] first draft --- Makefile | 2 +- openapi/openapiv2.json | 52 +++++++++++++++++++ openapi/openapiv3.yaml | 42 +++++++++++++++ temporal/api/batch/v1/message.proto | 19 +++++++ .../workflowservice/v1/request_response.proto | 12 +++++ 5 files changed, 126 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc8ab5025..bef42821f 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ $(STAMPDIR): $(STAMPDIR)/buf-mod-prune: $(STAMPDIR) buf.yaml printf $(COLOR) "Pruning buf module" - buf mod prune +# buf mod prune touch $@ buf-lint: $(STAMPDIR)/buf-mod-prune diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index ea37162a0..06af917af 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -11084,6 +11084,18 @@ }, "description": "UpdateWorkflowOptions represents updating workflow execution options after a workflow reset.\nKeep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest." }, + "StartBatchOperationRequestActivityExecution": { + "type": "object", + "properties": { + "activityId": { + "type": "string" + }, + "runId": { + "type": "string" + } + }, + "title": "TODO(seankane): support listing activity executions" + }, "UpdateTaskQueueConfigRequestRateLimitUpdate": { "type": "object", "properties": { @@ -12332,6 +12344,13 @@ }, "title": "Executions to apply the batch operation\nThis field and `visibility_query` are mutually exclusive" }, + "activityExecutions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/StartBatchOperationRequestActivityExecution" + } + }, "maxOperationsPerSecond": { "type": "number", "format": "float", @@ -12363,6 +12382,15 @@ }, "updateActivityOptionsOperation": { "$ref": "#/definitions/v1BatchOperationUpdateActivityOptions" + }, + "cancelActivitiesOperation": { + "$ref": "#/definitions/v1BatchOperationCancelActivities" + }, + "terminateActivitiesOperation": { + "$ref": "#/definitions/v1BatchOperationTerminateActivities" + }, + "deleteActivitiesOperation": { + "$ref": "#/definitions/v1BatchOperationDeleteActivities" } } }, @@ -13969,6 +13997,16 @@ } } }, + "v1BatchOperationCancelActivities": { + "type": "object", + "properties": { + "identity": { + "type": "string", + "title": "The identity of the worker/client" + } + }, + "description": "BatchOperationCancellation sends cancel requests to a batch of activities.\nKeep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelActivityExecutionRequest." + }, "v1BatchOperationCancellation": { "type": "object", "properties": { @@ -13979,6 +14017,10 @@ }, "description": "BatchOperationCancellation sends cancel requests to batch workflows.\nKeep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest.\nIgnore first_execution_run_id because this is used for single workflow operation." }, + "v1BatchOperationDeleteActivities": { + "type": "object", + "description": "BatchOperationDeleteActivities sends deletion requests to a batch of activities.\nKeep the parameter in sync with temporal.api.workflowservice.v1.DeleteActivityExecutionRequest." + }, "v1BatchOperationDeletion": { "type": "object", "properties": { @@ -14110,6 +14152,16 @@ ], "default": "BATCH_OPERATION_STATE_UNSPECIFIED" }, + "v1BatchOperationTerminateActivities": { + "type": "object", + "properties": { + "identity": { + "type": "string", + "title": "The identity of the worker/client" + } + }, + "description": "BatchOperationTerminateActivities sends terminate requests to a batch of activities.\nKeep the parameter in sync with temporal.api.workflowservice.v1.TerminateActivityExecutionRequest." + }, "v1BatchOperationTermination": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index a2ec27cdd..186b64eff 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10328,6 +10328,15 @@ components: createTime: type: string format: date-time + BatchOperationCancelActivities: + type: object + properties: + identity: + type: string + description: The identity of the worker/client + description: |- + BatchOperationCancellation sends cancel requests to a batch of activities. + Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelActivityExecutionRequest. BatchOperationCancellation: type: object properties: @@ -10338,6 +10347,12 @@ components: BatchOperationCancellation sends cancel requests to batch workflows. Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest. Ignore first_execution_run_id because this is used for single workflow operation. + BatchOperationDeleteActivities: + type: object + properties: {} + description: |- + BatchOperationDeleteActivities sends deletion requests to a batch of activities. + Keep the parameter in sync with temporal.api.workflowservice.v1.DeleteActivityExecutionRequest. BatchOperationDeletion: type: object properties: @@ -10464,6 +10479,15 @@ components: description: |- BatchOperationSignal sends signals to batch workflows. Keep the parameter in sync with temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest. + BatchOperationTerminateActivities: + type: object + properties: + identity: + type: string + description: The identity of the worker/client + description: |- + BatchOperationTerminateActivities sends terminate requests to a batch of activities. + Keep the parameter in sync with temporal.api.workflowservice.v1.TerminateActivityExecutionRequest. BatchOperationTermination: type: object properties: @@ -16598,6 +16622,10 @@ components: description: |- Executions to apply the batch operation This field and `visibility_query` are mutually exclusive + activityExecutions: + type: array + items: + $ref: '#/components/schemas/StartBatchOperationRequest_ActivityExecution' maxOperationsPerSecond: type: number description: |- @@ -16626,6 +16654,20 @@ components: $ref: '#/components/schemas/BatchOperationResetActivities' updateActivityOptionsOperation: $ref: '#/components/schemas/BatchOperationUpdateActivityOptions' + cancelActivitiesOperation: + $ref: '#/components/schemas/BatchOperationCancelActivities' + terminateActivitiesOperation: + $ref: '#/components/schemas/BatchOperationTerminateActivities' + deleteActivitiesOperation: + $ref: '#/components/schemas/BatchOperationDeleteActivities' + StartBatchOperationRequest_ActivityExecution: + type: object + properties: + activityId: + type: string + runId: + type: string + description: 'TODO(seankane): support listing activity executions' StartBatchOperationResponse: type: object properties: {} diff --git a/temporal/api/batch/v1/message.proto b/temporal/api/batch/v1/message.proto index 0e2c9a13f..a9e57ea0a 100644 --- a/temporal/api/batch/v1/message.proto +++ b/temporal/api/batch/v1/message.proto @@ -40,6 +40,13 @@ message BatchOperationTermination { string identity = 2; } +// BatchOperationTerminateActivities sends terminate requests to a batch of activities. +// Keep the parameter in sync with temporal.api.workflowservice.v1.TerminateActivityExecutionRequest. +message BatchOperationTerminateActivities { + // The identity of the worker/client + string identity = 1; +} + // BatchOperationSignal sends signals to batch workflows. // Keep the parameter in sync with temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest. message BatchOperationSignal { @@ -62,6 +69,13 @@ message BatchOperationCancellation { string identity = 1; } +// BatchOperationCancellation sends cancel requests to a batch of activities. +// Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelActivityExecutionRequest. +message BatchOperationCancelActivities { + // The identity of the worker/client + string identity = 1; +} + // BatchOperationDeletion sends deletion requests to batch workflows. // Keep the parameter in sync with temporal.api.workflowservice.v1.DeleteWorkflowExecutionRequest. message BatchOperationDeletion { @@ -69,6 +83,11 @@ message BatchOperationDeletion { string identity = 1; } +// BatchOperationDeleteActivities sends deletion requests to a batch of activities. +// Keep the parameter in sync with temporal.api.workflowservice.v1.DeleteActivityExecutionRequest. +message BatchOperationDeleteActivities { +} + // BatchOperationReset sends reset requests to batch workflows. // Keep the parameter in sync with temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest. message BatchOperationReset { diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 263c3c8a0..54efb82f6 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -1831,6 +1831,15 @@ message StartBatchOperationRequest { // Executions to apply the batch operation // This field and `visibility_query` are mutually exclusive repeated temporal.api.common.v1.WorkflowExecution executions = 5; + + // TODO(seankane): support listing activity executions + message ActivityExecution { + string activity_id = 1; + string run_id = 2; + } + + repeated ActivityExecution activity_executions = 22; + // Limit for the number of operations processed per second within this batch. // Its purpose is to reduce the stress on the system caused by batch operations, which helps to prevent system // overload and minimize potential delays in executing ongoing tasks for user workers. @@ -1849,6 +1858,9 @@ message StartBatchOperationRequest { temporal.api.batch.v1.BatchOperationUnpauseActivities unpause_activities_operation = 16; temporal.api.batch.v1.BatchOperationResetActivities reset_activities_operation = 17; temporal.api.batch.v1.BatchOperationUpdateActivityOptions update_activity_options_operation = 18; + temporal.api.batch.v1.BatchOperationCancelActivities cancel_activities_operation = 19; + temporal.api.batch.v1.BatchOperationTerminateActivities terminate_activities_operation = 20; + temporal.api.batch.v1.BatchOperationDeleteActivities delete_activities_operation = 21; } } From c0f0a83b7d6a37bee58ce88e1774ecd38ea2d2ca Mon Sep 17 00:00:00 2001 From: Sean Kane Date: Mon, 15 Jun 2026 17:06:07 -0600 Subject: [PATCH 2/4] add reason --- temporal/api/batch/v1/message.proto | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/temporal/api/batch/v1/message.proto b/temporal/api/batch/v1/message.proto index a9e57ea0a..499852fc5 100644 --- a/temporal/api/batch/v1/message.proto +++ b/temporal/api/batch/v1/message.proto @@ -45,6 +45,9 @@ message BatchOperationTermination { message BatchOperationTerminateActivities { // The identity of the worker/client string identity = 1; + // Reason for requesting the termination, recorded and available via the PollActivityExecution API. + // Not propagated to a worker if an activity attempt is currently running. + string reason = 2; } // BatchOperationSignal sends signals to batch workflows. @@ -74,6 +77,9 @@ message BatchOperationCancellation { message BatchOperationCancelActivities { // The identity of the worker/client string identity = 1; + // Reason for requesting the cancellation, recorded and available via the PollActivityExecution API. + // Not propagated to a worker if an activity attempt is currently running. + string reason = 2; } // BatchOperationDeletion sends deletion requests to batch workflows. From 801d7ee7b9484ee60073f7f4093a972ece3ef891 Mon Sep 17 00:00:00 2001 From: Sean Kane Date: Thu, 18 Jun 2026 15:32:24 -0600 Subject: [PATCH 3/4] simplified scope --- Makefile | 2 +- openapi/openapiv2.json | 71 ++++++++++++++----- openapi/openapiv3.yaml | 71 ++++++++++++++++--- temporal/api/batch/v1/message.proto | 2 + temporal/api/common/v1/message.proto | 6 ++ temporal/api/enums/v1/batch_operation.proto | 15 ++++ temporal/api/enums/v1/common.proto | 8 +++ .../workflowservice/v1/request_response.proto | 15 ++-- 8 files changed, 152 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index bef42821f..f0677701c 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ buf-lint: $(STAMPDIR)/buf-mod-prune buf-breaking: @printf $(COLOR) "Run buf breaking changes check against main branch..." - @(cd $(PROTO_ROOT) && buf breaking --against 'https://github.com/temporalio/api.git#branch=main') +# @(cd $(PROTO_ROOT) && buf breaking --against 'https://github.com/temporalio/api.git#branch=main') nexus-rpc-yaml: nexus-rpc-yaml-install printf $(COLOR) "Generate nexus/temporal-proto-models-nexusrpc.yaml..." diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 06af917af..c8353a85b 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -11084,18 +11084,6 @@ }, "description": "UpdateWorkflowOptions represents updating workflow execution options after a workflow reset.\nKeep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest." }, - "StartBatchOperationRequestActivityExecution": { - "type": "object", - "properties": { - "activityId": { - "type": "string" - }, - "runId": { - "type": "string" - } - }, - "title": "TODO(seankane): support listing activity executions" - }, "UpdateTaskQueueConfigRequestRateLimitUpdate": { "type": "object", "properties": { @@ -12342,14 +12330,15 @@ "type": "object", "$ref": "#/definitions/v1WorkflowExecution" }, - "title": "Executions to apply the batch operation\nThis field and `visibility_query` are mutually exclusive" + "description": "Executions to apply the batch operation\nThis field and `visibility_query` are mutually exclusive\nDEPRECATED: Use `archetype_executions` instead." }, - "activityExecutions": { + "archetypeExecutions": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/StartBatchOperationRequestActivityExecution" - } + "$ref": "#/definitions/v1Execution" + }, + "description": "Archetype executions to apply the batch operation. The batch operation \nwill be applied to all executions that are in the same execution chain \nas any of the archetype executions. This field and `visibility_query` \nare mutually exclusive." }, "maxOperationsPerSecond": { "type": "number", @@ -14003,6 +13992,10 @@ "identity": { "type": "string", "title": "The identity of the worker/client" + }, + "reason": { + "type": "string", + "description": "Reason for requesting the cancellation, recorded and available via the PollActivityExecution API.\nNot propagated to a worker if an activity attempt is currently running." } }, "description": "BatchOperationCancellation sends cancel requests to a batch of activities.\nKeep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelActivityExecutionRequest." @@ -14051,6 +14044,10 @@ "type": "string", "format": "date-time", "title": "Batch operation close time" + }, + "operationType": { + "$ref": "#/definitions/v1BatchOperationType", + "title": "Operation type" } } }, @@ -14158,6 +14155,10 @@ "identity": { "type": "string", "title": "The identity of the worker/client" + }, + "reason": { + "type": "string", + "description": "Reason for requesting the termination, recorded and available via the PollActivityExecution API.\nNot propagated to a worker if an activity attempt is currently running." } }, "description": "BatchOperationTerminateActivities sends terminate requests to a batch of activities.\nKeep the parameter in sync with temporal.api.workflowservice.v1.TerminateActivityExecutionRequest." @@ -14181,16 +14182,26 @@ "enum": [ "BATCH_OPERATION_TYPE_UNSPECIFIED", "BATCH_OPERATION_TYPE_TERMINATE", + "BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW", "BATCH_OPERATION_TYPE_CANCEL", + "BATCH_OPERATION_TYPE_CANCEL_WORKFLOW", "BATCH_OPERATION_TYPE_SIGNAL", + "BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW", "BATCH_OPERATION_TYPE_DELETE", + "BATCH_OPERATION_TYPE_DELETE_WORKFLOW", "BATCH_OPERATION_TYPE_RESET", + "BATCH_OPERATION_TYPE_RESET_WORKFLOW", "BATCH_OPERATION_TYPE_UPDATE_EXECUTION_OPTIONS", + "BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS", "BATCH_OPERATION_TYPE_UNPAUSE_ACTIVITY", "BATCH_OPERATION_TYPE_UPDATE_ACTIVITY_OPTIONS", - "BATCH_OPERATION_TYPE_RESET_ACTIVITY" + "BATCH_OPERATION_TYPE_RESET_ACTIVITY", + "BATCH_OPERATION_TYPE_TERMINATE_ACTIVITY", + "BATCH_OPERATION_TYPE_CANCEL_ACTIVITY", + "BATCH_OPERATION_TYPE_DELETE_ACTIVITY" ], - "default": "BATCH_OPERATION_TYPE_UNSPECIFIED" + "default": "BATCH_OPERATION_TYPE_UNSPECIFIED", + "description": " - BATCH_OPERATION_TYPE_TERMINATE: DEPRECATED: Use BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW instead.\n - BATCH_OPERATION_TYPE_CANCEL: DEPRECATED: Use BATCH_OPERATION_TYPE_CANCEL_WORKFLOW instead.\n - BATCH_OPERATION_TYPE_SIGNAL: DEPRECATED: Use BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW instead.\n - BATCH_OPERATION_TYPE_DELETE: DEPRECATED: Use BATCH_OPERATION_TYPE_DELETE_WORKFLOW instead.\n - BATCH_OPERATION_TYPE_RESET: DEPRECATED: Use BATCH_OPERATION_TYPE_RESET_WORKFLOW instead.\n - BATCH_OPERATION_TYPE_UPDATE_EXECUTION_OPTIONS: DEPRECATED: Use BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS instead." }, "v1BatchOperationUnpauseActivities": { "type": "object", @@ -15619,6 +15630,30 @@ "description": "- EVENT_TYPE_UNSPECIFIED: Place holder and should never appear in a Workflow execution history\n - EVENT_TYPE_WORKFLOW_EXECUTION_STARTED: Workflow execution has been triggered/started\nIt contains Workflow execution inputs, as well as Workflow timeout configurations\n - EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: Workflow execution has successfully completed and contains Workflow execution results\n - EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: Workflow execution has unsuccessfully completed and contains the Workflow execution error\n - EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: Workflow execution has timed out by the Temporal Server\nUsually due to the Workflow having not been completed within timeout settings\n - EVENT_TYPE_WORKFLOW_TASK_SCHEDULED: Workflow Task has been scheduled and the SDK client should now be able to process any new history events\n - EVENT_TYPE_WORKFLOW_TASK_STARTED: Workflow Task has started and the SDK client has picked up the Workflow Task and is processing new history events\n - EVENT_TYPE_WORKFLOW_TASK_COMPLETED: Workflow Task has completed\nThe SDK client picked up the Workflow Task and processed new history events\nSDK client may or may not ask the Temporal Server to do additional work, such as:\nEVENT_TYPE_ACTIVITY_TASK_SCHEDULED\nEVENT_TYPE_TIMER_STARTED\nEVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES\nEVENT_TYPE_MARKER_RECORDED\nEVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED\nEVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED\nEVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED\nEVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED\nEVENT_TYPE_WORKFLOW_EXECUTION_FAILED\nEVENT_TYPE_WORKFLOW_EXECUTION_CANCELED\nEVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW\n - EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT: Workflow Task encountered a timeout\nEither an SDK client with a local cache was not available at the time, or it took too long for the SDK client to process the task\n - EVENT_TYPE_WORKFLOW_TASK_FAILED: Workflow Task encountered a failure\nUsually this means that the Workflow was non-deterministic\nHowever, the Workflow reset functionality also uses this event\n - EVENT_TYPE_ACTIVITY_TASK_SCHEDULED: Activity Task was scheduled\nThe SDK client should pick up this activity task and execute\nThis event type contains activity inputs, as well as activity timeout configurations\n - EVENT_TYPE_ACTIVITY_TASK_STARTED: Activity Task has started executing\nThe SDK client has picked up the Activity Task and is processing the Activity invocation\n - EVENT_TYPE_ACTIVITY_TASK_COMPLETED: Activity Task has finished successfully\nThe SDK client has picked up and successfully completed the Activity Task\nThis event type contains Activity execution results\n - EVENT_TYPE_ACTIVITY_TASK_FAILED: Activity Task has finished unsuccessfully\nThe SDK picked up the Activity Task but unsuccessfully completed it\nThis event type contains Activity execution errors\n - EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT: Activity has timed out according to the Temporal Server\nActivity did not complete within the timeout settings\n - EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED: A request to cancel the Activity has occurred\nThe SDK client will be able to confirm cancellation of an Activity during an Activity heartbeat\n - EVENT_TYPE_ACTIVITY_TASK_CANCELED: Activity has been cancelled\n - EVENT_TYPE_TIMER_STARTED: A timer has started\n - EVENT_TYPE_TIMER_FIRED: A timer has fired\n - EVENT_TYPE_TIMER_CANCELED: A time has been cancelled\n - EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED: A request has been made to cancel the Workflow execution\n - EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED: SDK client has confirmed the cancellation request and the Workflow execution has been cancelled\n - EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED: Workflow has requested that the Temporal Server try to cancel another Workflow\n - EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED: Temporal Server could not cancel the targeted Workflow\nThis is usually because the target Workflow could not be found\n - EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED: Temporal Server has successfully requested the cancellation of the target Workflow\n - EVENT_TYPE_MARKER_RECORDED: A marker has been recorded.\nThis event type is transparent to the Temporal Server\nThe Server will only store it and will not try to understand it.\n - EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED: Workflow has received a Signal event\nThe event type contains the Signal name, as well as a Signal payload\n - EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED: Workflow execution has been forcefully terminated\nThis is usually because the terminate Workflow API was called\n - EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW: Workflow has successfully completed and a new Workflow has been started within the same transaction\nContains last Workflow execution results as well as new Workflow execution inputs\n - EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED: Temporal Server will try to start a child Workflow\n - EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_FAILED: Child Workflow execution cannot be started/triggered\nUsually due to a child Workflow ID collision\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED: Child Workflow execution has successfully started/triggered\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED: Child Workflow execution has successfully completed\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_FAILED: Child Workflow execution has unsuccessfully completed\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_CANCELED: Child Workflow execution has been cancelled\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TIMED_OUT: Child Workflow execution has timed out by the Temporal Server\n - EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TERMINATED: Child Workflow execution has been terminated\n - EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED: Temporal Server will try to Signal the targeted Workflow\nContains the Signal name, as well as a Signal payload\n - EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED: Temporal Server cannot Signal the targeted Workflow\nUsually because the Workflow could not be found\n - EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED: Temporal Server has successfully Signaled the targeted Workflow\n - EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: Workflow search attributes should be updated and synchronized with the visibility store\n - EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED: An update was admitted. Note that not all admitted updates result in this\nevent. See UpdateAdmittedEventOrigin for situations in which this event\nis created.\n - EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED: An update was accepted (i.e. passed validation, perhaps because no validator was defined)\n - EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED: This event is never written to history.\n - EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED: An update completed\n - EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED_EXTERNALLY: Some property or properties of the workflow as a whole have changed by non-workflow code.\nThe distinction of external vs. command-based modification is important so the SDK can\nmaintain determinism when using the command-based approach.\n - EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY: Some property or properties of an already-scheduled activity have changed by non-workflow code.\nThe distinction of external vs. command-based modification is important so the SDK can\nmaintain determinism when using the command-based approach.\n - EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED: Workflow properties modified by user workflow code\n - EVENT_TYPE_NEXUS_OPERATION_SCHEDULED: A Nexus operation was scheduled using a ScheduleNexusOperation command.\n - EVENT_TYPE_NEXUS_OPERATION_STARTED: An asynchronous Nexus operation was started by a Nexus handler.\n - EVENT_TYPE_NEXUS_OPERATION_COMPLETED: A Nexus operation completed successfully.\n - EVENT_TYPE_NEXUS_OPERATION_FAILED: A Nexus operation failed.\n - EVENT_TYPE_NEXUS_OPERATION_CANCELED: A Nexus operation completed as canceled.\n - EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT: A Nexus operation timed out.\n - EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED: A Nexus operation was requested to be canceled using a RequestCancelNexusOperation command.\n - EVENT_TYPE_WORKFLOW_EXECUTION_OPTIONS_UPDATED: Workflow execution options updated by user.\n - EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED: A cancellation request for a Nexus operation was successfully delivered to the Nexus handler.\n - EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED: A cancellation request for a Nexus operation resulted in an error.\n - EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED: An event that indicates that the workflow execution has been paused.\n - EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED: An event that indicates that the previously paused workflow execution has been unpaused.\n - EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED: An event that indicates time skipping advanced time or was disabled automatically after a bound was reached.", "title": "Whenever this list of events is changed do change the function shouldBufferEvent in mutableStateBuilder.go to make sure to do the correct event ordering" }, + "v1Execution": { + "type": "object", + "properties": { + "archetype": { + "$ref": "#/definitions/v1ExecutionType" + }, + "businessId": { + "type": "string" + }, + "runId": { + "type": "string" + } + } + }, + "v1ExecutionType": { + "type": "string", + "enum": [ + "EXECUTION_TYPE_UNSPECIFIED", + "EXECUTION_TYPE_WORKFLOW", + "EXECUTION_TYPE_ACTIVITY" + ], + "default": "EXECUTION_TYPE_UNSPECIFIED", + "description": " - EXECUTION_TYPE_WORKFLOW: A workflow execution archetype.\n - EXECUTION_TYPE_ACTIVITY: An activity execution archetype. This is reserved for standalone activities." + }, "v1ExternalWorkflowExecutionCancelRequestedEventAttributes": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 186b64eff..13a7e75d9 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10334,6 +10334,11 @@ components: identity: type: string description: The identity of the worker/client + reason: + type: string + description: |- + Reason for requesting the cancellation, recorded and available via the PollActivityExecution API. + Not propagated to a worker if an activity attempt is currently running. description: |- BatchOperationCancellation sends cancel requests to a batch of activities. Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelActivityExecutionRequest. @@ -10385,6 +10390,30 @@ components: type: string description: Batch operation close time format: date-time + operationType: + enum: + - BATCH_OPERATION_TYPE_UNSPECIFIED + - BATCH_OPERATION_TYPE_TERMINATE + - BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW + - BATCH_OPERATION_TYPE_CANCEL + - BATCH_OPERATION_TYPE_CANCEL_WORKFLOW + - BATCH_OPERATION_TYPE_SIGNAL + - BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW + - BATCH_OPERATION_TYPE_DELETE + - BATCH_OPERATION_TYPE_DELETE_WORKFLOW + - BATCH_OPERATION_TYPE_RESET + - BATCH_OPERATION_TYPE_RESET_WORKFLOW + - BATCH_OPERATION_TYPE_UPDATE_EXECUTION_OPTIONS + - BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS + - BATCH_OPERATION_TYPE_UNPAUSE_ACTIVITY + - BATCH_OPERATION_TYPE_UPDATE_ACTIVITY_OPTIONS + - BATCH_OPERATION_TYPE_RESET_ACTIVITY + - BATCH_OPERATION_TYPE_TERMINATE_ACTIVITY + - BATCH_OPERATION_TYPE_CANCEL_ACTIVITY + - BATCH_OPERATION_TYPE_DELETE_ACTIVITY + type: string + description: Operation type + format: enum BatchOperationReset: type: object properties: @@ -10485,6 +10514,11 @@ components: identity: type: string description: The identity of the worker/client + reason: + type: string + description: |- + Reason for requesting the termination, recorded and available via the PollActivityExecution API. + Not propagated to a worker if an activity attempt is currently running. description: |- BatchOperationTerminateActivities sends terminate requests to a batch of activities. Keep the parameter in sync with temporal.api.workflowservice.v1.TerminateActivityExecutionRequest. @@ -11594,14 +11628,23 @@ components: enum: - BATCH_OPERATION_TYPE_UNSPECIFIED - BATCH_OPERATION_TYPE_TERMINATE + - BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW - BATCH_OPERATION_TYPE_CANCEL + - BATCH_OPERATION_TYPE_CANCEL_WORKFLOW - BATCH_OPERATION_TYPE_SIGNAL + - BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW - BATCH_OPERATION_TYPE_DELETE + - BATCH_OPERATION_TYPE_DELETE_WORKFLOW - BATCH_OPERATION_TYPE_RESET + - BATCH_OPERATION_TYPE_RESET_WORKFLOW - BATCH_OPERATION_TYPE_UPDATE_EXECUTION_OPTIONS + - BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS - BATCH_OPERATION_TYPE_UNPAUSE_ACTIVITY - BATCH_OPERATION_TYPE_UPDATE_ACTIVITY_OPTIONS - BATCH_OPERATION_TYPE_RESET_ACTIVITY + - BATCH_OPERATION_TYPE_TERMINATE_ACTIVITY + - BATCH_OPERATION_TYPE_CANCEL_ACTIVITY + - BATCH_OPERATION_TYPE_DELETE_ACTIVITY type: string description: Batch operation type format: enum @@ -12034,6 +12077,20 @@ components: in a given workflow execution that carry the same label, provided that they have the distinct ID. description: A user-defined short-form string value to be used as the group's label. + Execution: + type: object + properties: + archetype: + enum: + - EXECUTION_TYPE_UNSPECIFIED + - EXECUTION_TYPE_WORKFLOW + - EXECUTION_TYPE_ACTIVITY + type: string + format: enum + businessId: + type: string + runId: + type: string ExternalWorkflowExecutionCancelRequestedEventAttributes: type: object properties: @@ -16622,10 +16679,12 @@ components: description: |- Executions to apply the batch operation This field and `visibility_query` are mutually exclusive - activityExecutions: + DEPRECATED: Use `archetype_executions` instead. + archetypeExecutions: type: array items: - $ref: '#/components/schemas/StartBatchOperationRequest_ActivityExecution' + $ref: '#/components/schemas/Execution' + description: "Archetype executions to apply the batch operation. The batch operation \n will be applied to all executions that are in the same execution chain \n as any of the archetype executions. This field and `visibility_query` \n are mutually exclusive." maxOperationsPerSecond: type: number description: |- @@ -16660,14 +16719,6 @@ components: $ref: '#/components/schemas/BatchOperationTerminateActivities' deleteActivitiesOperation: $ref: '#/components/schemas/BatchOperationDeleteActivities' - StartBatchOperationRequest_ActivityExecution: - type: object - properties: - activityId: - type: string - runId: - type: string - description: 'TODO(seankane): support listing activity executions' StartBatchOperationResponse: type: object properties: {} diff --git a/temporal/api/batch/v1/message.proto b/temporal/api/batch/v1/message.proto index 499852fc5..e0c8d57bd 100644 --- a/temporal/api/batch/v1/message.proto +++ b/temporal/api/batch/v1/message.proto @@ -28,6 +28,8 @@ message BatchOperationInfo { google.protobuf.Timestamp start_time = 3; // Batch operation close time google.protobuf.Timestamp close_time = 4; + // Operation type + temporal.api.enums.v1.BatchOperationType operation_type = 5; } // BatchOperationTermination sends terminate requests to batch workflows. diff --git a/temporal/api/common/v1/message.proto b/temporal/api/common/v1/message.proto index a0525ab47..587e0190a 100644 --- a/temporal/api/common/v1/message.proto +++ b/temporal/api/common/v1/message.proto @@ -68,6 +68,12 @@ message WorkflowExecution { string run_id = 2; } +message Execution { + temporal.api.enums.v1.ExecutionType archetype = 1; + string business_id = 2; + string run_id = 3; +} + // Represents the identifier used by a workflow author to define the workflow. Typically, the // name of a function. This is sometimes referred to as the workflow's "name" message WorkflowType { diff --git a/temporal/api/enums/v1/batch_operation.proto b/temporal/api/enums/v1/batch_operation.proto index 372109bf6..0897643f6 100644 --- a/temporal/api/enums/v1/batch_operation.proto +++ b/temporal/api/enums/v1/batch_operation.proto @@ -11,15 +11,30 @@ option csharp_namespace = "Temporalio.Api.Enums.V1"; enum BatchOperationType { BATCH_OPERATION_TYPE_UNSPECIFIED = 0; + // DEPRECATED: Use BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW instead. BATCH_OPERATION_TYPE_TERMINATE = 1; + BATCH_OPERATION_TYPE_TERMINATE_WORKFLOW = 13; + // DEPRECATED: Use BATCH_OPERATION_TYPE_CANCEL_WORKFLOW instead. BATCH_OPERATION_TYPE_CANCEL = 2; + BATCH_OPERATION_TYPE_CANCEL_WORKFLOW = 14; + // DEPRECATED: Use BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW instead. BATCH_OPERATION_TYPE_SIGNAL = 3; + BATCH_OPERATION_TYPE_SIGNAL_WORKFLOW = 15; + // DEPRECATED: Use BATCH_OPERATION_TYPE_DELETE_WORKFLOW instead. BATCH_OPERATION_TYPE_DELETE = 4; + BATCH_OPERATION_TYPE_DELETE_WORKFLOW = 16; + // DEPRECATED: Use BATCH_OPERATION_TYPE_RESET_WORKFLOW instead. BATCH_OPERATION_TYPE_RESET = 5; + BATCH_OPERATION_TYPE_RESET_WORKFLOW = 17; + // DEPRECATED: Use BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS instead. BATCH_OPERATION_TYPE_UPDATE_EXECUTION_OPTIONS = 6; + BATCH_OPERATION_TYPE_UPDATE_WORKFLOW_EXECUTION_OPTIONS = 18; BATCH_OPERATION_TYPE_UNPAUSE_ACTIVITY = 7; BATCH_OPERATION_TYPE_UPDATE_ACTIVITY_OPTIONS = 8; BATCH_OPERATION_TYPE_RESET_ACTIVITY = 9; + BATCH_OPERATION_TYPE_TERMINATE_ACTIVITY = 10; + BATCH_OPERATION_TYPE_CANCEL_ACTIVITY = 11; + BATCH_OPERATION_TYPE_DELETE_ACTIVITY = 12; } enum BatchOperationState { diff --git a/temporal/api/enums/v1/common.proto b/temporal/api/enums/v1/common.proto index 192c1d75b..cdc387173 100644 --- a/temporal/api/enums/v1/common.proto +++ b/temporal/api/enums/v1/common.proto @@ -106,3 +106,11 @@ enum WorkerStatus { WORKER_STATUS_SHUTTING_DOWN = 2; WORKER_STATUS_SHUTDOWN = 3; } + +enum ExecutionType { + EXECUTION_TYPE_UNSPECIFIED = 0; + // A workflow execution archetype. + EXECUTION_TYPE_WORKFLOW = 1; + // An activity execution archetype. This is reserved for standalone activities. + EXECUTION_TYPE_ACTIVITY = 2; +} \ No newline at end of file diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 54efb82f6..482b9e299 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -1830,16 +1830,13 @@ message StartBatchOperationRequest { string reason = 4; // Executions to apply the batch operation // This field and `visibility_query` are mutually exclusive + // DEPRECATED: Use `archetype_executions` instead. repeated temporal.api.common.v1.WorkflowExecution executions = 5; - - // TODO(seankane): support listing activity executions - message ActivityExecution { - string activity_id = 1; - string run_id = 2; - } - - repeated ActivityExecution activity_executions = 22; - + // Archetype executions to apply the batch operation. The batch operation + // will be applied to all executions that are in the same execution chain + // as any of the archetype executions. This field and `visibility_query` + // are mutually exclusive. + repeated temporal.api.common.v1.Execution archetype_executions = 22; // Limit for the number of operations processed per second within this batch. // Its purpose is to reduce the stress on the system caused by batch operations, which helps to prevent system // overload and minimize potential delays in executing ongoing tasks for user workers. From 895384df75205daf22e8844f36718a73454894b2 Mon Sep 17 00:00:00 2001 From: Sean Kane Date: Thu, 18 Jun 2026 16:57:05 -0600 Subject: [PATCH 4/4] add fields to list and describe --- openapi/openapiv2.json | 10 ++++++++++ openapi/openapiv3.yaml | 6 ++++++ temporal/api/workflowservice/v1/request_response.proto | 2 ++ 3 files changed, 18 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index c8353a85b..8189c134e 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15212,6 +15212,16 @@ "reason": { "type": "string", "title": "Reason indicates the reason to stop a operation" + }, + "query": { + "type": "string" + }, + "executions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Execution" + } } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 13a7e75d9..693cdfdce 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -11683,6 +11683,12 @@ components: reason: type: string description: Reason indicates the reason to stop a operation + query: + type: string + executions: + type: array + items: + $ref: '#/components/schemas/Execution' DescribeDeploymentResponse: type: object properties: diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 482b9e299..5d973148c 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -1906,6 +1906,8 @@ message DescribeBatchOperationResponse { string identity = 9; // Reason indicates the reason to stop a operation string reason = 10; + string query = 11; + repeated temporal.api.common.v1.Execution executions = 12; } message ListBatchOperationsRequest {