From ddb4d71b8cf6699ae78bb702f414bc30f5588a48 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Thu, 19 Feb 2026 14:57:12 -0500 Subject: [PATCH 1/9] initial --- openapi/openapiv2.json | 4 ++++ openapi/openapiv3.yaml | 14 ++++++++++++++ temporal/api/workflow/v1/message.proto | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index fee4fdf00..767a7d387 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17825,6 +17825,10 @@ "type": "string", "format": "int64", "description": "Monotonic counter reflecting the latest routing decision for this workflow execution.\nUsed for staleness detection between history and matching when dispatching tasks to workers.\nIncremented when a workflow execution routes to a new deployment version, which happens\nwhen a worker of the new deployment version completes a workflow task.\nNote: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\nface the problem of inconsistent dispatching that arises from eventual consistency between\ntask queues and their partitions." + }, + "targetVersionOnStart": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "The target deployment version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That\nflag signals pinned workflows that the task queue's current deployment version has\nchanged, allowing them to continue-as-new onto the latest version. Without this\nanchor, the comparison falls back to the workflow's effective deployment, which for\npinned workflows permanently differs from the routing target after a version change,\ncausing the flag to stay true indefinitely and triggering infinite continue-as-new\nloops." } }, "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 e0283c283..2a847e6cd 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16669,6 +16669,20 @@ components: Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not face the problem of inconsistent dispatching that arises from eventual consistency between task queues and their partitions. + targetVersionOnStart: + allOf: + - $ref: '#/components/schemas/WorkerDeploymentVersion' + description: |- + The target deployment version (from the task queue's routing config) observed on the + very first workflow task of this run. On each subsequent workflow task, this value is + compared against the current target deployment version, which is fetched from the task queue's routing config, + to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That + flag signals pinned workflows that the task queue's current deployment version has + changed, allowing them to continue-as-new onto the latest version. Without this + anchor, the comparison falls back to the workflow's effective deployment, which for + pinned workflows permanently differs from the routing target after a version change, + causing the flag to stay true indefinitely and triggering infinite continue-as-new + loops. 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/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index 40753b2ce..aea7c4e82 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -232,6 +232,17 @@ message WorkflowExecutionVersioningInfo { // face the problem of inconsistent dispatching that arises from eventual consistency between // task queues and their partitions. int64 revision_number = 8; + // The target deployment version (from the task queue's routing config) observed on the + // very first workflow task of this run. On each subsequent workflow task, this value is + // compared against the current target deployment version, which is fetched from the task queue's routing config, + // to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That + // flag signals pinned workflows that the task queue's current deployment version has + // changed, allowing them to continue-as-new onto the latest version. Without this + // anchor, the comparison falls back to the workflow's effective deployment, which for + // pinned workflows permanently differs from the routing target after a version change, + // causing the flag to stay true indefinitely and triggering infinite continue-as-new + // loops. + temporal.api.deployment.v1.WorkerDeploymentVersion target_version_on_start = 9; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From ec0b54c6db919d2e1ff6882a16e0ebf244bab199 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Fri, 20 Feb 2026 09:55:11 -0500 Subject: [PATCH 2/9] adding the field to the event so that reconstruction is possible --- openapi/openapiv2.json | 4 ++++ openapi/openapiv3.yaml | 8 ++++++++ temporal/api/history/v1/message.proto | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 767a7d387..9c2c3d89c 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -18200,6 +18200,10 @@ "type": "boolean", "description": "True if Workflow's Target Worker Deployment Version is different from its Pinned Version and\nthe workflow is Pinned.\nExperimental." }, + "targetWorkerDeploymentVersionOnStart": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "The target Worker Deployment Version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent." + }, "historySizeBytes": { "type": "string", "format": "int64", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 2a847e6cd..05d6f66e4 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -17095,6 +17095,14 @@ components: True if Workflow's Target Worker Deployment Version is different from its Pinned Version and the workflow is Pinned. Experimental. + targetWorkerDeploymentVersionOnStart: + allOf: + - $ref: '#/components/schemas/WorkerDeploymentVersion' + description: |- + The target Worker Deployment Version (from the task queue's routing config) observed on the + very first workflow task of this run. On each subsequent workflow task, this value is + compared against the current target deployment version, which is fetched from the task queue's routing config, + to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. historySizeBytes: type: string description: |- diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 2fb99f7e9..d893c27a6 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -284,6 +284,11 @@ message WorkflowTaskStartedEventAttributes { // the workflow is Pinned. // Experimental. bool target_worker_deployment_version_changed = 9; + // The target Worker Deployment Version (from the task queue's routing config) observed on the + // very first workflow task of this run. On each subsequent workflow task, this value is + // compared against the current target deployment version, which is fetched from the task queue's routing config, + // to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. + temporal.api.deployment.v1.WorkerDeploymentVersion target_worker_deployment_version_on_start = 10; // Total history size in bytes, which the workflow might use to decide when to // continue-as-new regardless of the suggestion. Note that history event count is // just the event id of this event, so we don't include it explicitly here. From 11c71d9b5d21725238654d5eeb01f0b4eba8f2e7 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Fri, 20 Feb 2026 10:04:38 -0500 Subject: [PATCH 3/9] some cleanup --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 4 ++-- temporal/api/workflow/v1/message.proto | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 9c2c3d89c..d27a50db1 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17826,9 +17826,9 @@ "format": "int64", "description": "Monotonic counter reflecting the latest routing decision for this workflow execution.\nUsed for staleness detection between history and matching when dispatching tasks to workers.\nIncremented when a workflow execution routes to a new deployment version, which happens\nwhen a worker of the new deployment version completes a workflow task.\nNote: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\nface the problem of inconsistent dispatching that arises from eventual consistency between\ntask queues and their partitions." }, - "targetVersionOnStart": { + "targetWorkerDeploymentVersionOnStart": { "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The target deployment version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That\nflag signals pinned workflows that the task queue's current deployment version has\nchanged, allowing them to continue-as-new onto the latest version. Without this\nanchor, the comparison falls back to the workflow's effective deployment, which for\npinned workflows permanently differs from the routing target after a version change,\ncausing the flag to stay true indefinitely and triggering infinite continue-as-new\nloops." + "description": "The target Worker Deployment Version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That\nflag signals pinned workflows that the task queue's current deployment version has\nchanged, allowing them to continue-as-new onto the latest version. Without this\nanchor, the comparison falls back to the workflow's effective deployment, which for\npinned workflows permanently differs from the routing target after a version change,\ncausing the flag to stay true indefinitely and triggering infinite continue-as-new\nloops." } }, "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 05d6f66e4..921a120bc 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16669,11 +16669,11 @@ components: Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not face the problem of inconsistent dispatching that arises from eventual consistency between task queues and their partitions. - targetVersionOnStart: + targetWorkerDeploymentVersionOnStart: allOf: - $ref: '#/components/schemas/WorkerDeploymentVersion' description: |- - The target deployment version (from the task queue's routing config) observed on the + The target Worker Deployment Version (from the task queue's routing config) observed on the very first workflow task of this run. On each subsequent workflow task, this value is compared against the current target deployment version, which is fetched from the task queue's routing config, to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index aea7c4e82..ccb2a394c 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -232,7 +232,7 @@ message WorkflowExecutionVersioningInfo { // face the problem of inconsistent dispatching that arises from eventual consistency between // task queues and their partitions. int64 revision_number = 8; - // The target deployment version (from the task queue's routing config) observed on the + // The target Worker Deployment Version (from the task queue's routing config) observed on the // very first workflow task of this run. On each subsequent workflow task, this value is // compared against the current target deployment version, which is fetched from the task queue's routing config, // to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That @@ -242,7 +242,7 @@ message WorkflowExecutionVersioningInfo { // pinned workflows permanently differs from the routing target after a version change, // causing the flag to stay true indefinitely and triggering infinite continue-as-new // loops. - temporal.api.deployment.v1.WorkerDeploymentVersion target_version_on_start = 9; + temporal.api.deployment.v1.WorkerDeploymentVersion target_worker_deployment_version_on_start = 9; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From 217b6a98adb3273b61b8fab7f3c8992b51191129 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Thu, 5 Mar 2026 22:20:14 -0500 Subject: [PATCH 4/9] changes --- temporal/api/history/v1/message.proto | 14 +++++++++----- temporal/api/workflow/v1/message.proto | 26 +++++++++++++++----------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index d893c27a6..e7e2435f3 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -184,6 +184,15 @@ message WorkflowExecutionStartedEventAttributes { // eager execution was accepted by the server. // Only populated by server with version >= 1.29.0. bool eager_execution_accepted = 38; + + // The latest target Worker Deployment Version that matching had resolved + // for the previous run before this workflow execution commenced. Populated + // by the server during continue-as-new from the previous run's + // latest_target_worker_deployment_version on its versioning info. Used to + // detect whether the routing target has changed since this run started, + // preventing infinite continue-as-new loops for pinned workflows that do + // not have initial CaN behavior set as AutoUpgrade. Nil for fresh starts. + temporal.api.deployment.v1.WorkerDeploymentVersion previous_run_target_worker_deployment_version = 40; } message WorkflowExecutionCompletedEventAttributes { @@ -284,11 +293,6 @@ message WorkflowTaskStartedEventAttributes { // the workflow is Pinned. // Experimental. bool target_worker_deployment_version_changed = 9; - // The target Worker Deployment Version (from the task queue's routing config) observed on the - // very first workflow task of this run. On each subsequent workflow task, this value is - // compared against the current target deployment version, which is fetched from the task queue's routing config, - // to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. - temporal.api.deployment.v1.WorkerDeploymentVersion target_worker_deployment_version_on_start = 10; // Total history size in bytes, which the workflow might use to decide when to // continue-as-new regardless of the suggestion. Note that history event count is // just the event id of this event, so we don't include it explicitly here. diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index ccb2a394c..2134d8eb8 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -232,17 +232,21 @@ message WorkflowExecutionVersioningInfo { // face the problem of inconsistent dispatching that arises from eventual consistency between // task queues and their partitions. int64 revision_number = 8; - // The target Worker Deployment Version (from the task queue's routing config) observed on the - // very first workflow task of this run. On each subsequent workflow task, this value is - // compared against the current target deployment version, which is fetched from the task queue's routing config, - // to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That - // flag signals pinned workflows that the task queue's current deployment version has - // changed, allowing them to continue-as-new onto the latest version. Without this - // anchor, the comparison falls back to the workflow's effective deployment, which for - // pinned workflows permanently differs from the routing target after a version change, - // causing the flag to stay true indefinitely and triggering infinite continue-as-new - // loops. - temporal.api.deployment.v1.WorkerDeploymentVersion target_worker_deployment_version_on_start = 9; + // The most recent target Worker Deployment Version received from matching, + // updated on every workflow task start. When matching dispatches a workflow + // task, it compares the polling worker's deployment version against the task + // queue's routing target. If they differ, matching sends the routing target + // as target_deployment_version alongside the workflow task. This field + // stores that value. + // + // This field exists so that when a workflow continues-as-new, the new run + // can know what the routing target was at the end of the previous run. + // Specifically, it is copied into the new run's WorkflowExecutionStartedEvent, + // enabling the new run to detect whether the routing target has actually + // changed since it started — which is how we prevent infinite + // continue-as-new loops for pinned workflows that do not have initial + // CaN behavior set as AutoUpgrade. + temporal.api.deployment.v1.WorkerDeploymentVersion latest_target_worker_deployment_version = 9; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From c69139f39a55419a2643f599dab0b9256acb469a Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Thu, 5 Mar 2026 22:31:24 -0500 Subject: [PATCH 5/9] regen --- openapi/openapiv2.json | 12 +++++------ openapi/openapiv3.yaml | 45 ++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index d27a50db1..2bf915253 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17645,6 +17645,10 @@ "eagerExecutionAccepted": { "type": "boolean", "description": "A boolean indicating whether the SDK has asked to eagerly execute the first workflow task for this workflow and\neager execution was accepted by the server.\nOnly populated by server with version >= 1.29.0." + }, + "previousRunTargetWorkerDeploymentVersion": { + "$ref": "#/definitions/v1WorkerDeploymentVersion", + "description": "The latest target Worker Deployment Version that matching had resolved\nfor the previous run before this workflow execution commenced. Populated\nby the server during continue-as-new from the previous run's\nlatest_target_worker_deployment_version on its versioning info. Used to\ndetect whether the routing target has changed since this run started,\npreventing infinite continue-as-new loops for pinned workflows that do\nnot have initial CaN behavior set as AutoUpgrade. Nil for fresh starts." } }, "title": "Always the first event in workflow history" @@ -17826,9 +17830,9 @@ "format": "int64", "description": "Monotonic counter reflecting the latest routing decision for this workflow execution.\nUsed for staleness detection between history and matching when dispatching tasks to workers.\nIncremented when a workflow execution routes to a new deployment version, which happens\nwhen a worker of the new deployment version completes a workflow task.\nNote: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\nface the problem of inconsistent dispatching that arises from eventual consistency between\ntask queues and their partitions." }, - "targetWorkerDeploymentVersionOnStart": { + "latestTargetWorkerDeploymentVersion": { "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The target Worker Deployment Version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That\nflag signals pinned workflows that the task queue's current deployment version has\nchanged, allowing them to continue-as-new onto the latest version. Without this\nanchor, the comparison falls back to the workflow's effective deployment, which for\npinned workflows permanently differs from the routing target after a version change,\ncausing the flag to stay true indefinitely and triggering infinite continue-as-new\nloops." + "description": "The most recent target Worker Deployment Version received from matching,\nupdated on every workflow task start. When matching dispatches a workflow\ntask, it compares the polling worker's deployment version against the task\nqueue's routing target. If they differ, matching sends the routing target\nas target_deployment_version alongside the workflow task. This field\nstores that value.\n\nThis field exists so that when a workflow continues-as-new, the new run\ncan know what the routing target was at the end of the previous run.\nSpecifically, it is copied into the new run's WorkflowExecutionStartedEvent,\nenabling the new run to detect whether the routing target has actually\nchanged since it started — which is how we prevent infinite\ncontinue-as-new loops for pinned workflows that do not have initial\nCaN behavior set as AutoUpgrade." } }, "description": "Holds all the information about worker versioning for a particular workflow execution.\nExperimental. Versioning info is experimental and might change in the future." @@ -18200,10 +18204,6 @@ "type": "boolean", "description": "True if Workflow's Target Worker Deployment Version is different from its Pinned Version and\nthe workflow is Pinned.\nExperimental." }, - "targetWorkerDeploymentVersionOnStart": { - "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The target Worker Deployment Version (from the task queue's routing config) observed on the\nvery first workflow task of this run. On each subsequent workflow task, this value is\ncompared against the current target deployment version, which is fetched from the task queue's routing config,\nto compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent." - }, "historySizeBytes": { "type": "string", "format": "int64", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 921a120bc..a807bd3cb 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16459,6 +16459,17 @@ components: A boolean indicating whether the SDK has asked to eagerly execute the first workflow task for this workflow and eager execution was accepted by the server. Only populated by server with version >= 1.29.0. + previousRunTargetWorkerDeploymentVersion: + allOf: + - $ref: '#/components/schemas/WorkerDeploymentVersion' + description: |- + The latest target Worker Deployment Version that matching had resolved + for the previous run before this workflow execution commenced. Populated + by the server during continue-as-new from the previous run's + latest_target_worker_deployment_version on its versioning info. Used to + detect whether the routing target has changed since this run started, + preventing infinite continue-as-new loops for pinned workflows that do + not have initial CaN behavior set as AutoUpgrade. Nil for fresh starts. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object @@ -16669,20 +16680,24 @@ components: Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not face the problem of inconsistent dispatching that arises from eventual consistency between task queues and their partitions. - targetWorkerDeploymentVersionOnStart: + latestTargetWorkerDeploymentVersion: allOf: - $ref: '#/components/schemas/WorkerDeploymentVersion' description: |- - The target Worker Deployment Version (from the task queue's routing config) observed on the - very first workflow task of this run. On each subsequent workflow task, this value is - compared against the current target deployment version, which is fetched from the task queue's routing config, - to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. That - flag signals pinned workflows that the task queue's current deployment version has - changed, allowing them to continue-as-new onto the latest version. Without this - anchor, the comparison falls back to the workflow's effective deployment, which for - pinned workflows permanently differs from the routing target after a version change, - causing the flag to stay true indefinitely and triggering infinite continue-as-new - loops. + The most recent target Worker Deployment Version received from matching, + updated on every workflow task start. When matching dispatches a workflow + task, it compares the polling worker's deployment version against the task + queue's routing target. If they differ, matching sends the routing target + as target_deployment_version alongside the workflow task. This field + stores that value. + + This field exists so that when a workflow continues-as-new, the new run + can know what the routing target was at the end of the previous run. + Specifically, it is copied into the new run's WorkflowExecutionStartedEvent, + enabling the new run to detect whether the routing target has actually + changed since it started — which is how we prevent infinite + continue-as-new loops for pinned workflows that do not have initial + CaN behavior set as AutoUpgrade. description: |- Holds all the information about worker versioning for a particular workflow execution. Experimental. Versioning info is experimental and might change in the future. @@ -17095,14 +17110,6 @@ components: True if Workflow's Target Worker Deployment Version is different from its Pinned Version and the workflow is Pinned. Experimental. - targetWorkerDeploymentVersionOnStart: - allOf: - - $ref: '#/components/schemas/WorkerDeploymentVersion' - description: |- - The target Worker Deployment Version (from the task queue's routing config) observed on the - very first workflow task of this run. On each subsequent workflow task, this value is - compared against the current target deployment version, which is fetched from the task queue's routing config, - to compute the `target_worker_deployment_version_changed` flag in WorkflowTaskStartedEvent. historySizeBytes: type: string description: |- From 3bf80d4610c0f66aa300fe54bb92362dd641fbca Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Thu, 5 Mar 2026 22:34:16 -0500 Subject: [PATCH 6/9] fix typo --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 2 +- temporal/api/history/v1/message.proto | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 2bf915253..4f0adf95f 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17646,7 +17646,7 @@ "type": "boolean", "description": "A boolean indicating whether the SDK has asked to eagerly execute the first workflow task for this workflow and\neager execution was accepted by the server.\nOnly populated by server with version >= 1.29.0." }, - "previousRunTargetWorkerDeploymentVersion": { + "previousRunLatestTargetWorkerDeploymentVersion": { "$ref": "#/definitions/v1WorkerDeploymentVersion", "description": "The latest target Worker Deployment Version that matching had resolved\nfor the previous run before this workflow execution commenced. Populated\nby the server during continue-as-new from the previous run's\nlatest_target_worker_deployment_version on its versioning info. Used to\ndetect whether the routing target has changed since this run started,\npreventing infinite continue-as-new loops for pinned workflows that do\nnot have initial CaN behavior set as AutoUpgrade. Nil for fresh starts." } diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index a807bd3cb..22f14e24e 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16459,7 +16459,7 @@ components: A boolean indicating whether the SDK has asked to eagerly execute the first workflow task for this workflow and eager execution was accepted by the server. Only populated by server with version >= 1.29.0. - previousRunTargetWorkerDeploymentVersion: + previousRunLatestTargetWorkerDeploymentVersion: allOf: - $ref: '#/components/schemas/WorkerDeploymentVersion' description: |- diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index e7e2435f3..b8a16f2b6 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -192,7 +192,7 @@ message WorkflowExecutionStartedEventAttributes { // detect whether the routing target has changed since this run started, // preventing infinite continue-as-new loops for pinned workflows that do // not have initial CaN behavior set as AutoUpgrade. Nil for fresh starts. - temporal.api.deployment.v1.WorkerDeploymentVersion previous_run_target_worker_deployment_version = 40; + temporal.api.deployment.v1.WorkerDeploymentVersion previous_run_latest_target_worker_deployment_version = 40; } message WorkflowExecutionCompletedEventAttributes { From 9ae004e035403333d1ec770f93c246c29b8e7565 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Thu, 5 Mar 2026 23:08:34 -0500 Subject: [PATCH 7/9] have the 3 fields in the MS and only one in the workflow execution started event attributes --- openapi/openapiv2.json | 6 +---- openapi/openapiv3.yaml | 32 ++++++-------------------- temporal/api/history/v1/message.proto | 14 +++++------ temporal/api/workflow/v1/message.proto | 15 ------------ 4 files changed, 15 insertions(+), 52 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 4f0adf95f..fe40d1c2b 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17648,7 +17648,7 @@ }, "previousRunLatestTargetWorkerDeploymentVersion": { "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The latest target Worker Deployment Version that matching had resolved\nfor the previous run before this workflow execution commenced. Populated\nby the server during continue-as-new from the previous run's\nlatest_target_worker_deployment_version on its versioning info. Used to\ndetect whether the routing target has changed since this run started,\npreventing infinite continue-as-new loops for pinned workflows that do\nnot have initial CaN behavior set as AutoUpgrade. Nil for fresh starts." + "description": "The previous run's latest target Worker Deployment Version that matching\nhad resolved before this workflow execution commenced. Populated by the\nserver during continue-as-new. Used to detect whether the workflow's\nTarget Version has changed since this run started, preventing infinite\ncontinue-as-new loops for pinned workflows that do not have initial CaN\nbehavior set as AutoUpgrade. Nil for workflows that are not initiated by\na versioned workflow continuing-as-new." } }, "title": "Always the first event in workflow history" @@ -17829,10 +17829,6 @@ "type": "string", "format": "int64", "description": "Monotonic counter reflecting the latest routing decision for this workflow execution.\nUsed for staleness detection between history and matching when dispatching tasks to workers.\nIncremented when a workflow execution routes to a new deployment version, which happens\nwhen a worker of the new deployment version completes a workflow task.\nNote: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\nface the problem of inconsistent dispatching that arises from eventual consistency between\ntask queues and their partitions." - }, - "latestTargetWorkerDeploymentVersion": { - "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The most recent target Worker Deployment Version received from matching,\nupdated on every workflow task start. When matching dispatches a workflow\ntask, it compares the polling worker's deployment version against the task\nqueue's routing target. If they differ, matching sends the routing target\nas target_deployment_version alongside the workflow task. This field\nstores that value.\n\nThis field exists so that when a workflow continues-as-new, the new run\ncan know what the routing target was at the end of the previous run.\nSpecifically, it is copied into the new run's WorkflowExecutionStartedEvent,\nenabling the new run to detect whether the routing target has actually\nchanged since it started — which is how we prevent infinite\ncontinue-as-new loops for pinned workflows that do not have initial\nCaN behavior set as AutoUpgrade." } }, "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 22f14e24e..f7043fa63 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16463,13 +16463,13 @@ components: allOf: - $ref: '#/components/schemas/WorkerDeploymentVersion' description: |- - The latest target Worker Deployment Version that matching had resolved - for the previous run before this workflow execution commenced. Populated - by the server during continue-as-new from the previous run's - latest_target_worker_deployment_version on its versioning info. Used to - detect whether the routing target has changed since this run started, - preventing infinite continue-as-new loops for pinned workflows that do - not have initial CaN behavior set as AutoUpgrade. Nil for fresh starts. + The previous run's latest target Worker Deployment Version that matching + had resolved before this workflow execution commenced. Populated by the + server during continue-as-new. Used to detect whether the workflow's + Target Version has changed since this run started, preventing infinite + continue-as-new loops for pinned workflows that do not have initial CaN + behavior set as AutoUpgrade. Nil for workflows that are not initiated by + a versioned workflow continuing-as-new. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object @@ -16680,24 +16680,6 @@ components: Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not face the problem of inconsistent dispatching that arises from eventual consistency between task queues and their partitions. - latestTargetWorkerDeploymentVersion: - allOf: - - $ref: '#/components/schemas/WorkerDeploymentVersion' - description: |- - The most recent target Worker Deployment Version received from matching, - updated on every workflow task start. When matching dispatches a workflow - task, it compares the polling worker's deployment version against the task - queue's routing target. If they differ, matching sends the routing target - as target_deployment_version alongside the workflow task. This field - stores that value. - - This field exists so that when a workflow continues-as-new, the new run - can know what the routing target was at the end of the previous run. - Specifically, it is copied into the new run's WorkflowExecutionStartedEvent, - enabling the new run to detect whether the routing target has actually - changed since it started — which is how we prevent infinite - continue-as-new loops for pinned workflows that do not have initial - CaN behavior set as AutoUpgrade. 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 b8a16f2b6..39f8e7cf3 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -185,13 +185,13 @@ message WorkflowExecutionStartedEventAttributes { // Only populated by server with version >= 1.29.0. bool eager_execution_accepted = 38; - // The latest target Worker Deployment Version that matching had resolved - // for the previous run before this workflow execution commenced. Populated - // by the server during continue-as-new from the previous run's - // latest_target_worker_deployment_version on its versioning info. Used to - // detect whether the routing target has changed since this run started, - // preventing infinite continue-as-new loops for pinned workflows that do - // not have initial CaN behavior set as AutoUpgrade. Nil for fresh starts. + // The previous run's latest target Worker Deployment Version that matching + // had resolved before this workflow execution commenced. Populated by the + // server during continue-as-new. Used to detect whether the workflow's + // Target Version has changed since this run started, preventing infinite + // continue-as-new loops for pinned workflows that do not have initial CaN + // behavior set as AutoUpgrade. Nil for workflows that are not initiated by + // a versioned workflow continuing-as-new. temporal.api.deployment.v1.WorkerDeploymentVersion previous_run_latest_target_worker_deployment_version = 40; } diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index 2134d8eb8..40753b2ce 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -232,21 +232,6 @@ message WorkflowExecutionVersioningInfo { // face the problem of inconsistent dispatching that arises from eventual consistency between // task queues and their partitions. int64 revision_number = 8; - // The most recent target Worker Deployment Version received from matching, - // updated on every workflow task start. When matching dispatches a workflow - // task, it compares the polling worker's deployment version against the task - // queue's routing target. If they differ, matching sends the routing target - // as target_deployment_version alongside the workflow task. This field - // stores that value. - // - // This field exists so that when a workflow continues-as-new, the new run - // can know what the routing target was at the end of the previous run. - // Specifically, it is copied into the new run's WorkflowExecutionStartedEvent, - // enabling the new run to detect whether the routing target has actually - // changed since it started — which is how we prevent infinite - // continue-as-new loops for pinned workflows that do not have initial - // CaN behavior set as AutoUpgrade. - temporal.api.deployment.v1.WorkerDeploymentVersion latest_target_worker_deployment_version = 9; } // Holds information about ongoing transition of a workflow execution from one deployment to another. From 852e82b5c73afbfdd1f80e491f32a50019354022 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Mon, 9 Mar 2026 16:11:34 -0400 Subject: [PATCH 8/9] Add SDK-internal note to previous_run_latest_target_worker_deployment_version docstring Clarifies that this field is server-internal and should not be read by SDKs, per reviewer feedback. Co-Authored-By: Claude Opus 4.6 --- temporal/api/history/v1/message.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 39f8e7cf3..8a56ac2e9 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -192,6 +192,8 @@ message WorkflowExecutionStartedEventAttributes { // continue-as-new loops for pinned workflows that do not have initial CaN // behavior set as AutoUpgrade. Nil for workflows that are not initiated by // a versioned workflow continuing-as-new. + // This field is used internally by the server and should not be read or + // interpreted by SDKs. temporal.api.deployment.v1.WorkerDeploymentVersion previous_run_latest_target_worker_deployment_version = 40; } From 9b780357de7ff9ad86374dff9c107def6848cd50 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Mon, 9 Mar 2026 16:15:37 -0400 Subject: [PATCH 9/9] regen protos --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index fe40d1c2b..c8c00cea2 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17648,7 +17648,7 @@ }, "previousRunLatestTargetWorkerDeploymentVersion": { "$ref": "#/definitions/v1WorkerDeploymentVersion", - "description": "The previous run's latest target Worker Deployment Version that matching\nhad resolved before this workflow execution commenced. Populated by the\nserver during continue-as-new. Used to detect whether the workflow's\nTarget Version has changed since this run started, preventing infinite\ncontinue-as-new loops for pinned workflows that do not have initial CaN\nbehavior set as AutoUpgrade. Nil for workflows that are not initiated by\na versioned workflow continuing-as-new." + "description": "The previous run's latest target Worker Deployment Version that matching\nhad resolved before this workflow execution commenced. Populated by the\nserver during continue-as-new. Used to detect whether the workflow's\nTarget Version has changed since this run started, preventing infinite\ncontinue-as-new loops for pinned workflows that do not have initial CaN\nbehavior set as AutoUpgrade. Nil for workflows that are not initiated by\na versioned workflow continuing-as-new.\nThis field is used internally by the server and should not be read or\ninterpreted by SDKs." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index f7043fa63..04cf7dd95 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16470,6 +16470,8 @@ components: continue-as-new loops for pinned workflows that do not have initial CaN behavior set as AutoUpgrade. Nil for workflows that are not initiated by a versioned workflow continuing-as-new. + This field is used internally by the server and should not be read or + interpreted by SDKs. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object