From ae4e1c4a841f664e546d60cceba8a0d8b429814d Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Tue, 13 May 2025 16:53:18 -0700 Subject: [PATCH 01/14] inherit pinned version and override across CaN when pinned --- openapi/openapiv2.json | 8 ++++++++ openapi/openapiv3.yaml | 14 ++++++++++++++ temporal/api/history/v1/message.proto | 12 +++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 5e0c615af..6f2d5c7bf 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15147,6 +15147,14 @@ "inheritBuildId": { "type": "boolean", "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution." + }, + "currentPinnedVersioningOverride": { + "$ref": "#/definitions/v1VersioningOverride", + "description": "If this is set, the new execution inherits the versioning override of the current execution,\nbecause the effective behavior of the current execution is pinned." + }, + "currentPinnedDeploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "If this is set, the new execution inherits the pinned version of the current execution,\nbecause the effective behavior of the current execution is pinned.\nThis is set only if the new workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 28aab1cfb..0528b1b8d 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -12640,6 +12640,20 @@ components: description: |- If this is set, the new execution inherits the Build ID of the current execution. Otherwise, the assignment rules will be used to independently assign a Build ID to the new execution. + currentPinnedVersioningOverride: + allOf: + - $ref: '#/components/schemas/VersioningOverride' + description: |- + If this is set, the new execution inherits the versioning override of the current execution, + because the effective behavior of the current execution is pinned. + currentPinnedDeploymentVersion: + allOf: + - $ref: '#/components/schemas/WorkerDeploymentVersion' + description: |- + If this is set, the new execution inherits the pinned version of the current execution, + because the effective behavior of the current execution is pinned. + This is set only if the new workflow is starting on a Task Queue belonging to the same + Worker Deployment Version. WorkflowExecutionExtendedInfo: type: object properties: diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 9c77ae452..0d26a4699 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -191,7 +191,17 @@ message WorkflowExecutionContinuedAsNewEventAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 14; // If this is set, the new execution inherits the Build ID of the current execution. Otherwise, // the assignment rules will be used to independently assign a Build ID to the new execution. - bool inherit_build_id = 15; + bool inherit_build_id = 15 [deprecated = true]; + + // If this is set, the new execution inherits the versioning override of the current execution, + // because the effective behavior of the current execution is pinned. + temporal.api.workflow.v1.VersioningOverride current_pinned_versioning_override = 16; + + // If this is set, the new execution inherits the pinned version of the current execution, + // because the effective behavior of the current execution is pinned. + // This is set only if the new workflow is starting on a Task Queue belonging to the same + // Worker Deployment Version. + temporal.api.deployment.v1.WorkerDeploymentVersion current_pinned_deployment_version = 36; // workflow_execution_timeout is omitted as it shouldn't be overridden from within a workflow. } From 16b31fa3ce10c6d3f56f0860e62c28ee15a134f7 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Tue, 13 May 2025 16:59:25 -0700 Subject: [PATCH 02/14] change comment --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 1 + temporal/api/history/v1/message.proto | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 6f2d5c7bf..b654a77de 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15146,7 +15146,7 @@ }, "inheritBuildId": { "type": "boolean", - "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution." + "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution.\nOnly considered for versioning v0.2, which is deprecated." }, "currentPinnedVersioningOverride": { "$ref": "#/definitions/v1VersioningOverride", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 0528b1b8d..53ea11af0 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -12640,6 +12640,7 @@ components: description: |- If this is set, the new execution inherits the Build ID of the current execution. Otherwise, the assignment rules will be used to independently assign a Build ID to the new execution. + Only considered for versioning v0.2, which is deprecated. currentPinnedVersioningOverride: allOf: - $ref: '#/components/schemas/VersioningOverride' diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 0d26a4699..b64ff2360 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -191,7 +191,8 @@ message WorkflowExecutionContinuedAsNewEventAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 14; // If this is set, the new execution inherits the Build ID of the current execution. Otherwise, // the assignment rules will be used to independently assign a Build ID to the new execution. - bool inherit_build_id = 15 [deprecated = true]; + // Only considered for versioning v0.2, which is deprecated. + bool inherit_build_id = 15; // If this is set, the new execution inherits the versioning override of the current execution, // because the effective behavior of the current execution is pinned. From 47a11b38bf975bc90e566504867c7aafb0b114d7 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Tue, 13 May 2025 17:23:29 -0700 Subject: [PATCH 03/14] add previous pinned deployment version --- openapi/openapiv2.json | 4 ++++ openapi/openapiv3.yaml | 9 +++++++++ temporal/api/history/v1/message.proto | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index b654a77de..ae186dea1 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15527,6 +15527,10 @@ "$ref": "#/definitions/v1WorkerDeploymentVersion", "description": "When present, it means this is a child workflow of a parent that is Pinned to this Worker\nDeployment Version. In this case, child workflow will start as Pinned to this Version instead\nof starting on the Current Version of its Task Queue.\nThis is set only if the child workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." }, + "previousPinnedDeploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "When present, it means this is a continued-as-new workflow of a previous execution that is Pinned\nto this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version\ninstead of starting on the Current Version of its Task Queue.\nThis is set only if the new workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." + }, "priority": { "$ref": "#/definitions/v1Priority", "title": "Priority metadata" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 53ea11af0..3e950f9ee 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13069,6 +13069,15 @@ components: of starting on the Current Version of its Task Queue. This is set only if the child workflow is starting on a Task Queue belonging to the same Worker Deployment Version. + previousPinnedDeploymentVersion: + allOf: + - $ref: '#/components/schemas/WorkerDeploymentVersion' + description: |- + When present, it means this is a continued-as-new workflow of a previous execution that is Pinned + to this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version + instead of starting on the Current Version of its Task Queue. + This is set only if the new workflow is starting on a Task Queue belonging to the same + Worker Deployment Version. priority: allOf: - $ref: '#/components/schemas/Priority' diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index b64ff2360..22ecdf5f8 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -135,6 +135,13 @@ message WorkflowExecutionStartedEventAttributes { // Worker Deployment Version. temporal.api.deployment.v1.WorkerDeploymentVersion parent_pinned_deployment_version = 36; + // When present, it means this is a continued-as-new workflow of a previous execution that is Pinned + // to this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version + // instead of starting on the Current Version of its Task Queue. + // This is set only if the new workflow is starting on a Task Queue belonging to the same + // Worker Deployment Version. + temporal.api.deployment.v1.WorkerDeploymentVersion previous_pinned_deployment_version = 37; + // Priority metadata temporal.api.common.v1.Priority priority = 35; } From 39206d90859e571f1e1f21102e140c213a6a7fd1 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Tue, 13 May 2025 18:00:04 -0700 Subject: [PATCH 04/14] fix proto field number --- temporal/api/history/v1/message.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 22ecdf5f8..51d63c3b1 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -209,7 +209,7 @@ message WorkflowExecutionContinuedAsNewEventAttributes { // because the effective behavior of the current execution is pinned. // This is set only if the new workflow is starting on a Task Queue belonging to the same // Worker Deployment Version. - temporal.api.deployment.v1.WorkerDeploymentVersion current_pinned_deployment_version = 36; + temporal.api.deployment.v1.WorkerDeploymentVersion current_pinned_deployment_version = 17; // workflow_execution_timeout is omitted as it shouldn't be overridden from within a workflow. } From 5a21b4a9eeca028cd7cbb3c11dff29c98b1eb948 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 14 May 2025 15:29:11 -0700 Subject: [PATCH 05/14] put source versioning info in WorkflowExecutionStartedEvent --- openapi/openapiv2.json | 45 ++++++++-------- openapi/openapiv3.yaml | 73 +++++++++++++------------- temporal/api/history/v1/message.proto | 59 +++++++++++---------- temporal/api/workflow/v1/message.proto | 6 +-- 4 files changed, 95 insertions(+), 88 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index a3e3f33a8..4fdeabea4 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7174,6 +7174,17 @@ }, "description": "RequestIdReference is a indirect reference to a history event through the request ID." }, + "WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo": { + "type": "object", + "properties": { + "deploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion" + }, + "behavior": { + "$ref": "#/definitions/v1VersioningBehavior" + } + } + }, "WorkflowRuleActionActionActivityPause": { "type": "object" }, @@ -15186,15 +15197,7 @@ }, "inheritBuildId": { "type": "boolean", - "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution.\nOnly considered for versioning v0.2, which is deprecated." - }, - "currentPinnedVersioningOverride": { - "$ref": "#/definitions/v1VersioningOverride", - "description": "If this is set, the new execution inherits the versioning override of the current execution,\nbecause the effective behavior of the current execution is pinned." - }, - "currentPinnedDeploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "If this is set, the new execution inherits the pinned version of the current execution,\nbecause the effective behavior of the current execution is pinned.\nThis is set only if the new workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." + "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution.\nDeprecated. Only considered for versioning v0.2." } } }, @@ -15561,19 +15564,19 @@ }, "parentPinnedWorkerDeploymentVersion": { "type": "string", - "description": "When present, it means this is a child workflow of a parent that is Pinned to this Worker\nDeployment Version. In this case, child workflow will start as Pinned to this Version instead\nof starting on the Current Version of its Task Queue.\nThis is set only if the child workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version.\nDeprecated. Use `parent_pinned_deployment_version`." - }, - "parentPinnedDeploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "When present, it means this is a child workflow of a parent that is Pinned to this Worker\nDeployment Version. In this case, child workflow will start as Pinned to this Version instead\nof starting on the Current Version of its Task Queue.\nThis is set only if the child workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." - }, - "previousPinnedDeploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "When present, it means this is a continued-as-new workflow of a previous execution that is Pinned\nto this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version\ninstead of starting on the Current Version of its Task Queue.\nThis is set only if the new workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version." + "description": "When present, it means this is a child workflow of a parent that is Pinned to this Worker\nDeployment Version. In this case, child workflow will start as Pinned to this Version instead\nof starting on the Current Version of its Task Queue.\nThis is set only if the child workflow is starting on a Task Queue belonging to the same\nWorker Deployment Version.\nDeprecated. Use `parent_versioning_info`." }, "priority": { "$ref": "#/definitions/v1Priority", "title": "Priority metadata" + }, + "parentVersioningInfo": { + "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", + "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version." + }, + "previousRunVersioningInfo": { + "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", + "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version." } }, "title": "Always the first event in workflow history" @@ -15705,7 +15708,7 @@ "properties": { "behavior": { "$ref": "#/definitions/v1VersioningBehavior", - "description": "Versioning behavior determines how the server should treat this execution when workers are\nupgraded. When present it means this workflow execution is versioned; UNSPECIFIED means\nunversioned. See the comments in `VersioningBehavior` enum for more info about different\nbehaviors.\nThis field is first set after an execution completes its first workflow task on a versioned\nworker, and set again on completion of every subsequent workflow task.\nFor child workflows of Pinned parents, this will be set to Pinned (along with `version`) when\nthe the child starts so that child's first workflow task goes to the same Version as the\nparent. After the first workflow task, it depends on the child workflow itself if it wants\nto stay pinned or become unpinned (according to Versioning Behavior set in the worker).\nNote that `behavior` is overridden by `versioning_override` if the latter is present." + "description": "Versioning behavior determines how the server should treat this execution when workers are\nupgraded. When present it means this workflow execution is versioned; UNSPECIFIED means\nunversioned. See the comments in `VersioningBehavior` enum for more info about different\nbehaviors.\nThis field is first set after an execution completes its first workflow task on a versioned\nworker, and set again on completion of every subsequent workflow task.\nFor child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when\nthe the child starts so that child's first workflow task goes to the same Version as the\nparent. After the first workflow task, it depends on the child workflow itself if it wants\nto stay pinned or become unpinned (according to Versioning Behavior set in the worker).\nNote that `behavior` is overridden by `versioning_override` if the latter is present." }, "deployment": { "$ref": "#/definitions/v1Deployment", @@ -15721,7 +15724,7 @@ }, "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", - "description": "Present if user has set an execution-specific versioning override. This override takes\nprecedence over SDK-sent `behavior` (and `version` when override is PINNED). An\noverride can be set when starting a new execution, as well as afterwards by calling the\n`UpdateWorkflowExecutionOptions` API.\nPinned overrides are automatically inherited by child workflows." + "description": "Present if user has set an execution-specific versioning override. This override takes\nprecedence over SDK-sent `behavior` (and `version` when override is PINNED). An\noverride can be set when starting a new execution, as well as afterwards by calling the\n`UpdateWorkflowExecutionOptions` API.\nPinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries." }, "deploymentTransition": { "$ref": "#/definitions/v1DeploymentTransition", @@ -15729,7 +15732,7 @@ }, "versionTransition": { "$ref": "#/definitions/v1DeploymentVersionTransition", - "description": "When present, indicates the workflow is transitioning to a different deployment version\n(which may belong to the same deployment name or another). Can indicate one of the following\ntransitions: unversioned -> versioned, versioned -> versioned\non a different deployment version, or versioned -> unversioned.\nNot applicable to workflows with PINNED behavior.\nWhen a workflow with AUTO_UPGRADE behavior creates a new workflow task, it will automatically\nstart a transition to the task queue's current version if the task queue's current version is\ndifferent from the workflow's current deployment version.\nIf the AUTO_UPGRADE workflow is stuck due to backlogged activity or workflow tasks, those\ntasks will be redirected to the task queue's current version. As soon as a poller from\nthat deployment version is available to receive the task, the workflow will automatically\nstart a transition to that version and continue execution there.\nA version transition can only exist while there is a pending or started workflow task.\nOnce the pending workflow task completes on the transition's target version, the\ntransition completes and the workflow's `behavior`, and `version` fields are updated per the\nworker's task completion response.\nPending activities will not start new attempts during a transition. Once the transition is\ncompleted, pending activities will start their next attempt on the new version." + "description": "When present, indicates the workflow is transitioning to a different deployment version\n(which may belong to the same deployment name or another). Can indicate one of the following\ntransitions: unversioned -> versioned, versioned -> versioned\non a different deployment version, or versioned -> unversioned.\nNot applicable to workflows with PINNED behavior.\nWhen a workflow with AUTO_UPGRADE behavior creates a new workflow task, it will automatically\nstart a transition to the task queue's current version if the task queue's current version is\ndifferent from the workflow's current deployment version.\nIf the AUTO_UPGRADE workflow is stuck due to backlogged activity or workflow tasks, those\ntasks will be redirected to the task queue's current version. As soon as a poller from\nthat deployment version is available to receive the task, the workflow will automatically\nstart a transition to that version and continue execution there.\nA version transition can only exist while there is a pending or started workflow task.\nOnce the pending workflow task completes on the transition's target version, the\ntransition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the\nworker's task completion response.\nPending activities will not start new attempts during a transition. Once the transition is\ncompleted, pending activities will start their next attempt on the new version." } }, "description": "Holds all the information about worker versioning for a particular workflow execution.\nExperimental. Versioning info is experimental and might change in the future." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 3d159041a..a748412e6 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -12681,21 +12681,7 @@ components: description: |- If this is set, the new execution inherits the Build ID of the current execution. Otherwise, the assignment rules will be used to independently assign a Build ID to the new execution. - Only considered for versioning v0.2, which is deprecated. - currentPinnedVersioningOverride: - allOf: - - $ref: '#/components/schemas/VersioningOverride' - description: |- - If this is set, the new execution inherits the versioning override of the current execution, - because the effective behavior of the current execution is pinned. - currentPinnedDeploymentVersion: - allOf: - - $ref: '#/components/schemas/WorkerDeploymentVersion' - description: |- - If this is set, the new execution inherits the pinned version of the current execution, - because the effective behavior of the current execution is pinned. - This is set only if the new workflow is starting on a Task Queue belonging to the same - Worker Deployment Version. + Deprecated. Only considered for versioning v0.2. WorkflowExecutionExtendedInfo: type: object properties: @@ -13100,30 +13086,43 @@ components: of starting on the Current Version of its Task Queue. This is set only if the child workflow is starting on a Task Queue belonging to the same Worker Deployment Version. - Deprecated. Use `parent_pinned_deployment_version`. - parentPinnedDeploymentVersion: - allOf: - - $ref: '#/components/schemas/WorkerDeploymentVersion' - description: |- - When present, it means this is a child workflow of a parent that is Pinned to this Worker - Deployment Version. In this case, child workflow will start as Pinned to this Version instead - of starting on the Current Version of its Task Queue. - This is set only if the child workflow is starting on a Task Queue belonging to the same - Worker Deployment Version. - previousPinnedDeploymentVersion: - allOf: - - $ref: '#/components/schemas/WorkerDeploymentVersion' - description: |- - When present, it means this is a continued-as-new workflow of a previous execution that is Pinned - to this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version - instead of starting on the Current Version of its Task Queue. - This is set only if the new workflow is starting on a Task Queue belonging to the same - Worker Deployment Version. + Deprecated. Use `parent_versioning_info`. priority: allOf: - $ref: '#/components/schemas/Priority' description: Priority metadata + parentVersioningInfo: + allOf: + - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + description: |- + When present, this is a child workflow of a versioned parent. + If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + parent's Version, the child workflow will inherit the parent's Version. + previousRunVersioningInfo: + allOf: + - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + description: |- + When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. + The `initiator` field of this event specifies why this new workflow was initiated. + + If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, + and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will + inherit the previous workflow's version. + + If initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version. description: Always the first event in workflow history + WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo: + type: object + properties: + deploymentVersion: + $ref: '#/components/schemas/WorkerDeploymentVersion' + behavior: + enum: + - VERSIONING_BEHAVIOR_UNSPECIFIED + - VERSIONING_BEHAVIOR_PINNED + - VERSIONING_BEHAVIOR_AUTO_UPGRADE + type: string + format: enum WorkflowExecutionTerminatedEventAttributes: type: object properties: @@ -13243,7 +13242,7 @@ components: behaviors. This field is first set after an execution completes its first workflow task on a versioned worker, and set again on completion of every subsequent workflow task. - For child workflows of Pinned parents, this will be set to Pinned (along with `version`) when + For child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when the the child starts so that child's first workflow task goes to the same Version as the parent. After the first workflow task, it depends on the child workflow itself if it wants to stay pinned or become unpinned (according to Versioning Behavior set in the worker). @@ -13284,7 +13283,7 @@ components: precedence over SDK-sent `behavior` (and `version` when override is PINNED). An override can be set when starting a new execution, as well as afterwards by calling the `UpdateWorkflowExecutionOptions` API. - Pinned overrides are automatically inherited by child workflows. + Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries. deploymentTransition: allOf: - $ref: '#/components/schemas/DeploymentTransition' @@ -13325,7 +13324,7 @@ components: start a transition to that version and continue execution there. A version transition can only exist while there is a pending or started workflow task. Once the pending workflow task completes on the transition's target version, the - transition completes and the workflow's `behavior`, and `version` fields are updated per the + transition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the worker's task completion response. Pending activities will not start new attempts during a transition. Once the transition is completed, pending activities will start their next attempt on the new version. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 51d63c3b1..281f2053c 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -125,25 +125,40 @@ message WorkflowExecutionStartedEventAttributes { // of starting on the Current Version of its Task Queue. // This is set only if the child workflow is starting on a Task Queue belonging to the same // Worker Deployment Version. - // Deprecated. Use `parent_pinned_deployment_version`. + // Deprecated. Use `parent_versioning_info`. string parent_pinned_worker_deployment_version = 34 [deprecated = true]; - // When present, it means this is a child workflow of a parent that is Pinned to this Worker - // Deployment Version. In this case, child workflow will start as Pinned to this Version instead - // of starting on the Current Version of its Task Queue. - // This is set only if the child workflow is starting on a Task Queue belonging to the same - // Worker Deployment Version. - temporal.api.deployment.v1.WorkerDeploymentVersion parent_pinned_deployment_version = 36; - - // When present, it means this is a continued-as-new workflow of a previous execution that is Pinned - // to this Worker Deployment Version. In this case, the new workflow will start as Pinned to this Version - // instead of starting on the Current Version of its Task Queue. - // This is set only if the new workflow is starting on a Task Queue belonging to the same - // Worker Deployment Version. - temporal.api.deployment.v1.WorkerDeploymentVersion previous_pinned_deployment_version = 37; - // Priority metadata temporal.api.common.v1.Priority priority = 35; + + reserved 36; + reserved "parent_pinned_deployment_version"; + + // Specifies the versioning information of the source workflow, if this workflow was started + // by a parent of as part of a chain. + // The base versioning info of the source workflow may or may not be inherited. + // If a versioning override is present, it will take precedence over the inherited base version. + oneof source_workflow_versioning_info { + // When present, this is a child workflow of a versioned parent. + // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + // parent's Version, the child workflow will inherit the parent's Version. + SourceWorkflowVersioningInfo parent_versioning_info = 37; + + // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. + // The `initiator` field of this event specifies why this new workflow was initiated. + // + // If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, + // and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will + // inherit the previous workflow's version. + // + // If initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version. + SourceWorkflowVersioningInfo previous_run_versioning_info = 38; + } + + message SourceWorkflowVersioningInfo { + temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; + temporal.api.enums.v1.VersioningBehavior behavior = 2; + } } message WorkflowExecutionCompletedEventAttributes { @@ -198,18 +213,8 @@ message WorkflowExecutionContinuedAsNewEventAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 14; // If this is set, the new execution inherits the Build ID of the current execution. Otherwise, // the assignment rules will be used to independently assign a Build ID to the new execution. - // Only considered for versioning v0.2, which is deprecated. - bool inherit_build_id = 15; - - // If this is set, the new execution inherits the versioning override of the current execution, - // because the effective behavior of the current execution is pinned. - temporal.api.workflow.v1.VersioningOverride current_pinned_versioning_override = 16; - - // If this is set, the new execution inherits the pinned version of the current execution, - // because the effective behavior of the current execution is pinned. - // This is set only if the new workflow is starting on a Task Queue belonging to the same - // Worker Deployment Version. - temporal.api.deployment.v1.WorkerDeploymentVersion current_pinned_deployment_version = 17; + // Deprecated. Only considered for versioning v0.2. + bool inherit_build_id = 15 [deprecated = true]; // workflow_execution_timeout is omitted as it shouldn't be overridden from within a workflow. } diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index 98134eb14..b729ec8e3 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -137,7 +137,7 @@ message WorkflowExecutionVersioningInfo { // behaviors. // This field is first set after an execution completes its first workflow task on a versioned // worker, and set again on completion of every subsequent workflow task. - // For child workflows of Pinned parents, this will be set to Pinned (along with `version`) when + // For child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when // the the child starts so that child's first workflow task goes to the same Version as the // parent. After the first workflow task, it depends on the child workflow itself if it wants // to stay pinned or become unpinned (according to Versioning Behavior set in the worker). @@ -167,7 +167,7 @@ message WorkflowExecutionVersioningInfo { // precedence over SDK-sent `behavior` (and `version` when override is PINNED). An // override can be set when starting a new execution, as well as afterwards by calling the // `UpdateWorkflowExecutionOptions` API. - // Pinned overrides are automatically inherited by child workflows. + // Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries. VersioningOverride versioning_override = 3; // When present, indicates the workflow is transitioning to a different deployment. Can // indicate one of the following transitions: unversioned -> versioned, versioned -> versioned @@ -202,7 +202,7 @@ message WorkflowExecutionVersioningInfo { // start a transition to that version and continue execution there. // A version transition can only exist while there is a pending or started workflow task. // Once the pending workflow task completes on the transition's target version, the - // transition completes and the workflow's `behavior`, and `version` fields are updated per the + // transition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the // worker's task completion response. // Pending activities will not start new attempts during a transition. Once the transition is // completed, pending activities will start their next attempt on the new version. From a491abeda90cfbfead6e6f7f18cd4eed783d39c1 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 14 May 2025 15:46:13 -0700 Subject: [PATCH 06/14] store source versioning info in ExecutionInfo.VersioningInfo so that pinned version of a tree/chain can be inherited on retry --- openapi/openapiv2.json | 32 +++++++++++--------- openapi/openapiv3.yaml | 42 +++++++++++++++++--------- temporal/api/history/v1/message.proto | 15 +++++---- temporal/api/workflow/v1/message.proto | 10 ++++++ 4 files changed, 62 insertions(+), 37 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 4fdeabea4..9b835007b 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7174,17 +7174,6 @@ }, "description": "RequestIdReference is a indirect reference to a history event through the request ID." }, - "WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo": { - "type": "object", - "properties": { - "deploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion" - }, - "behavior": { - "$ref": "#/definitions/v1VersioningBehavior" - } - } - }, "WorkflowRuleActionActionActivityPause": { "type": "object" }, @@ -13657,6 +13646,17 @@ "v1SignalWorkflowExecutionResponse": { "type": "object" }, + "v1SourceWorkflowVersioningInfo": { + "type": "object", + "properties": { + "deploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion" + }, + "behavior": { + "$ref": "#/definitions/v1VersioningBehavior" + } + } + }, "v1StartBatchOperationResponse": { "type": "object" }, @@ -15571,12 +15571,12 @@ "title": "Priority metadata" }, "parentVersioningInfo": { - "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", + "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version." }, "previousRunVersioningInfo": { - "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version." + "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", + "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain.\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version." } }, "title": "Always the first event in workflow history" @@ -15733,6 +15733,10 @@ "versionTransition": { "$ref": "#/definitions/v1DeploymentVersionTransition", "description": "When present, indicates the workflow is transitioning to a different deployment version\n(which may belong to the same deployment name or another). Can indicate one of the following\ntransitions: unversioned -> versioned, versioned -> versioned\non a different deployment version, or versioned -> unversioned.\nNot applicable to workflows with PINNED behavior.\nWhen a workflow with AUTO_UPGRADE behavior creates a new workflow task, it will automatically\nstart a transition to the task queue's current version if the task queue's current version is\ndifferent from the workflow's current deployment version.\nIf the AUTO_UPGRADE workflow is stuck due to backlogged activity or workflow tasks, those\ntasks will be redirected to the task queue's current version. As soon as a poller from\nthat deployment version is available to receive the task, the workflow will automatically\nstart a transition to that version and continue execution there.\nA version transition can only exist while there is a pending or started workflow task.\nOnce the pending workflow task completes on the transition's target version, the\ntransition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the\nworker's task completion response.\nPending activities will not start new attempts during a transition. Once the transition is\ncompleted, pending activities will start their next attempt on the new version." + }, + "sourceWorkflowVersioningInfo": { + "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", + "description": "When present, this workflow execution is the child of a versioned parent, or is part of\na ContinueAsNew chain and the previous workflow in the chain was versioned.\nIf this workflow retries and the source is PINNED, the new retry workflow will inherit the\nVersion of the source workflow." } }, "description": "Holds all the information about worker versioning for a particular workflow execution.\nExperimental. Versioning info is experimental and might change in the future." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index a748412e6..ecd5bfe07 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10927,6 +10927,18 @@ components: SignalWorkflowExecutionResponse: type: object properties: {} + SourceWorkflowVersioningInfo: + type: object + properties: + deploymentVersion: + $ref: '#/components/schemas/WorkerDeploymentVersion' + behavior: + enum: + - VERSIONING_BEHAVIOR_UNSPECIFIED + - VERSIONING_BEHAVIOR_PINNED + - VERSIONING_BEHAVIOR_AUTO_UPGRADE + type: string + format: enum StartBatchOperationRequest: type: object properties: @@ -13093,14 +13105,14 @@ components: description: Priority metadata parentVersioningInfo: allOf: - - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' description: |- When present, this is a child workflow of a versioned parent. If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the parent's Version, the child workflow will inherit the parent's Version. previousRunVersioningInfo: allOf: - - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' description: |- When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. @@ -13109,20 +13121,12 @@ components: and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will inherit the previous workflow's version. - If initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version. + If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the + previous workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned + ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain. + + If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. description: Always the first event in workflow history - WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo: - type: object - properties: - deploymentVersion: - $ref: '#/components/schemas/WorkerDeploymentVersion' - behavior: - enum: - - VERSIONING_BEHAVIOR_UNSPECIFIED - - VERSIONING_BEHAVIOR_PINNED - - VERSIONING_BEHAVIOR_AUTO_UPGRADE - type: string - format: enum WorkflowExecutionTerminatedEventAttributes: type: object properties: @@ -13328,6 +13332,14 @@ components: worker's task completion response. Pending activities will not start new attempts during a transition. Once the transition is completed, pending activities will start their next attempt on the new version. + sourceWorkflowVersioningInfo: + allOf: + - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' + description: |- + When present, this workflow execution is the child of a versioned parent, or is part of + a ContinueAsNew chain and the previous workflow in the chain was versioned. + If this workflow retries and the source is PINNED, the new retry workflow will inherit the + Version of the source workflow. description: |- Holds all the information about worker versioning for a particular workflow execution. Experimental. Versioning info is experimental and might change in the future. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 281f2053c..ffe5e1837 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -142,7 +142,7 @@ message WorkflowExecutionStartedEventAttributes { // When present, this is a child workflow of a versioned parent. // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the // parent's Version, the child workflow will inherit the parent's Version. - SourceWorkflowVersioningInfo parent_versioning_info = 37; + temporal.api.workflow.v1.SourceWorkflowVersioningInfo parent_versioning_info = 37; // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. // The `initiator` field of this event specifies why this new workflow was initiated. @@ -151,13 +151,12 @@ message WorkflowExecutionStartedEventAttributes { // and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will // inherit the previous workflow's version. // - // If initiated by a workflow retry or Cron, the new workflow will never inherit the previous workflow's Version. - SourceWorkflowVersioningInfo previous_run_versioning_info = 38; - } - - message SourceWorkflowVersioningInfo { - temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; - temporal.api.enums.v1.VersioningBehavior behavior = 2; + // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the + // previous workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned + // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain. + // + // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. + temporal.api.workflow.v1.SourceWorkflowVersioningInfo previous_run_versioning_info = 38; } } diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index b729ec8e3..f2962a36a 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -207,6 +207,16 @@ message WorkflowExecutionVersioningInfo { // Pending activities will not start new attempts during a transition. Once the transition is // completed, pending activities will start their next attempt on the new version. DeploymentVersionTransition version_transition = 6; + // When present, this workflow execution is the child of a versioned parent, or is part of + // a ContinueAsNew chain and the previous workflow in the chain was versioned. + // If this workflow retries and the source is PINNED, the new retry workflow will inherit the + // Version of the source workflow. + SourceWorkflowVersioningInfo source_workflow_versioning_info = 8; +} + +message SourceWorkflowVersioningInfo { + temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; + temporal.api.enums.v1.VersioningBehavior behavior = 2; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From ae6f503d615888b8c2082dc20a9759408e40c460 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 14 May 2025 15:49:14 -0700 Subject: [PATCH 07/14] improve comment --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 5 +++-- temporal/api/history/v1/message.proto | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 9b835007b..d552adbe1 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15576,7 +15576,7 @@ }, "previousRunVersioningInfo": { "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain.\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version." + "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n(see `ExecutionInfo.versioning_info.source_workflow_versioning_info`).\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index ecd5bfe07..386488d44 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13122,8 +13122,9 @@ components: inherit the previous workflow's version. If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the - previous workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned - ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain. + previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned + ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain + (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. description: Always the first event in workflow history diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index ffe5e1837..273c564f5 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -152,8 +152,9 @@ message WorkflowExecutionStartedEventAttributes { // inherit the previous workflow's version. // // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the - // previous workflow's Version, but, if the previous workflow has a Pinned parent or is part of a Pinned - // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain. + // previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned + // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain + // (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). // // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. temporal.api.workflow.v1.SourceWorkflowVersioningInfo previous_run_versioning_info = 38; From cff791e9fa597068d65d368ebce2e45ed94d9a16 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 14 May 2025 16:08:24 -0700 Subject: [PATCH 08/14] remove oneof since a CaN can also be a child --- openapi/openapiv2.json | 4 +-- openapi/openapiv3.yaml | 4 +++ temporal/api/history/v1/message.proto | 46 +++++++++++++-------------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index d552adbe1..99e5ce56c 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15572,11 +15572,11 @@ }, "parentVersioningInfo": { "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", - "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version." + "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." }, "previousRunVersioningInfo": { "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n(see `ExecutionInfo.versioning_info.source_workflow_versioning_info`).\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version." + "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n(see `ExecutionInfo.versioning_info.source_workflow_versioning_info`).\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 386488d44..50f56cd7d 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13110,6 +13110,8 @@ components: When present, this is a child workflow of a versioned parent. If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the parent's Version, the child workflow will inherit the parent's Version. + + If a versioning override is present, it will take precedence over the inherited base version. previousRunVersioningInfo: allOf: - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' @@ -13127,6 +13129,8 @@ components: (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. + + If a versioning override is present, it will take precedence over the inherited base version. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 273c564f5..3611d5ad8 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -134,31 +134,29 @@ message WorkflowExecutionStartedEventAttributes { reserved 36; reserved "parent_pinned_deployment_version"; - // Specifies the versioning information of the source workflow, if this workflow was started - // by a parent of as part of a chain. - // The base versioning info of the source workflow may or may not be inherited. + // When present, this is a child workflow of a versioned parent. + // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + // parent's Version, the child workflow will inherit the parent's Version. + // // If a versioning override is present, it will take precedence over the inherited base version. - oneof source_workflow_versioning_info { - // When present, this is a child workflow of a versioned parent. - // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the - // parent's Version, the child workflow will inherit the parent's Version. - temporal.api.workflow.v1.SourceWorkflowVersioningInfo parent_versioning_info = 37; - - // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. - // The `initiator` field of this event specifies why this new workflow was initiated. - // - // If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, - // and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will - // inherit the previous workflow's version. - // - // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the - // previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned - // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain - // (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). - // - // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. - temporal.api.workflow.v1.SourceWorkflowVersioningInfo previous_run_versioning_info = 38; - } + temporal.api.workflow.v1.SourceWorkflowVersioningInfo parent_versioning_info = 37; + + // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. + // The `initiator` field of this event specifies why this new workflow was initiated. + // + // If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, + // and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will + // inherit the previous workflow's version. + // + // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the + // previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned + // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain + // (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). + // + // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. + // + // If a versioning override is present, it will take precedence over the inherited base version. + temporal.api.workflow.v1.SourceWorkflowVersioningInfo previous_run_versioning_info = 38; } message WorkflowExecutionCompletedEventAttributes { From dfff5e2f796807fa7ec90e35f9ac7b9cb8e87b03 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 14 May 2025 16:27:40 -0700 Subject: [PATCH 09/14] remove unecesary field from versioning info --- openapi/openapiv2.json | 32 ++++++++++------------ openapi/openapiv3.yaml | 37 ++++++++++---------------- temporal/api/history/v1/message.proto | 10 ++++--- temporal/api/workflow/v1/message.proto | 10 ------- 4 files changed, 35 insertions(+), 54 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 99e5ce56c..16986bf77 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7174,6 +7174,17 @@ }, "description": "RequestIdReference is a indirect reference to a history event through the request ID." }, + "WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo": { + "type": "object", + "properties": { + "deploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion" + }, + "behavior": { + "$ref": "#/definitions/v1VersioningBehavior" + } + } + }, "WorkflowRuleActionActionActivityPause": { "type": "object" }, @@ -13646,17 +13657,6 @@ "v1SignalWorkflowExecutionResponse": { "type": "object" }, - "v1SourceWorkflowVersioningInfo": { - "type": "object", - "properties": { - "deploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion" - }, - "behavior": { - "$ref": "#/definitions/v1VersioningBehavior" - } - } - }, "v1StartBatchOperationResponse": { "type": "object" }, @@ -15571,12 +15571,12 @@ "title": "Priority metadata" }, "parentVersioningInfo": { - "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", + "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." }, "previousRunVersioningInfo": { - "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n(see `ExecutionInfo.versioning_info.source_workflow_versioning_info`).\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." + "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", + "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." } }, "title": "Always the first event in workflow history" @@ -15733,10 +15733,6 @@ "versionTransition": { "$ref": "#/definitions/v1DeploymentVersionTransition", "description": "When present, indicates the workflow is transitioning to a different deployment version\n(which may belong to the same deployment name or another). Can indicate one of the following\ntransitions: unversioned -> versioned, versioned -> versioned\non a different deployment version, or versioned -> unversioned.\nNot applicable to workflows with PINNED behavior.\nWhen a workflow with AUTO_UPGRADE behavior creates a new workflow task, it will automatically\nstart a transition to the task queue's current version if the task queue's current version is\ndifferent from the workflow's current deployment version.\nIf the AUTO_UPGRADE workflow is stuck due to backlogged activity or workflow tasks, those\ntasks will be redirected to the task queue's current version. As soon as a poller from\nthat deployment version is available to receive the task, the workflow will automatically\nstart a transition to that version and continue execution there.\nA version transition can only exist while there is a pending or started workflow task.\nOnce the pending workflow task completes on the transition's target version, the\ntransition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the\nworker's task completion response.\nPending activities will not start new attempts during a transition. Once the transition is\ncompleted, pending activities will start their next attempt on the new version." - }, - "sourceWorkflowVersioningInfo": { - "$ref": "#/definitions/v1SourceWorkflowVersioningInfo", - "description": "When present, this workflow execution is the child of a versioned parent, or is part of\na ContinueAsNew chain and the previous workflow in the chain was versioned.\nIf this workflow retries and the source is PINNED, the new retry workflow will inherit the\nVersion of the source workflow." } }, "description": "Holds all the information about worker versioning for a particular workflow execution.\nExperimental. Versioning info is experimental and might change in the future." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 50f56cd7d..1c65e6ee9 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10927,18 +10927,6 @@ components: SignalWorkflowExecutionResponse: type: object properties: {} - SourceWorkflowVersioningInfo: - type: object - properties: - deploymentVersion: - $ref: '#/components/schemas/WorkerDeploymentVersion' - behavior: - enum: - - VERSIONING_BEHAVIOR_UNSPECIFIED - - VERSIONING_BEHAVIOR_PINNED - - VERSIONING_BEHAVIOR_AUTO_UPGRADE - type: string - format: enum StartBatchOperationRequest: type: object properties: @@ -13105,7 +13093,7 @@ components: description: Priority metadata parentVersioningInfo: allOf: - - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' + - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' description: |- When present, this is a child workflow of a versioned parent. If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the @@ -13114,7 +13102,7 @@ components: If a versioning override is present, it will take precedence over the inherited base version. previousRunVersioningInfo: allOf: - - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' + - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' description: |- When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. @@ -13126,12 +13114,23 @@ components: If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain - (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. If a versioning override is present, it will take precedence over the inherited base version. description: Always the first event in workflow history + WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo: + type: object + properties: + deploymentVersion: + $ref: '#/components/schemas/WorkerDeploymentVersion' + behavior: + enum: + - VERSIONING_BEHAVIOR_UNSPECIFIED + - VERSIONING_BEHAVIOR_PINNED + - VERSIONING_BEHAVIOR_AUTO_UPGRADE + type: string + format: enum WorkflowExecutionTerminatedEventAttributes: type: object properties: @@ -13337,14 +13336,6 @@ components: worker's task completion response. Pending activities will not start new attempts during a transition. Once the transition is completed, pending activities will start their next attempt on the new version. - sourceWorkflowVersioningInfo: - allOf: - - $ref: '#/components/schemas/SourceWorkflowVersioningInfo' - description: |- - When present, this workflow execution is the child of a versioned parent, or is part of - a ContinueAsNew chain and the previous workflow in the chain was versioned. - If this workflow retries and the source is PINNED, the new retry workflow will inherit the - Version of the source workflow. description: |- Holds all the information about worker versioning for a particular workflow execution. Experimental. Versioning info is experimental and might change in the future. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 3611d5ad8..32847ae3c 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -139,7 +139,7 @@ message WorkflowExecutionStartedEventAttributes { // parent's Version, the child workflow will inherit the parent's Version. // // If a versioning override is present, it will take precedence over the inherited base version. - temporal.api.workflow.v1.SourceWorkflowVersioningInfo parent_versioning_info = 37; + SourceWorkflowVersioningInfo parent_versioning_info = 37; // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. // The `initiator` field of this event specifies why this new workflow was initiated. @@ -151,12 +151,16 @@ message WorkflowExecutionStartedEventAttributes { // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the // previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain - // (see `ExecutionInfo.versioning_info.source_workflow_versioning_info`). // // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. // // If a versioning override is present, it will take precedence over the inherited base version. - temporal.api.workflow.v1.SourceWorkflowVersioningInfo previous_run_versioning_info = 38; + SourceWorkflowVersioningInfo previous_run_versioning_info = 38; + + message SourceWorkflowVersioningInfo { + temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; + temporal.api.enums.v1.VersioningBehavior behavior = 2; + } } message WorkflowExecutionCompletedEventAttributes { diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index f2962a36a..b729ec8e3 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -207,16 +207,6 @@ message WorkflowExecutionVersioningInfo { // Pending activities will not start new attempts during a transition. Once the transition is // completed, pending activities will start their next attempt on the new version. DeploymentVersionTransition version_transition = 6; - // When present, this workflow execution is the child of a versioned parent, or is part of - // a ContinueAsNew chain and the previous workflow in the chain was versioned. - // If this workflow retries and the source is PINNED, the new retry workflow will inherit the - // Version of the source workflow. - SourceWorkflowVersioningInfo source_workflow_versioning_info = 8; -} - -message SourceWorkflowVersioningInfo { - temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; - temporal.api.enums.v1.VersioningBehavior behavior = 2; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From 6a5238628cdb99b688c4de061755b514670896e6 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Mon, 26 May 2025 18:02:38 -0700 Subject: [PATCH 10/14] add tq to SourceWorkflowVersioningInfo, don't populate prev_info if Cron --- openapi/openapiv2.json | 26 +++++++------ openapi/openapiv3.yaml | 54 ++++++++++++++++---------- temporal/api/command/v1/message.proto | 6 ++- temporal/api/history/v1/message.proto | 45 ++++++++++++--------- temporal/api/workflow/v1/message.proto | 5 ++- 5 files changed, 82 insertions(+), 54 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 625c0afb3..96e44427d 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7182,6 +7182,10 @@ }, "behavior": { "$ref": "#/definitions/v1VersioningBehavior" + }, + "taskQueue": { + "type": "string", + "description": "Task queue name of source workflow if different from started workflow." } } }, @@ -9736,7 +9740,7 @@ }, "inheritBuildId": { "type": "boolean", - "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution." + "description": "If this is set, the new execution inherits the Build ID of the current execution. Otherwise,\nthe assignment rules will be used to independently assign a Build ID to the new execution.\nDeprecated. Only considered for versioning v0.2." } } }, @@ -13720,7 +13724,7 @@ }, "inheritBuildId": { "type": "boolean", - "description": "If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment\nrules of the child's Task Queue will be used to independently assign a Build ID to it." + "description": "If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment\nrules of the child's Task Queue will be used to independently assign a Build ID to it.\nDeprecated. Only considered for versioning v0.2." }, "priority": { "$ref": "#/definitions/v1Priority", @@ -13841,7 +13845,7 @@ }, "inheritBuildId": { "type": "boolean", - "description": "If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment\nrules of the child's Task Queue will be used to independently assign a Build ID to it." + "description": "If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment\nrules of the child's Task Queue will be used to independently assign a Build ID to it.\nDeprecated. Only considered for versioning v0.2." }, "priority": { "$ref": "#/definitions/v1Priority", @@ -14876,7 +14880,7 @@ "description": "Required if behavior is `PINNED`. Must be absent if behavior is not `PINNED`.\nIdentifies the worker deployment version to pin the workflow to, in the format\n\".\".\nDeprecated. Use `override.pinned.version`." } }, - "description": "Used to override the versioning behavior (and pinned deployment version, if applicable) of a\nspecific workflow execution. If set, takes precedence over the worker-sent values. See\n`WorkflowExecutionInfo.VersioningInfo` for more information. To remove the override, call\n`UpdateWorkflowExecutionOptions` with a null `VersioningOverride`, and use the `update_mask`\nto indicate that it should be mutated." + "description": "Used to override the versioning behavior (and pinned deployment version, if applicable) of a\nspecific workflow execution. If set, takes precedence over the worker-sent values. See\n`WorkflowExecutionInfo.VersioningInfo` for more information. To remove the override, call\n`UpdateWorkflowExecutionOptions` with a null `VersioningOverride`, and use the `update_mask`\nto indicate that it should be mutated.\nPinned overrides are automatically inherited by child workflows, continue-as-new workflows,\nworkflow retries, and cron workflows." }, "v1WaitPolicy": { "type": "object", @@ -15474,7 +15478,7 @@ }, "continuedExecutionRunId": { "type": "string", - "description": "Run id of the previous workflow which continued-as-new or retired or cron executed into this\nworkflow." + "description": "Run id of the previous workflow which continued-as-new or retried or cron executed into this\nworkflow." }, "initiator": { "$ref": "#/definitions/v1ContinueAsNewInitiator" @@ -15561,7 +15565,7 @@ }, "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", - "description": "Versioning override applied to this workflow when it was started." + "description": "Versioning override applied to this workflow when it was started.\nPinned overrides are automatically inherited by child workflows,\ncontinue-as-new workflows, workflow retries, and cron workflows." }, "parentPinnedWorkerDeploymentVersion": { "type": "string", @@ -15571,13 +15575,13 @@ "$ref": "#/definitions/v1Priority", "title": "Priority metadata" }, - "parentVersioningInfo": { + "previousRunVersioningInfo": { "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." + "description": "When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the\nchain was versioned. The `initiator` field of this event specifies why this new workflow was initiated.\nIf present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs\nto the previous run's Version, the new run will inherit the previous run's Version.\n\nIf initiated by a workflow ContinueAsNew, always populate.\n\nIf initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain.\n\nIf initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a\nroot workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED\nparent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the\nexisting tree or chain.\n\nIf a versioning override is present, it will take precedence over the inherited base version." }, - "previousRunVersioningInfo": { + "parentVersioningInfo": { "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a chain, and the previous workflow in the chain was versioned.\nThe `initiator` field of this event specifies why this new workflow was initiated.\n\nIf initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED,\nand the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will\ninherit the previous workflow's version.\n\nIf initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the\nprevious workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned\nContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain\n\nIf initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version.\n\nIf a versioning override is present, it will take precedence over the inherited base version." + "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf `versioning_override` is present, it will take precedence over the inherited base version.\nIf `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`." } }, "title": "Always the first event in workflow history" @@ -15725,7 +15729,7 @@ }, "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", - "description": "Present if user has set an execution-specific versioning override. This override takes\nprecedence over SDK-sent `behavior` (and `version` when override is PINNED). An\noverride can be set when starting a new execution, as well as afterwards by calling the\n`UpdateWorkflowExecutionOptions` API.\nPinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries." + "description": "Present if user has set an execution-specific versioning override. This override takes\nprecedence over SDK-sent `behavior` (and `version` when override is PINNED). An\noverride can be set when starting a new execution, as well as afterwards by calling the\n`UpdateWorkflowExecutionOptions` API.\nPinned overrides are automatically inherited by child workflows, continue-as-new workflows,\nworkflow retries, and cron workflows." }, "deploymentTransition": { "$ref": "#/definitions/v1DeploymentTransition", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index f30263b36..d77e57449 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -11082,6 +11082,7 @@ components: description: |- If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment rules of the child's Task Queue will be used to independently assign a Build ID to it. + Deprecated. Only considered for versioning v0.2. priority: allOf: - $ref: '#/components/schemas/Priority' @@ -12148,6 +12149,8 @@ components: `WorkflowExecutionInfo.VersioningInfo` for more information. To remove the override, call `UpdateWorkflowExecutionOptions` with a null `VersioningOverride`, and use the `update_mask` to indicate that it should be mutated. + Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, + workflow retries, and cron workflows. VersioningOverride_PinnedOverride: type: object properties: @@ -12967,7 +12970,7 @@ components: continuedExecutionRunId: type: string description: |- - Run id of the previous workflow which continued-as-new or retired or cron executed into this + Run id of the previous workflow which continued-as-new or retried or cron executed into this workflow. initiator: enum: @@ -13082,7 +13085,10 @@ components: versioningOverride: allOf: - $ref: '#/components/schemas/VersioningOverride' - description: Versioning override applied to this workflow when it was started. + description: |- + Versioning override applied to this workflow when it was started. + Pinned overrides are automatically inherited by child workflows, + continue-as-new workflows, workflow retries, and cron workflows. parentPinnedWorkerDeploymentVersion: type: string description: |- @@ -13096,33 +13102,35 @@ components: allOf: - $ref: '#/components/schemas/Priority' description: Priority metadata - parentVersioningInfo: - allOf: - - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' - description: |- - When present, this is a child workflow of a versioned parent. - If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the - parent's Version, the child workflow will inherit the parent's Version. - - If a versioning override is present, it will take precedence over the inherited base version. previousRunVersioningInfo: allOf: - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' description: |- - When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. - The `initiator` field of this event specifies why this new workflow was initiated. + When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the + chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. + If present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs + to the previous run's Version, the new run will inherit the previous run's Version. - If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, - and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will - inherit the previous workflow's version. + If initiated by a workflow ContinueAsNew, always populate. - If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the - previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned - ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain + If initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain. - If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. + If initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a + root workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED + parent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the + existing tree or chain. If a versioning override is present, it will take precedence over the inherited base version. + parentVersioningInfo: + allOf: + - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + description: |- + When present, this is a child workflow of a versioned parent. + If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + parent's Version, the child workflow will inherit the parent's Version. + + If `versioning_override` is present, it will take precedence over the inherited base version. + If `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`. description: Always the first event in workflow history WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo: type: object @@ -13136,6 +13144,9 @@ components: - VERSIONING_BEHAVIOR_AUTO_UPGRADE type: string format: enum + taskQueue: + type: string + description: Task queue name of source workflow if different from started workflow. WorkflowExecutionTerminatedEventAttributes: type: object properties: @@ -13296,7 +13307,8 @@ components: precedence over SDK-sent `behavior` (and `version` when override is PINNED). An override can be set when starting a new execution, as well as afterwards by calling the `UpdateWorkflowExecutionOptions` API. - Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries. + Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, + workflow retries, and cron workflows. deploymentTransition: allOf: - $ref: '#/components/schemas/DeploymentTransition' diff --git a/temporal/api/command/v1/message.proto b/temporal/api/command/v1/message.proto index 6d8ecf523..d5ccaefc3 100644 --- a/temporal/api/command/v1/message.proto +++ b/temporal/api/command/v1/message.proto @@ -176,7 +176,8 @@ message ContinueAsNewWorkflowExecutionCommandAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 14; // If this is set, the new execution inherits the Build ID of the current execution. Otherwise, // the assignment rules will be used to independently assign a Build ID to the new execution. - bool inherit_build_id = 15; + // Deprecated. Only considered for versioning v0.2. + bool inherit_build_id = 15 [deprecated = true]; // `workflow_execution_timeout` is omitted as it shouldn't be overridden from within a workflow. } @@ -206,7 +207,8 @@ message StartChildWorkflowExecutionCommandAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 16; // If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment // rules of the child's Task Queue will be used to independently assign a Build ID to it. - bool inherit_build_id = 17; + // Deprecated. Only considered for versioning v0.2. + bool inherit_build_id = 17 [deprecated = true]; // Priority metadata. If this message is not present, or any fields are not // present, they inherit the values from the workflow. temporal.api.common.v1.Priority priority = 18; diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index ce1cd18ba..c7f3e82d1 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -46,7 +46,7 @@ message WorkflowExecutionStartedEventAttributes { google.protobuf.Duration workflow_run_timeout = 8; // Timeout of a single workflow task. google.protobuf.Duration workflow_task_timeout = 9; - // Run id of the previous workflow which continued-as-new or retired or cron executed into this + // Run id of the previous workflow which continued-as-new or retried or cron executed into this // workflow. string continued_execution_run_id = 10; temporal.api.enums.v1.ContinueAsNewInitiator initiator = 11; @@ -119,6 +119,8 @@ message WorkflowExecutionStartedEventAttributes { // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv] string inherited_build_id = 32 [deprecated = true]; // Versioning override applied to this workflow when it was started. + // Pinned overrides are automatically inherited by child workflows, + // continue-as-new workflows, workflow retries, and cron workflows. temporal.api.workflow.v1.VersioningOverride versioning_override = 33; // When present, it means this is a child workflow of a parent that is Pinned to this Worker // Deployment Version. In this case, child workflow will start as Pinned to this Version instead @@ -134,32 +136,36 @@ message WorkflowExecutionStartedEventAttributes { reserved 36; reserved "parent_pinned_deployment_version"; - // When present, this is a child workflow of a versioned parent. - // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the - // parent's Version, the child workflow will inherit the parent's Version. - // - // If a versioning override is present, it will take precedence over the inherited base version. - SourceWorkflowVersioningInfo parent_versioning_info = 37; - - // When present, this workflow is part of a chain, and the previous workflow in the chain was versioned. - // The `initiator` field of this event specifies why this new workflow was initiated. + // When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the + // chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. + // If present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs + // to the previous run's Version, the new run will inherit the previous run's Version. // - // If initiated by a workflow ContinueAsNew, and the previous workflow's effective behavior is PINNED, - // and the new workflow's Task Queue belongs to the previous workflow's Version, the new workflow will - // inherit the previous workflow's version. + // If initiated by a workflow ContinueAsNew, always populate. // - // If initiated by a workflow retry on a root workflow execution, the new workflow will not inherit the - // previous workflow's Version, but, if the retried workflow has a Pinned parent or is part of a Pinned - // ContinueAsNew chain, then the new workflow will inherit the version of the existing tree or chain + // If initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain. // - // If initiated by a workflow Cron, the new workflow will never inherit the previous workflow's Version. + // If initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a + // root workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED + // parent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the + // existing tree or chain. // // If a versioning override is present, it will take precedence over the inherited base version. - SourceWorkflowVersioningInfo previous_run_versioning_info = 38; + SourceWorkflowVersioningInfo previous_run_versioning_info = 37; + + // When present, this is a child workflow of a versioned parent. + // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + // parent's Version, the child workflow will inherit the parent's Version. + // + // If `versioning_override` is present, it will take precedence over the inherited base version. + // If `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`. + SourceWorkflowVersioningInfo parent_versioning_info = 38; message SourceWorkflowVersioningInfo { temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; temporal.api.enums.v1.VersioningBehavior behavior = 2; + // Task queue name of source workflow if different from started workflow. + string task_queue = 3; } } @@ -687,7 +693,8 @@ message StartChildWorkflowExecutionInitiatedEventAttributes { temporal.api.common.v1.SearchAttributes search_attributes = 17; // If this is set, the child workflow inherits the Build ID of the parent. Otherwise, the assignment // rules of the child's Task Queue will be used to independently assign a Build ID to it. - bool inherit_build_id = 19; + // Deprecated. Only considered for versioning v0.2. + bool inherit_build_id = 19 [deprecated = true]; // Priority metadata temporal.api.common.v1.Priority priority = 20; } diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index d1cbd8c90..1d5737c79 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -167,7 +167,8 @@ message WorkflowExecutionVersioningInfo { // precedence over SDK-sent `behavior` (and `version` when override is PINNED). An // override can be set when starting a new execution, as well as afterwards by calling the // `UpdateWorkflowExecutionOptions` API. - // Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, and workflow retries. + // Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, + // workflow retries, and cron workflows. VersioningOverride versioning_override = 3; // When present, indicates the workflow is transitioning to a different deployment. Can // indicate one of the following transitions: unversioned -> versioned, versioned -> versioned @@ -535,6 +536,8 @@ message WorkflowExecutionOptions { // `WorkflowExecutionInfo.VersioningInfo` for more information. To remove the override, call // `UpdateWorkflowExecutionOptions` with a null `VersioningOverride`, and use the `update_mask` // to indicate that it should be mutated. +// Pinned overrides are automatically inherited by child workflows, continue-as-new workflows, +// workflow retries, and cron workflows. message VersioningOverride { // Indicates whether to override the workflow to be AutoUpgrade or Pinned. oneof override { From aabbb7f8372dfe38ecd797feba34e9acaae6a255 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Mon, 26 May 2025 18:21:17 -0700 Subject: [PATCH 11/14] specify that base behavior determines non-override inheritance --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 4 ++-- temporal/api/history/v1/message.proto | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 96e44427d..d81b1492c 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -15577,11 +15577,11 @@ }, "previousRunVersioningInfo": { "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the\nchain was versioned. The `initiator` field of this event specifies why this new workflow was initiated.\nIf present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs\nto the previous run's Version, the new run will inherit the previous run's Version.\n\nIf initiated by a workflow ContinueAsNew, always populate.\n\nIf initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain.\n\nIf initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a\nroot workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED\nparent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the\nexisting tree or chain.\n\nIf a versioning override is present, it will take precedence over the inherited base version." + "description": "When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the\nchain was versioned. The `initiator` field of this event specifies why this new workflow was initiated.\nIf present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs\nto the previous run's Version, the new run will inherit the previous run's Version.\n\nIf initiated by a workflow ContinueAsNew, always populate.\n\nIf initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain.\n\nIf initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a\nroot workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED\nparent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the\nexisting tree or chain.\n\nIf a versioning override is present, it will take precedence over the inherited base version." }, "parentVersioningInfo": { "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's effective behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf `versioning_override` is present, it will take precedence over the inherited base version.\nIf `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`." + "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's base behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf `versioning_override` is present, it will take precedence over the inherited base version.\nIf `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index d77e57449..fcf595cb0 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13108,7 +13108,7 @@ components: description: |- When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. - If present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs + If present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs to the previous run's Version, the new run will inherit the previous run's Version. If initiated by a workflow ContinueAsNew, always populate. @@ -13126,7 +13126,7 @@ components: - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' description: |- When present, this is a child workflow of a versioned parent. - If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + If the parent's base behavior is PINNED, and the child's Task Queue belongs to the parent's Version, the child workflow will inherit the parent's Version. If `versioning_override` is present, it will take precedence over the inherited base version. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index c7f3e82d1..076e65129 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -138,7 +138,7 @@ message WorkflowExecutionStartedEventAttributes { // When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the // chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. - // If present, and the previous run's effective behavior is PINNED, and the new run's Task Queue belongs + // If present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs // to the previous run's Version, the new run will inherit the previous run's Version. // // If initiated by a workflow ContinueAsNew, always populate. @@ -154,7 +154,7 @@ message WorkflowExecutionStartedEventAttributes { SourceWorkflowVersioningInfo previous_run_versioning_info = 37; // When present, this is a child workflow of a versioned parent. - // If the parent's effective behavior is PINNED, and the child's Task Queue belongs to the + // If the parent's base behavior is PINNED, and the child's Task Queue belongs to the // parent's Version, the child workflow will inherit the parent's Version. // // If `versioning_override` is present, it will take precedence over the inherited base version. From f1f6ec8636b7894627cfc5200b7a091a8e0c080f Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Mon, 26 May 2025 20:29:00 -0700 Subject: [PATCH 12/14] add comment --- openapi/openapiv2.json | 3 ++- openapi/openapiv3.yaml | 1 + temporal/api/history/v1/message.proto | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index d81b1492c..6f6e2fce0 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7181,7 +7181,8 @@ "$ref": "#/definitions/v1WorkerDeploymentVersion" }, "behavior": { - "$ref": "#/definitions/v1VersioningBehavior" + "$ref": "#/definitions/v1VersioningBehavior", + "description": "Base versioning behavior of source workflow." }, "taskQueue": { "type": "string", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index fcf595cb0..d62afece2 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13143,6 +13143,7 @@ components: - VERSIONING_BEHAVIOR_PINNED - VERSIONING_BEHAVIOR_AUTO_UPGRADE type: string + description: Base versioning behavior of source workflow. format: enum taskQueue: type: string diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 076e65129..b21164998 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -163,6 +163,7 @@ message WorkflowExecutionStartedEventAttributes { message SourceWorkflowVersioningInfo { temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; + // Base versioning behavior of source workflow. temporal.api.enums.v1.VersioningBehavior behavior = 2; // Task queue name of source workflow if different from started workflow. string task_queue = 3; From 2d6a6d8c0d9488df851e3b290fa64de52162503b Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 28 May 2025 12:04:00 -0700 Subject: [PATCH 13/14] pass override in SourceWorkflowVersioningInfo --- openapi/openapiv2.json | 6 +++++- openapi/openapiv3.yaml | 12 ++++++++---- temporal/api/history/v1/message.proto | 6 ++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 14582b0ab..3d13ba875 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7203,6 +7203,10 @@ "taskQueue": { "type": "string", "description": "Task queue name of source workflow if different from started workflow." + }, + "pinnedOverride": { + "$ref": "#/definitions/v1VersioningOverride", + "description": "Override of source workflow if that override is pinned.\nPinned overrides are automatically inherited by child workflows,\ncontinue-as-new workflows, workflow retries, and cron workflows." } } }, @@ -15607,7 +15611,7 @@ }, "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", - "description": "Versioning override applied to this workflow when it was started.\nPinned overrides are automatically inherited by child workflows,\ncontinue-as-new workflows, workflow retries, and cron workflows." + "description": "Versioning override applied to this workflow when it was started." }, "parentPinnedWorkerDeploymentVersion": { "type": "string", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 1d96c5550..0a97feceb 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13133,10 +13133,7 @@ components: versioningOverride: allOf: - $ref: '#/components/schemas/VersioningOverride' - description: |- - Versioning override applied to this workflow when it was started. - Pinned overrides are automatically inherited by child workflows, - continue-as-new workflows, workflow retries, and cron workflows. + description: Versioning override applied to this workflow when it was started. parentPinnedWorkerDeploymentVersion: type: string description: |- @@ -13196,6 +13193,13 @@ components: taskQueue: type: string description: Task queue name of source workflow if different from started workflow. + pinnedOverride: + allOf: + - $ref: '#/components/schemas/VersioningOverride' + description: |- + Override of source workflow if that override is pinned. + Pinned overrides are automatically inherited by child workflows, + continue-as-new workflows, workflow retries, and cron workflows. WorkflowExecutionTerminatedEventAttributes: type: object properties: diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index b21164998..3fd7f6d56 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -119,8 +119,6 @@ message WorkflowExecutionStartedEventAttributes { // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv] string inherited_build_id = 32 [deprecated = true]; // Versioning override applied to this workflow when it was started. - // Pinned overrides are automatically inherited by child workflows, - // continue-as-new workflows, workflow retries, and cron workflows. temporal.api.workflow.v1.VersioningOverride versioning_override = 33; // When present, it means this is a child workflow of a parent that is Pinned to this Worker // Deployment Version. In this case, child workflow will start as Pinned to this Version instead @@ -167,6 +165,10 @@ message WorkflowExecutionStartedEventAttributes { temporal.api.enums.v1.VersioningBehavior behavior = 2; // Task queue name of source workflow if different from started workflow. string task_queue = 3; + // Override of source workflow if that override is pinned. + // Pinned overrides are automatically inherited by child workflows, + // continue-as-new workflows, workflow retries, and cron workflows. + temporal.api.workflow.v1.VersioningOverride pinned_override = 4; } } From caf4573a25465dfc3b6e2c347fa899e5ff3bf522 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Wed, 28 May 2025 13:55:55 -0700 Subject: [PATCH 14/14] all inheritance decisions on producer --- openapi/openapiv2.json | 32 ++------------ openapi/openapiv3.yaml | 63 +++++++-------------------- temporal/api/history/v1/message.proto | 45 ++++++------------- 3 files changed, 33 insertions(+), 107 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 3d13ba875..8f9389d77 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7190,26 +7190,6 @@ }, "description": "RequestIdReference is a indirect reference to a history event through the request ID." }, - "WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo": { - "type": "object", - "properties": { - "deploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion" - }, - "behavior": { - "$ref": "#/definitions/v1VersioningBehavior", - "description": "Base versioning behavior of source workflow." - }, - "taskQueue": { - "type": "string", - "description": "Task queue name of source workflow if different from started workflow." - }, - "pinnedOverride": { - "$ref": "#/definitions/v1VersioningOverride", - "description": "Override of source workflow if that override is pinned.\nPinned overrides are automatically inherited by child workflows,\ncontinue-as-new workflows, workflow retries, and cron workflows." - } - } - }, "WorkflowRuleActionActionActivityPause": { "type": "object" }, @@ -15611,7 +15591,7 @@ }, "versioningOverride": { "$ref": "#/definitions/v1VersioningOverride", - "description": "Versioning override applied to this workflow when it was started." + "description": "Versioning override applied to this workflow when it was started.\nChildren, crons, retries, and continue-as-new will inherit source run's override if pinned\nand if the new workflow's Task Queue belongs to the override version." }, "parentPinnedWorkerDeploymentVersion": { "type": "string", @@ -15621,13 +15601,9 @@ "$ref": "#/definitions/v1Priority", "title": "Priority metadata" }, - "previousRunVersioningInfo": { - "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the\nchain was versioned. The `initiator` field of this event specifies why this new workflow was initiated.\nIf present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs\nto the previous run's Version, the new run will inherit the previous run's Version.\n\nIf initiated by a workflow ContinueAsNew, always populate.\n\nIf initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain.\n\nIf initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a\nroot workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED\nparent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the\nexisting tree or chain.\n\nIf a versioning override is present, it will take precedence over the inherited base version." - }, - "parentVersioningInfo": { - "$ref": "#/definitions/WorkflowExecutionStartedEventAttributesSourceWorkflowVersioningInfo", - "description": "When present, this is a child workflow of a versioned parent.\nIf the parent's base behavior is PINNED, and the child's Task Queue belongs to the\nparent's Version, the child workflow will inherit the parent's Version.\n\nIf `versioning_override` is present, it will take precedence over the inherited base version.\nIf `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`." + "inheritedPinnedVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "If present, the new workflow should start on this version with pinned base behavior.\nChild of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\nNew run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\nnew run's Task Queue belongs to that version.\n\nNew run initiated by workflow Cron will never inherit.\n\nNew run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\nof retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\nparent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\nPinned override is inherited if Task Queue of new run is compatible with the override version.\nOverride is inherited separately and takes precedence over inherited base version." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 0a97feceb..ba83e4b38 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13133,7 +13133,10 @@ components: versioningOverride: allOf: - $ref: '#/components/schemas/VersioningOverride' - description: Versioning override applied to this workflow when it was started. + description: |- + Versioning override applied to this workflow when it was started. + Children, crons, retries, and continue-as-new will inherit source run's override if pinned + and if the new workflow's Task Queue belongs to the override version. parentPinnedWorkerDeploymentVersion: type: string description: |- @@ -13147,59 +13150,25 @@ components: allOf: - $ref: '#/components/schemas/Priority' description: Priority metadata - previousRunVersioningInfo: + inheritedPinnedVersion: allOf: - - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' + - $ref: '#/components/schemas/WorkerDeploymentVersion' description: |- - When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the - chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. - If present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs - to the previous run's Version, the new run will inherit the previous run's Version. - - If initiated by a workflow ContinueAsNew, always populate. + If present, the new workflow should start on this version with pinned base behavior. + Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version. - If initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain. + New run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the + new run's Task Queue belongs to that version. - If initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a - root workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED - parent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the - existing tree or chain. + New run initiated by workflow Cron will never inherit. - If a versioning override is present, it will take precedence over the inherited base version. - parentVersioningInfo: - allOf: - - $ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo' - description: |- - When present, this is a child workflow of a versioned parent. - If the parent's base behavior is PINNED, and the child's Task Queue belongs to the - parent's Version, the child workflow will inherit the parent's Version. + New run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time + of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned + parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version). - If `versioning_override` is present, it will take precedence over the inherited base version. - If `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`. + Pinned override is inherited if Task Queue of new run is compatible with the override version. + Override is inherited separately and takes precedence over inherited base version. description: Always the first event in workflow history - WorkflowExecutionStartedEventAttributes_SourceWorkflowVersioningInfo: - type: object - properties: - deploymentVersion: - $ref: '#/components/schemas/WorkerDeploymentVersion' - behavior: - enum: - - VERSIONING_BEHAVIOR_UNSPECIFIED - - VERSIONING_BEHAVIOR_PINNED - - VERSIONING_BEHAVIOR_AUTO_UPGRADE - type: string - description: Base versioning behavior of source workflow. - format: enum - taskQueue: - type: string - description: Task queue name of source workflow if different from started workflow. - pinnedOverride: - allOf: - - $ref: '#/components/schemas/VersioningOverride' - description: |- - Override of source workflow if that override is pinned. - Pinned overrides are automatically inherited by child workflows, - continue-as-new workflows, workflow retries, and cron workflows. WorkflowExecutionTerminatedEventAttributes: type: object properties: diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 3fd7f6d56..2c77ba904 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -119,6 +119,8 @@ message WorkflowExecutionStartedEventAttributes { // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv] string inherited_build_id = 32 [deprecated = true]; // Versioning override applied to this workflow when it was started. + // Children, crons, retries, and continue-as-new will inherit source run's override if pinned + // and if the new workflow's Task Queue belongs to the override version. temporal.api.workflow.v1.VersioningOverride versioning_override = 33; // When present, it means this is a child workflow of a parent that is Pinned to this Worker // Deployment Version. In this case, child workflow will start as Pinned to this Version instead @@ -134,42 +136,21 @@ message WorkflowExecutionStartedEventAttributes { reserved 36; reserved "parent_pinned_deployment_version"; - // When present, this workflow is part of a retry and/or ContinueAsNew chain, and the previous run in the - // chain was versioned. The `initiator` field of this event specifies why this new workflow was initiated. - // If present, and the previous run's base behavior is PINNED, and the new run's Task Queue belongs - // to the previous run's Version, the new run will inherit the previous run's Version. + // If present, the new workflow should start on this version with pinned base behavior. + // Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version. // - // If initiated by a workflow ContinueAsNew, always populate. + // New run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the + // new run's Task Queue belongs to that version. // - // If initiated by a workflow Cron, never populate, because new cron workflows should start their own version chain. + // New run initiated by workflow Cron will never inherit. // - // If initiated by a workflow retry, pass the retried run's `previous_run_versioning_info`, because a retry of a - // root workflow or Cron workflow should not inherit the Pinned Version, but if the retried workflow has a PINNED - // parent or is part of a Pinned continue-as-new chain, the the new workflow should inherit the version of the - // existing tree or chain. + // New run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time + // of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned + // parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version). // - // If a versioning override is present, it will take precedence over the inherited base version. - SourceWorkflowVersioningInfo previous_run_versioning_info = 37; - - // When present, this is a child workflow of a versioned parent. - // If the parent's base behavior is PINNED, and the child's Task Queue belongs to the - // parent's Version, the child workflow will inherit the parent's Version. - // - // If `versioning_override` is present, it will take precedence over the inherited base version. - // If `previous_run_versioning_info` is present, it will take precedence over `parent_versioning_info`. - SourceWorkflowVersioningInfo parent_versioning_info = 38; - - message SourceWorkflowVersioningInfo { - temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1; - // Base versioning behavior of source workflow. - temporal.api.enums.v1.VersioningBehavior behavior = 2; - // Task queue name of source workflow if different from started workflow. - string task_queue = 3; - // Override of source workflow if that override is pinned. - // Pinned overrides are automatically inherited by child workflows, - // continue-as-new workflows, workflow retries, and cron workflows. - temporal.api.workflow.v1.VersioningOverride pinned_override = 4; - } + // Pinned override is inherited if Task Queue of new run is compatible with the override version. + // Override is inherited separately and takes precedence over inherited base version. + temporal.api.deployment.v1.WorkerDeploymentVersion inherited_pinned_version = 37; } message WorkflowExecutionCompletedEventAttributes {