From b23db7baec921c96185e5b3452dce55229cd2b49 Mon Sep 17 00:00:00 2001 From: Shahab Date: Wed, 14 Oct 2026 15:00:39 -0700 Subject: [PATCH 01/28] Add activity session_options --- temporal/api/command/v1/message.proto | 3 +++ temporal/api/session/v1/message.proto | 18 ++++++++++++++++++ .../workflowservice/v1/request_response.proto | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 temporal/api/session/v1/message.proto diff --git a/temporal/api/command/v1/message.proto b/temporal/api/command/v1/message.proto index ee839115b..b8be64315 100644 --- a/temporal/api/command/v1/message.proto +++ b/temporal/api/command/v1/message.proto @@ -16,6 +16,7 @@ import "temporal/api/enums/v1/command_type.proto"; import "temporal/api/common/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; import "temporal/api/sdk/v1/user_metadata.proto"; import "temporal/api/sdk/v1/event_group_marker.proto"; @@ -68,6 +69,8 @@ message ScheduleActivityTaskCommandAttributes { // 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 = 14; + + temporal.api.session.v1.ActivitySessionOptions session_options = 15; } message RequestCancelActivityTaskCommandAttributes { diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto new file mode 100644 index 000000000..e1e6d567e --- /dev/null +++ b/temporal/api/session/v1/message.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package temporal.api.session.v1; + +option go_package = "go.temporal.io/api/session/v1;session"; +option java_package = "io.temporal.api.session.v1"; +option java_multiple_files = true; +option java_outer_classname = "MessageProto"; +option ruby_package = "Temporalio::Api::Session::V1"; +option csharp_namespace = "Temporalio.Api.Session.V1"; + +message ActivitySessionOptions { + oneof session { + bool workflow_sticky_session = 1; + + // later session_id, etc + } +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index f4b4cdb7f..5a1c61257 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -323,6 +323,15 @@ message PollWorkflowTaskQueueRequest { // Removed in 1.55.0; was temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat reserved 7; reserved "worker_heartbeat"; + + // EXPERIMENTAL. Subject to removal in the future. + // This flag is only applicable to sticky polls. In this mode, server will stop forwarding the sticky polls to the + // normal queue once the set number of tasks are dispatched from the normal queue to pollers of this particular + // sticky queue. + // The counter is persisted in server as part of sticky task queue metadata, so server crushes will not reset the + // counter. + // (-- api-linter: core::0140::prepositions=disabled + int32 max_sticky_to_normal_forwards = 11; } message PollWorkflowTaskQueueResponse { @@ -553,6 +562,15 @@ message PollActivityTaskQueueRequest { // Removed in 1.55.0; was temporal.api.worker.v1.WorkerHeartbeat worker_heartbeat reserved 7; reserved "worker_heartbeat"; + + // EXPERIMENTAL. Subject to removal in the future. + // This flag is only applicable to sticky polls. In this mode, server will stop forwarding the sticky polls to the + // normal queue once the set number of tasks are dispatched from the normal queue to pollers of this particular + // sticky queue. + // The counter is persisted in server as part of sticky task queue metadata, so server crushes will not reset the + // counter. + // (-- api-linter: core::0140::prepositions=disabled + int32 max_sticky_to_normal_forwards = 11; } message PollActivityTaskQueueResponse { From c28c289a9dbcaba8297e5a61108c451b7d20777c Mon Sep 17 00:00:00 2001 From: Shahab Date: Thu, 15 Oct 2026 13:33:55 -0700 Subject: [PATCH 02/28] `single_workflow_mode` poll flag --- .../workflowservice/v1/request_response.proto | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 5a1c61257..892c1f3cf 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -325,13 +325,15 @@ message PollWorkflowTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to removal in the future. - // This flag is only applicable to sticky polls. In this mode, server will stop forwarding the sticky polls to the - // normal queue once the set number of tasks are dispatched from the normal queue to pollers of this particular - // sticky queue. - // The counter is persisted in server as part of sticky task queue metadata, so server crushes will not reset the - // counter. + // This flag is only applicable to sticky polls. In this mode, server will forward the workflow task sticky polls + // to the normal queue only once. The forwarding to normal queue will stop once a single task is dispatched from the + // normal queue to pollers of this particular sticky queue. + // Server persists the workflow ID of the first matched task in the sticky task queue's metadata. This will allow + // system to enforce single-workflow mode even when the server crashes, or a worker with stable identity restarts + // (when worker's sticky queue name remains the same after restart.) + // For activity sticky polls, this mode will disable forwarding to normal queue completely. // (-- api-linter: core::0140::prepositions=disabled - int32 max_sticky_to_normal_forwards = 11; + bool single_workflow_mode = 11; } message PollWorkflowTaskQueueResponse { @@ -564,13 +566,15 @@ message PollActivityTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to removal in the future. - // This flag is only applicable to sticky polls. In this mode, server will stop forwarding the sticky polls to the - // normal queue once the set number of tasks are dispatched from the normal queue to pollers of this particular - // sticky queue. - // The counter is persisted in server as part of sticky task queue metadata, so server crushes will not reset the - // counter. + // This flag is only applicable to sticky polls. In this mode, server will forward the workflow task sticky polls + // to the normal queue only once. The forwarding to normal queue will stop once a single task is dispatched from the + // normal queue to pollers of this particular sticky queue. + // Server persists the workflow ID of the first matched task in the sticky task queue's metadata. This will allow + // system to enforce single-workflow mode even when the server crashes, or a worker with stable identity restarts + // (when worker's sticky queue name remains the same after restart.) + // For activity sticky polls, this mode will disable forwarding to normal queue completely. // (-- api-linter: core::0140::prepositions=disabled - int32 max_sticky_to_normal_forwards = 11; + bool single_workflow_mode = 11; } message PollActivityTaskQueueResponse { From 7132c51e4fc1856dd17dfc2115b06649d184b214 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Mon, 19 Oct 2026 15:07:25 -0400 Subject: [PATCH 03/28] Model single-session isolation in poll session options --- temporal/api/session/v1/message.proto | 22 +++++++++++++ .../workflowservice/v1/request_response.proto | 33 ++++++++----------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index e1e6d567e..f9d174ca0 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -9,6 +9,28 @@ option java_outer_classname = "MessageProto"; option ruby_package = "Temporalio::Api::Session::V1"; option csharp_namespace = "Temporalio.Api.Session.V1"; +// EXPERIMENTAL. Subject to redesign or removal. +// Configures which sessions may share a worker, not a security boundary. +message SessionOptions { + oneof isolation { + SingleSessionOptions single_session = 1; + } +} + +// EXPERIMENTAL. Subject to redesign or removal. +// Dedicates a sticky destination to the first workflow matched to it. +// Workflow sticky polls may be forwarded to the normal queue until the first +// workflow task is dispatched. The server persists that workflow ID and does +// not forward subsequent polls, including after workflow completion. +// Activity sticky polls are never forwarded to the normal queue. +message SingleSessionOptions { + // Stable sticky task queue name, shared by workflow and activity polls. + // Reuse this value across worker restarts within the same session, but not + // across concurrently running workers. This is distinct from worker identity. + // The SDK must also set the polled sticky task queue's name to this value. + string stable_identity = 1; +} + message ActivitySessionOptions { oneof session { bool workflow_sticky_session = 1; diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 892c1f3cf..067f4fe6d 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -38,6 +38,7 @@ import "temporal/api/replication/v1/message.proto"; import "temporal/api/rules/v1/message.proto"; import "temporal/api/sdk/v1/worker_config.proto"; import "temporal/api/schedule/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/update/v1/message.proto"; import "temporal/api/version/v1/message.proto"; @@ -324,16 +325,12 @@ message PollWorkflowTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // EXPERIMENTAL. Subject to removal in the future. - // This flag is only applicable to sticky polls. In this mode, server will forward the workflow task sticky polls - // to the normal queue only once. The forwarding to normal queue will stop once a single task is dispatched from the - // normal queue to pollers of this particular sticky queue. - // Server persists the workflow ID of the first matched task in the sticky task queue's metadata. This will allow - // system to enforce single-workflow mode even when the server crashes, or a worker with stable identity restarts - // (when worker's sticky queue name remains the same after restart.) - // For activity sticky polls, this mode will disable forwarding to normal queue completely. - // (-- api-linter: core::0140::prepositions=disabled - bool single_workflow_mode = 11; + // Replaced experimental single_workflow_mode with session_options. + reserved 11; + reserved "single_workflow_mode"; + + // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + temporal.api.session.v1.SessionOptions session_options = 12; } message PollWorkflowTaskQueueResponse { @@ -565,16 +562,12 @@ message PollActivityTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // EXPERIMENTAL. Subject to removal in the future. - // This flag is only applicable to sticky polls. In this mode, server will forward the workflow task sticky polls - // to the normal queue only once. The forwarding to normal queue will stop once a single task is dispatched from the - // normal queue to pollers of this particular sticky queue. - // Server persists the workflow ID of the first matched task in the sticky task queue's metadata. This will allow - // system to enforce single-workflow mode even when the server crashes, or a worker with stable identity restarts - // (when worker's sticky queue name remains the same after restart.) - // For activity sticky polls, this mode will disable forwarding to normal queue completely. - // (-- api-linter: core::0140::prepositions=disabled - bool single_workflow_mode = 11; + // Replaced experimental single_workflow_mode with session_options. + reserved 11; + reserved "single_workflow_mode"; + + // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + temporal.api.session.v1.SessionOptions session_options = 12; } message PollActivityTaskQueueResponse { From be0506da1e5bc9b610d4220e725358824316bc1d Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Mon, 19 Oct 2026 15:12:18 -0400 Subject: [PATCH 04/28] Clarify session affinity documentation and remove dev reservations --- temporal/api/session/v1/message.proto | 4 +++- temporal/api/workflowservice/v1/request_response.proto | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index f9d174ca0..67eff7d20 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -10,7 +10,9 @@ option ruby_package = "Temporalio::Api::Session::V1"; option csharp_namespace = "Temporalio.Api.Session.V1"; // EXPERIMENTAL. Subject to redesign or removal. -// Configures which sessions may share a worker, not a security boundary. +// Configures a worker's polling for sessions that keep workflow and activity +// tasks on a stable worker destination. Activities opt into session routing +// through ActivitySessionOptions on their scheduling commands. message SessionOptions { oneof isolation { SingleSessionOptions single_session = 1; diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 067f4fe6d..09b5ffd9a 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -325,10 +325,6 @@ message PollWorkflowTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // Replaced experimental single_workflow_mode with session_options. - reserved 11; - reserved "single_workflow_mode"; - // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. temporal.api.session.v1.SessionOptions session_options = 12; } @@ -562,10 +558,6 @@ message PollActivityTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // Replaced experimental single_workflow_mode with session_options. - reserved 11; - reserved "single_workflow_mode"; - // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. temporal.api.session.v1.SessionOptions session_options = 12; } From d59dfca4732e25f120ec26bf43ef13835d95fb29 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Mon, 19 Oct 2026 15:16:47 -0400 Subject: [PATCH 05/28] Name worker session options and use next available poll tags --- temporal/api/session/v1/message.proto | 2 +- temporal/api/workflowservice/v1/request_response.proto | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 67eff7d20..78593574d 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -13,7 +13,7 @@ option csharp_namespace = "Temporalio.Api.Session.V1"; // Configures a worker's polling for sessions that keep workflow and activity // tasks on a stable worker destination. Activities opt into session routing // through ActivitySessionOptions on their scheduling commands. -message SessionOptions { +message WorkerSessionOptions { oneof isolation { SingleSessionOptions single_session = 1; } diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 09b5ffd9a..d216339cd 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -326,7 +326,7 @@ message PollWorkflowTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.SessionOptions session_options = 12; + temporal.api.session.v1.WorkerSessionOptions session_options = 11; } message PollWorkflowTaskQueueResponse { @@ -559,7 +559,7 @@ message PollActivityTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.SessionOptions session_options = 12; + temporal.api.session.v1.WorkerSessionOptions session_options = 11; } message PollActivityTaskQueueResponse { From 01c117a719e5df9c1fad2936fd7ee1a75ff82ff1 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Mon, 19 Oct 2026 15:22:07 -0400 Subject: [PATCH 06/28] Rename activity routing intent to use_workflow_session --- temporal/api/session/v1/message.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 78593574d..4a7cdb2e5 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -35,7 +35,9 @@ message SingleSessionOptions { message ActivitySessionOptions { oneof session { - bool workflow_sticky_session = 1; + // Execute this activity as part of its workflow's session. + // Currently routes to the workflow's sticky task queue when true. + bool use_workflow_session = 1; // later session_id, etc } From 6811161a3c59c7773ac236dbf9adf9eb359f9288 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 20 Oct 2026 08:41:55 -0400 Subject: [PATCH 07/28] Record activity session options in scheduled history events --- temporal/api/history/v1/message.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 1c6efd305..8f5a233bf 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -20,6 +20,7 @@ import "temporal/api/common/v1/message.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/nexus/v1/message.proto"; +import "temporal/api/session/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/update/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; @@ -465,6 +466,9 @@ message ActivityTaskScheduledEventAttributes { // 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 = 14; + // Preserves the scheduling command's session routing options so activity state + // can be reconstructed from history. + temporal.api.session.v1.ActivitySessionOptions session_options = 15; } message ActivityTaskStartedEventAttributes { From d183f54c642fe320218bc3bf8592b2533540f050 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Tue, 27 Oct 2026 12:42:55 -0400 Subject: [PATCH 08/28] Propose basic session API shape (#893) **What changed?** Basically just a single field change and some comment changes based on a Notion doc proposal. **Why?** **Breaking changes** **Server PR** --------- Co-authored-by: Claude Opus 5.5 --- temporal/api/session/v1/message.proto | 48 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 4a7cdb2e5..7291ab7fa 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -9,36 +9,48 @@ option java_outer_classname = "MessageProto"; option ruby_package = "Temporalio::Api::Session::V1"; option csharp_namespace = "Temporalio.Api.Session.V1"; +import "google/protobuf/empty.proto"; + // EXPERIMENTAL. Subject to redesign or removal. -// Configures a worker's polling for sessions that keep workflow and activity -// tasks on a stable worker destination. Activities opt into session routing -// through ActivitySessionOptions on their scheduling commands. +// Sent on workflow and activity polls. Presence means this worker can serve +// sessions. Currently, the only supported Session type is Workflow Session +// (aka Workflow-as-Session). A Workflow Session can receive both workflow +// tasks and activity tasks of an execution. message WorkerSessionOptions { - oneof isolation { + // Admission control, if unset the worker accepts an arbitrary number of + // sessions (bounded by session slots in the future) + oneof admission { + // If specified, the worker only polls for work belonging to its session. SingleSessionOptions single_session = 1; } } // EXPERIMENTAL. Subject to redesign or removal. -// Dedicates a sticky destination to the first workflow matched to it. -// Workflow sticky polls may be forwarded to the normal queue until the first -// workflow task is dispatched. The server persists that workflow ID and does -// not forward subsequent polls, including after workflow completion. -// Activity sticky polls are never forwarded to the normal queue. +// Serve exactly one session for the worker's lifetime, including across +// process restarts with the same stable_identity. The server binds the worker +// to the first session that needs a worker, and dispatches no other work here, +// even after that session completes. message SingleSessionOptions { - // Stable sticky task queue name, shared by workflow and activity polls. - // Reuse this value across worker restarts within the same session, but not - // across concurrently running workers. This is distinct from worker identity. - // The SDK must also set the polled sticky task queue's name to this value. + // Identity the binding is stored under. Reuse it across restarts of the + // same session, not across concurrently running workers. If multiple + // workers poll with the same stable_identity concurrently, the server + // treats them as pollers of a single worker and process affinity is lost. + // + // Note: this effectively acts as a configurable sticky queue. + // Note: we are currently unsure how this will evolve. May be deprecated as + // the session model develops. string stable_identity = 1; } +// EXPERIMENTAL. Subject to redesign or removal. +// Resolved activity placement. Unset = normal task-queue routing. message ActivitySessionOptions { - oneof session { - // Execute this activity as part of its workflow's session. - // Currently routes to the workflow's sticky task queue when true. - bool use_workflow_session = 1; + oneof placement { + // Run in the workflow's current session (on its sticky queue). + // Currently requires the activity's task queue to be the workflow's, + // and the workflow's worker to serve sessions. + google.protobuf.Empty workflow_session = 1; - // later session_id, etc + // Future: references to other types of sessions. } } From 7fd0921afe3b60820dfe9a1199356628dc56c0e2 Mon Sep 17 00:00:00 2001 From: Thomas Hardy Date: Wed, 28 Oct 2026 15:25:02 -0400 Subject: [PATCH 09/28] Document that stable_identity is required SDKs (Core) already reject an empty SingleSessionOptions.stable_identity; state the requirement on the field so servers and other SDKs see it. Co-Authored-By: Claude Opus 5.5 --- temporal/api/session/v1/message.proto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 7291ab7fa..51aac24b1 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -31,10 +31,11 @@ message WorkerSessionOptions { // to the first session that needs a worker, and dispatches no other work here, // even after that session completes. message SingleSessionOptions { - // Identity the binding is stored under. Reuse it across restarts of the - // same session, not across concurrently running workers. If multiple - // workers poll with the same stable_identity concurrently, the server - // treats them as pollers of a single worker and process affinity is lost. + // Identity the binding is stored under. Required; must be non-empty. + // Reuse it across restarts of the same session, not across concurrently + // running workers. If multiple workers poll with the same stable_identity + // concurrently, the server treats them as pollers of a single worker and + // process affinity is lost. // // Note: this effectively acts as a configurable sticky queue. // Note: we are currently unsure how this will evolve. May be deprecated as From 47cb3234814ba48e9c0c2966ab170c25e063be5f Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 17 Nov 2026 10:17:15 -0500 Subject: [PATCH 10/28] Renumber session_options to 12 and regenerate openapi api main took field 11 on PollWorkflowTaskQueueRequest and PollActivityTaskQueueRequest for poller_pool_info. Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 15 +++++++++++++++ openapi/openapiv3.yaml | 12 ++++++++++++ .../api/workflowservice/v1/request_response.proto | 4 ++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index f246a21c8..7a8c0da69 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14163,6 +14163,17 @@ } } }, + "v1ActivitySessionOptions": { + "type": "object", + "properties": { + "workflowSession": { + "type": "object", + "properties": {}, + "description": "Run in the workflow's current session (on its sticky queue).\nCurrently requires the activity's task queue to be the workflow's,\nand the workflow's worker to serve sessions." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nResolved activity placement. Unset = normal task-queue routing." + }, "v1ActivityTaskCancelRequestedEventAttributes": { "type": "object", "properties": { @@ -14333,6 +14344,10 @@ "priority": { "$ref": "#/definitions/v1Priority", "description": "Priority metadata. If this message is not present, or any fields are not\npresent, they inherit the values from the workflow." + }, + "sessionOptions": { + "$ref": "#/definitions/v1ActivitySessionOptions", + "description": "Preserves the scheduling command's session routing options so activity state\ncan be reconstructed from history." } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index a38711cdd..d7f79afe3 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10138,6 +10138,12 @@ components: description: |- If set, update the retry policy of the activity, replacing it with the specified one. The number of attempts at the activity is preserved. + ActivitySessionOptions: + type: object + properties: {} + description: |- + EXPERIMENTAL. Subject to redesign or removal. + Resolved activity placement. Unset = normal task-queue routing. ActivityTaskCancelRequestedEventAttributes: type: object properties: @@ -10309,6 +10315,12 @@ components: description: |- Priority metadata. If this message is not present, or any fields are not present, they inherit the values from the workflow. + sessionOptions: + allOf: + - $ref: '#/components/schemas/ActivitySessionOptions' + description: |- + Preserves the scheduling command's session routing options so activity state + can be reconstructed from history. ActivityTaskStartedEventAttributes: type: object properties: diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 20583a111..6c9271e23 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -331,7 +331,7 @@ message PollWorkflowTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.WorkerSessionOptions session_options = 11; + temporal.api.session.v1.WorkerSessionOptions session_options = 12; } message PollWorkflowTaskQueueResponse { @@ -567,7 +567,7 @@ message PollActivityTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.WorkerSessionOptions session_options = 11; + temporal.api.session.v1.WorkerSessionOptions session_options = 12; } message PollActivityTaskQueueResponse { From 3f47869a0f58930949e59e731059fe68ae2ebf94 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 14:20:23 -0500 Subject: [PATCH 11/28] Add MultiSessionOptions; route its sessions to the instance-key sticky queue A multi-session worker's sticky queue is named after its worker_instance_key, so MultiSessionOptions carries no address. Single-session keeps stable_identity. Exactly one admission mode is required. Co-Authored-By: Claude Opus 5.5 --- temporal/api/session/v1/message.proto | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 51aac24b1..e63fadb18 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -17,11 +17,13 @@ import "google/protobuf/empty.proto"; // (aka Workflow-as-Session). A Workflow Session can receive both workflow // tasks and activity tasks of an execution. message WorkerSessionOptions { - // Admission control, if unset the worker accepts an arbitrary number of - // sessions (bounded by session slots in the future) + // Admission control. Required: exactly one mode must be set, and the + // server rejects session options with neither. oneof admission { // If specified, the worker only polls for work belonging to its session. SingleSessionOptions single_session = 1; + // If specified, the worker can serve multiple sessions at once. + MultiSessionOptions multi_session = 2; } } @@ -43,6 +45,14 @@ message SingleSessionOptions { string stable_identity = 1; } +// EXPERIMENTAL. Subject to redesign or removal. +// Serve any number of sessions concurrently. The server routes each bound +// session's work to the worker's sticky queue, which must be named after the +// poll's worker_instance_key. Future admission knobs (e.g. session slots) +// belong here. +message MultiSessionOptions { +} + // EXPERIMENTAL. Subject to redesign or removal. // Resolved activity placement. Unset = normal task-queue routing. message ActivitySessionOptions { From a54da844c0b2b95f282b8a3b018e1e29968addd6 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Fri, 20 Nov 2026 16:31:34 -0500 Subject: [PATCH 12/28] Record a workflow's session info on history events Adds SessionInfo (exclusive_worker, bound_worker_info) in session/v1 and records it on WorkflowTaskStartedEventAttributes (session_info) and WorkflowExecutionStartedEventAttributes (inherited_session_info), so the server can rebuild a workflow's worker binding from history, for example on reset. Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 32 +++++++++++++++++ openapi/openapiv3.yaml | 49 +++++++++++++++++++++++++++ temporal/api/history/v1/message.proto | 12 +++++++ temporal/api/session/v1/message.proto | 27 +++++++++++++++ 4 files changed, 120 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 7a8c0da69..2b44675b7 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14804,6 +14804,16 @@ }, "description": "BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows.\nKeep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest." }, + "v1BoundWorkerInfo": { + "type": "object", + "properties": { + "workerQueue": { + "type": "string", + "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker address of a multi-session worker. The workflow's tasks are\nrouted here.\n\nmore fields may be added later, such as the worker's instance key so that\n history can send it to matching to understand if the worker's heartbeating\n information." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server." + }, "v1BuildIdAssignmentRule": { "type": "object", "properties": { @@ -19927,6 +19937,20 @@ } } }, + "v1SessionInfo": { + "type": "object", + "properties": { + "exclusiveWorker": { + "type": "boolean", + "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker. False for a multi-session worker,\nwhose binding moves with the worker that starts the workflow's tasks." + }, + "boundWorkerInfo": { + "$ref": "#/definitions/v1BoundWorkerInfo", + "description": "The worker the workflow is bound to. Always set." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nWhich worker a workflow (which is the session) is bound to. The server records it on history events\nso it can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs\nshould not read or interpret it." + }, "v1SetCurrentDeploymentResponse": { "type": "object", "properties": { @@ -22376,6 +22400,10 @@ "propagatedNexusSerializationContext": { "$ref": "#/definitions/v1PropagatedSerializationContext", "description": "Serialization context propagated from the Nexus caller that started this workflow." + }, + "inheritedSessionInfo": { + "$ref": "#/definitions/v1SessionInfo", + "description": "Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server\ncan rebuild it from history. Nil when the previous run was not bound or this run is on a different\ntask queue. Child workflows never inherit it.\nUsed internally by the server; SDKs should not read or interpret this field.\nEXPERIMENTAL. Subject to redesign or removal." } }, "title": "Always the first event in workflow history" @@ -22967,6 +22995,10 @@ "type": "string", "format": "int64", "title": "Used by server internally to properly reapply build ID redirects to an execution\nwhen rebuilding it from events.\nDeprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]" + }, + "sessionInfo": { + "$ref": "#/definitions/v1SessionInfo", + "description": "Session info of this workflow as of this task start, so the server can rebuild it from history (for\nexample on reset). Nil when the workflow is not bound to a worker.\nUsed internally by the server; SDKs should not read or interpret this field.\nEXPERIMENTAL. Subject to redesign or removal." } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index d7f79afe3..7e7cfeff9 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10757,6 +10757,18 @@ components: description: |- BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows. Keep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest. + BoundWorkerInfo: + type: object + properties: + workerQueue: + type: string + description: |- + The worker's queue: the stable identity of a single-session worker, or + the worker address of a multi-session worker. The workflow's tasks are + routed here. + description: |- + EXPERIMENTAL. Subject to redesign or removal. + The worker a workflow is bound to. Recorded by the server. BuildIdAssignmentRule: type: object properties: @@ -16811,6 +16823,26 @@ components: properties: nonRetryable: type: boolean + SessionInfo: + type: object + properties: + exclusiveWorker: + type: boolean + description: |- + True when the workflow is bound to a single-session worker. Such a + binding never moves to another worker. False for a multi-session worker, + whose binding moves with the worker that starts the workflow's tasks. + boundWorkerInfo: + allOf: + - $ref: '#/components/schemas/BoundWorkerInfo' + description: The worker the workflow is bound to. Always set. + description: |- + EXPERIMENTAL. Subject to redesign or removal. + Which worker a workflow (which is the session) is bound to. The server records it on history events + so it can rebuild the binding from history (for example on reset). See + session_info on WorkflowTaskStartedEventAttributes and inherited_session_info + on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs + should not read or interpret it. SetCurrentDeploymentRequest: type: object properties: @@ -21042,6 +21074,15 @@ components: allOf: - $ref: '#/components/schemas/PropagatedSerializationContext' description: Serialization context propagated from the Nexus caller that started this workflow. + inheritedSessionInfo: + allOf: + - $ref: '#/components/schemas/SessionInfo' + description: |- + Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server + can rebuild it from history. Nil when the previous run was not bound or this run is on a different + task queue. Child workflows never inherit it. + Used internally by the server; SDKs should not read or interpret this field. + EXPERIMENTAL. Subject to redesign or removal. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object @@ -21722,6 +21763,14 @@ components: Used by server internally to properly reapply build ID redirects to an execution when rebuilding it from events. Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv] + sessionInfo: + allOf: + - $ref: '#/components/schemas/SessionInfo' + description: |- + Session info of this workflow as of this task start, so the server can rebuild it from history (for + example on reset). Nil when the workflow is not bound to a worker. + Used internally by the server; SDKs should not read or interpret this field. + EXPERIMENTAL. Subject to redesign or removal. WorkflowTaskTimedOutEventAttributes: type: object properties: diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 96628ab87..5de25065c 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -219,6 +219,13 @@ message WorkflowExecutionStartedEventAttributes { // Serialization context propagated from the Nexus caller that started this workflow. temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 44; + + // Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server + // can rebuild it from history. Nil when the previous run was not bound or this run is on a different + // task queue. Child workflows never inherit it. + // Used internally by the server; SDKs should not read or interpret this field. + // EXPERIMENTAL. Subject to redesign or removal. + temporal.api.session.v1.SessionInfo inherited_session_info = 45; } @@ -342,6 +349,11 @@ message WorkflowTaskStartedEventAttributes { // when rebuilding it from events. // Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv] int64 build_id_redirect_counter = 7 [deprecated = true]; + // Session info of this workflow as of this task start, so the server can rebuild it from history (for + // example on reset). Nil when the workflow is not bound to a worker. + // Used internally by the server; SDKs should not read or interpret this field. + // EXPERIMENTAL. Subject to redesign or removal. + temporal.api.session.v1.SessionInfo session_info = 10; } message WorkflowTaskCompletedEventAttributes { diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index e63fadb18..c878ea534 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -65,3 +65,30 @@ message ActivitySessionOptions { // Future: references to other types of sessions. } } + +// EXPERIMENTAL. Subject to redesign or removal. +// Which worker a workflow (which is the session) is bound to. The server records it on history events +// so it can rebuild the binding from history (for example on reset). See +// session_info on WorkflowTaskStartedEventAttributes and inherited_session_info +// on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs +// should not read or interpret it. +message SessionInfo { + // True when the workflow is bound to a single-session worker. Such a + // binding never moves to another worker. False for a multi-session worker, + // whose binding moves with the worker that starts the workflow's tasks. + bool exclusive_worker = 1; + // The worker the workflow is bound to. Always set. + BoundWorkerInfo bound_worker_info = 2; +} + +// EXPERIMENTAL. Subject to redesign or removal. +// The worker a workflow is bound to. Recorded by the server. +message BoundWorkerInfo { + // The worker's queue: the stable identity of a single-session worker, or + // the worker address of a multi-session worker. The workflow's tasks are + // routed here. + string worker_queue = 1; + // more fields may be added later, such as the worker's instance key so that + // history can send it to matching to understand if the worker's heartbeating + // information. +} From 468640768a4572520ba14e96899f241cded22a6f Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 12:40:06 -0500 Subject: [PATCH 13/28] Move BoundWorkerInfo's future-fields note into its doc comment for api-linter --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 4 +++- temporal/api/session/v1/message.proto | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 2b44675b7..59608b893 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14809,10 +14809,10 @@ "properties": { "workerQueue": { "type": "string", - "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker address of a multi-session worker. The workflow's tasks are\nrouted here.\n\nmore fields may be added later, such as the worker's instance key so that\n history can send it to matching to understand if the worker's heartbeating\n information." + "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker address of a multi-session worker. The workflow's tasks are\nrouted here." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server. More fields may be\nadded later, such as the worker's instance key so that history can send it to\nmatching to understand if the worker's heartbeating information." }, "v1BuildIdAssignmentRule": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 7e7cfeff9..c7beb4f98 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10768,7 +10768,9 @@ components: routed here. description: |- EXPERIMENTAL. Subject to redesign or removal. - The worker a workflow is bound to. Recorded by the server. + The worker a workflow is bound to. Recorded by the server. More fields may be + added later, such as the worker's instance key so that history can send it to + matching to understand if the worker's heartbeating information. BuildIdAssignmentRule: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index c878ea534..d0274db4c 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -82,13 +82,12 @@ message SessionInfo { } // EXPERIMENTAL. Subject to redesign or removal. -// The worker a workflow is bound to. Recorded by the server. +// The worker a workflow is bound to. Recorded by the server. More fields may be +// added later, such as the worker's instance key so that history can send it to +// matching to understand if the worker's heartbeating information. message BoundWorkerInfo { // The worker's queue: the stable identity of a single-session worker, or // the worker address of a multi-session worker. The workflow's tasks are // routed here. string worker_queue = 1; - // more fields may be added later, such as the worker's instance key so that - // history can send it to matching to understand if the worker's heartbeating - // information. } From c6980ad00a989f6bdaaa47aba472de1a5b202ec7 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 11:36:41 -0500 Subject: [PATCH 14/28] Carry a worker's session options on its heartbeat --- openapi/openapiv2.json | 38 +++++++++++++++++++ openapi/openapiv3.yaml | 57 ++++++++++++++++++++++++++++ temporal/api/worker/v1/message.proto | 5 +++ 3 files changed, 100 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 59608b893..2347e0331 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17372,6 +17372,16 @@ }, "title": "Metadata relevant for metering purposes" }, + "v1MultiSessionOptions": { + "type": "object", + "properties": { + "workerAddress": { + "type": "string", + "description": "Where the server routes session work bound to this worker.\nCurrently set by the SDK to the worker's sticky queue name, and not\nuser-configurable. May become configurable in the future." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. Future admission knobs (e.g.\nsession slots) belong here." + }, "v1NamespaceConfig": { "type": "object", "properties": { @@ -20140,6 +20150,16 @@ } } }, + "v1SingleSessionOptions": { + "type": "object", + "properties": { + "stableIdentity": { + "type": "string", + "description": "Identity the binding is stored under. Required; must be non-empty.\nReuse it across restarts of the same session, not across concurrently\nrunning workers. If multiple workers poll with the same stable_identity\nconcurrently, the server treats them as pollers of a single worker and\nprocess affinity is lost.\n\nNote: this effectively acts as a configurable sticky queue.\nNote: we are currently unsure how this will evolve. May be deprecated as\nthe session model develops." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe exactly one session for the worker's lifetime, including across\nprocess restarts with the same stable_identity. The server binds the worker\nto the first session that needs a worker, and dispatches no other work here,\neven after that session completes." + }, "v1StartActivityExecutionResponse": { "type": "object", "properties": { @@ -21543,6 +21563,10 @@ "environment": { "$ref": "#/definitions/v1EnvironmentInfo", "description": "Information about the environment this SDK is running in." + }, + "sessionOptions": { + "$ref": "#/definitions/v1WorkerSessionOptions", + "description": "The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has\nstopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions." } }, "description": "Worker info message, contains information about the worker and its current state.\nAll information is provided by the worker itself." @@ -21681,6 +21705,20 @@ }, "description": "This is used to send commands to a specific worker or a group of workers.\nRight now, it is used to send commands to a specific worker instance.\nWill be extended to be able to send command to multiple workers." }, + "v1WorkerSessionOptions": { + "type": "object", + "properties": { + "singleSession": { + "$ref": "#/definitions/v1SingleSessionOptions", + "description": "If specified, the worker only polls for work belonging to its session." + }, + "multiSession": { + "$ref": "#/definitions/v1MultiSessionOptions", + "description": "If specified, the worker can serve multiple sessions at once." + } + }, + "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow Session can receive both workflow\ntasks and activity tasks of an execution." + }, "v1WorkerSlotsInfo": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index c7beb4f98..422711ea7 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13601,6 +13601,19 @@ components: aip.dev/not-precedent: Negative values make no sense to represent. --) format: uint32 description: Metadata relevant for metering purposes + MultiSessionOptions: + type: object + properties: + workerAddress: + type: string + description: |- + Where the server routes session work bound to this worker. + Currently set by the SDK to the worker's sticky queue name, and not + user-configurable. May become configurable in the future. + description: |- + EXPERIMENTAL. Subject to redesign or removal. + Serve any number of sessions concurrently. Future admission knobs (e.g. + session slots) belong here. NamespaceConfig: type: object properties: @@ -17328,6 +17341,27 @@ components: Link to be associated with the WorkflowExecutionSignaled event. Added on the response to propagate the backlink. Available from Temporal server 1.31 and up. + SingleSessionOptions: + type: object + properties: + stableIdentity: + type: string + description: |- + Identity the binding is stored under. Required; must be non-empty. + Reuse it across restarts of the same session, not across concurrently + running workers. If multiple workers poll with the same stable_identity + concurrently, the server treats them as pollers of a single worker and + process affinity is lost. + + Note: this effectively acts as a configurable sticky queue. + Note: we are currently unsure how this will evolve. May be deprecated as + the session model develops. + description: |- + EXPERIMENTAL. Subject to redesign or removal. + Serve exactly one session for the worker's lifetime, including across + process restarts with the same stable_identity. The server binds the worker + to the first session that needs a worker, and dispatches no other work here, + even after that session completes. StartActivityExecutionRequest: type: object properties: @@ -19982,6 +20016,12 @@ components: allOf: - $ref: '#/components/schemas/EnvironmentInfo' description: Information about the environment this SDK is running in. + sessionOptions: + allOf: + - $ref: '#/components/schemas/WorkerSessionOptions' + description: |- + The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has + stopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions. description: |- Worker info message, contains information about the worker and its current state. All information is provided by the worker itself. @@ -20116,6 +20156,23 @@ components: This is used to send commands to a specific worker or a group of workers. Right now, it is used to send commands to a specific worker instance. Will be extended to be able to send command to multiple workers. + WorkerSessionOptions: + type: object + properties: + singleSession: + allOf: + - $ref: '#/components/schemas/SingleSessionOptions' + description: If specified, the worker only polls for work belonging to its session. + multiSession: + allOf: + - $ref: '#/components/schemas/MultiSessionOptions' + description: If specified, the worker can serve multiple sessions at once. + description: |- + EXPERIMENTAL. Subject to redesign or removal. + Sent on workflow and activity polls. Presence means this worker can serve + sessions. Currently, the only supported Session type is Workflow Session + (aka Workflow-as-Session). A Workflow Session can receive both workflow + tasks and activity tasks of an execution. WorkerSlotsInfo: type: object properties: diff --git a/temporal/api/worker/v1/message.proto b/temporal/api/worker/v1/message.proto index cc452f0c2..f8a88db63 100644 --- a/temporal/api/worker/v1/message.proto +++ b/temporal/api/worker/v1/message.proto @@ -13,6 +13,7 @@ import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/enums/v1/common.proto"; +import "temporal/api/session/v1/message.proto"; message WorkerPollerInfo { // Number of polling RPCs that are currently in flight. @@ -137,6 +138,10 @@ message WorkerHeartbeat { // Information about the environment this SDK is running in. EnvironmentInfo environment = 25; + + // The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has + // stopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions. + temporal.api.session.v1.WorkerSessionOptions session_options = 26; } // Detailed worker information. From e9c0ac9b3b777b731e606687a75efb5712f1403f Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 15:48:56 -0500 Subject: [PATCH 15/28] Name a multi-session worker's queue after its instance key in BoundWorkerInfo Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 12 +++--------- openapi/openapiv3.yaml | 22 ++++++++-------------- temporal/api/session/v1/message.proto | 8 +++----- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 2347e0331..785daabfb 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14809,10 +14809,10 @@ "properties": { "workerQueue": { "type": "string", - "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker address of a multi-session worker. The workflow's tasks are\nrouted here." + "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker instance key of a multi-session worker. The workflow's tasks\nare routed here." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server. More fields may be\nadded later, such as the worker's instance key so that history can send it to\nmatching to understand if the worker's heartbeating information." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server." }, "v1BuildIdAssignmentRule": { "type": "object", @@ -17374,13 +17374,7 @@ }, "v1MultiSessionOptions": { "type": "object", - "properties": { - "workerAddress": { - "type": "string", - "description": "Where the server routes session work bound to this worker.\nCurrently set by the SDK to the worker's sticky queue name, and not\nuser-configurable. May become configurable in the future." - } - }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. Future admission knobs (e.g.\nsession slots) belong here." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. The server routes each bound\nsession's work to the worker's sticky queue, which must be named after the\npoll's worker_instance_key. Future admission knobs (e.g. session slots)\nbelong here." }, "v1NamespaceConfig": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 422711ea7..d77dc6283 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10764,13 +10764,11 @@ components: type: string description: |- The worker's queue: the stable identity of a single-session worker, or - the worker address of a multi-session worker. The workflow's tasks are - routed here. + the worker instance key of a multi-session worker. The workflow's tasks + are routed here. description: |- EXPERIMENTAL. Subject to redesign or removal. - The worker a workflow is bound to. Recorded by the server. More fields may be - added later, such as the worker's instance key so that history can send it to - matching to understand if the worker's heartbeating information. + The worker a workflow is bound to. Recorded by the server. BuildIdAssignmentRule: type: object properties: @@ -13603,17 +13601,13 @@ components: description: Metadata relevant for metering purposes MultiSessionOptions: type: object - properties: - workerAddress: - type: string - description: |- - Where the server routes session work bound to this worker. - Currently set by the SDK to the worker's sticky queue name, and not - user-configurable. May become configurable in the future. + properties: {} description: |- EXPERIMENTAL. Subject to redesign or removal. - Serve any number of sessions concurrently. Future admission knobs (e.g. - session slots) belong here. + Serve any number of sessions concurrently. The server routes each bound + session's work to the worker's sticky queue, which must be named after the + poll's worker_instance_key. Future admission knobs (e.g. session slots) + belong here. NamespaceConfig: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index d0274db4c..421408b03 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -82,12 +82,10 @@ message SessionInfo { } // EXPERIMENTAL. Subject to redesign or removal. -// The worker a workflow is bound to. Recorded by the server. More fields may be -// added later, such as the worker's instance key so that history can send it to -// matching to understand if the worker's heartbeating information. +// The worker a workflow is bound to. Recorded by the server. message BoundWorkerInfo { // The worker's queue: the stable identity of a single-session worker, or - // the worker address of a multi-session worker. The workflow's tasks are - // routed here. + // the worker instance key of a multi-session worker. The workflow's tasks + // are routed here. string worker_queue = 1; } From a5ac2d99c8642ff7cff181d3a3e5d02026cf3197 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 15:49:15 -0500 Subject: [PATCH 16/28] Renumber poll session_options to 13 after main took 12 Co-Authored-By: Claude Opus 5.5 --- temporal/api/workflowservice/v1/request_response.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 2a986879f..8e1e184d5 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -350,7 +350,7 @@ message PollWorkflowTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.WorkerSessionOptions session_options = 12; + temporal.api.session.v1.WorkerSessionOptions session_options = 13; } message PollWorkflowTaskQueueResponse { @@ -586,7 +586,7 @@ message PollActivityTaskQueueRequest { reserved "worker_heartbeat"; // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. - temporal.api.session.v1.WorkerSessionOptions session_options = 12; + temporal.api.session.v1.WorkerSessionOptions session_options = 13; } message PollActivityTaskQueueResponse { From d555c706bf74e4560e6ae7e88032e1e0dbbc47f0 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 15:51:54 -0500 Subject: [PATCH 17/28] Document how the sticky queue is named for each session admission mode Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 14 ++++++++++---- temporal/api/session/v1/message.proto | 14 ++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 5d8648d69..8db168306 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -17426,7 +17426,7 @@ }, "v1MultiSessionOptions": { "type": "object", - "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. The server routes each bound\nsession's work to the worker's sticky queue, which must be named after the\npoll's worker_instance_key. Future admission knobs (e.g. session slots)\nbelong here." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. Future admission knobs (e.g.\nsession slots) belong here." }, "v1NamespaceConfig": { "type": "object", @@ -21777,7 +21777,7 @@ "description": "If specified, the worker can serve multiple sessions at once." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow Session can receive both workflow\ntasks and activity tasks of an execution." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow Session can receive both workflow\ntasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." }, "v1WorkerSlotsInfo": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 7baea7782..69266ed47 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13640,10 +13640,8 @@ components: properties: {} description: |- EXPERIMENTAL. Subject to redesign or removal. - Serve any number of sessions concurrently. The server routes each bound - session's work to the worker's sticky queue, which must be named after the - poll's worker_instance_key. Future admission knobs (e.g. session slots) - belong here. + Serve any number of sessions concurrently. Future admission knobs (e.g. + session slots) belong here. NamespaceConfig: type: object properties: @@ -20230,6 +20228,14 @@ components: sessions. Currently, the only supported Session type is Workflow Session (aka Workflow-as-Session). A Workflow Session can receive both workflow tasks and activity tasks of an execution. + + The server routes a session's work to the worker's sticky queue, so the + sticky queue name depends on the admission mode: + * single_session: the worker polls only its sticky queue, named after + SingleSessionOptions.stable_identity. + * multi_session: the worker polls the normal queue and its sticky queue, + named after the poll's worker_instance_key. + The server rejects sticky polls whose name does not follow this rule. WorkerSlotsInfo: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 421408b03..32990f0c2 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -16,6 +16,14 @@ import "google/protobuf/empty.proto"; // sessions. Currently, the only supported Session type is Workflow Session // (aka Workflow-as-Session). A Workflow Session can receive both workflow // tasks and activity tasks of an execution. +// +// The server routes a session's work to the worker's sticky queue, so the +// sticky queue name depends on the admission mode: +// * single_session: the worker polls only its sticky queue, named after +// SingleSessionOptions.stable_identity. +// * multi_session: the worker polls the normal queue and its sticky queue, +// named after the poll's worker_instance_key. +// The server rejects sticky polls whose name does not follow this rule. message WorkerSessionOptions { // Admission control. Required: exactly one mode must be set, and the // server rejects session options with neither. @@ -46,10 +54,8 @@ message SingleSessionOptions { } // EXPERIMENTAL. Subject to redesign or removal. -// Serve any number of sessions concurrently. The server routes each bound -// session's work to the worker's sticky queue, which must be named after the -// poll's worker_instance_key. Future admission knobs (e.g. session slots) -// belong here. +// Serve any number of sessions concurrently. Future admission knobs (e.g. +// session slots) belong here. message MultiSessionOptions { } From 252a312b68d872db921a4b81ee23ce1e24a04d31 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 15:58:52 -0500 Subject: [PATCH 18/28] Document which polls carry session options for each admission mode Co-Authored-By: Claude Opus 5.5 --- temporal/api/workflowservice/v1/request_response.proto | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 8e1e184d5..8673eb07b 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -349,7 +349,10 @@ message PollWorkflowTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + // EXPERIMENTAL. Subject to redesign or removal. The worker's session options. + // A single-session worker sends them on sticky polls only; a multi-session + // worker sends them on normal and sticky polls. Unset for a worker without + // sessions. temporal.api.session.v1.WorkerSessionOptions session_options = 13; } @@ -585,7 +588,10 @@ message PollActivityTaskQueueRequest { reserved 7; reserved "worker_heartbeat"; - // EXPERIMENTAL. Subject to redesign or removal. Only applicable to sticky polls. + // EXPERIMENTAL. Subject to redesign or removal. The worker's session options. + // A single-session worker sends them on sticky polls only; a multi-session + // worker sends them on normal and sticky polls. Unset for a worker without + // sessions. temporal.api.session.v1.WorkerSessionOptions session_options = 13; } From d67ca94c813f26aecb9f2944fbd9eeb8a89eb7e0 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 16:01:40 -0500 Subject: [PATCH 19/28] Note that a multi-session worker's sticky queue is named after its instance key Co-Authored-By: Claude Opus 5.5 --- temporal/api/workflowservice/v1/request_response.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 8673eb07b..a44066c07 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -318,6 +318,7 @@ message PollWorkflowTaskQueueRequest { string identity = 3; // A unique key for this worker instance, used for tracking worker lifecycle. // This is guaranteed to be unique, whereas identity is not guaranteed to be unique. + // A multi-session worker's sticky queue is named after it (see WorkerSessionOptions). string worker_instance_key = 8; // A dedicated per-worker Nexus task queue on which the server sends control @@ -567,6 +568,7 @@ message PollActivityTaskQueueRequest { string identity = 3; // A unique key for this worker instance, used for tracking worker lifecycle. // This is guaranteed to be unique, whereas identity is not guaranteed to be unique. + // A multi-session worker's sticky queue is named after it (see WorkerSessionOptions). string worker_instance_key = 8; // A dedicated per-worker Nexus task queue on which the server sends control From d77590e7a3c257657718b577e347fee11629564b Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 16:07:07 -0500 Subject: [PATCH 20/28] Flatten BoundWorkerInfo into SessionInfo.worker_queue The worker queue is the only worker field the binding needs: a multi-session worker's queue is its instance key, and a single-session binding never moves. Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 18 ++++-------------- openapi/openapiv3.yaml | 24 +++++++----------------- temporal/api/session/v1/message.proto | 17 +++++------------ 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 8db168306..ec07b0ea8 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14856,16 +14856,6 @@ }, "description": "BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows.\nKeep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest." }, - "v1BoundWorkerInfo": { - "type": "object", - "properties": { - "workerQueue": { - "type": "string", - "description": "The worker's queue: the stable identity of a single-session worker, or\nthe worker instance key of a multi-session worker. The workflow's tasks\nare routed here." - } - }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nThe worker a workflow is bound to. Recorded by the server." - }, "v1BuildIdAssignmentRule": { "type": "object", "properties": { @@ -20005,12 +19995,12 @@ "type": "boolean", "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker. False for a multi-session worker,\nwhose binding moves with the worker that starts the workflow's tasks." }, - "boundWorkerInfo": { - "$ref": "#/definitions/v1BoundWorkerInfo", - "description": "The worker the workflow is bound to. Always set." + "workerQueue": { + "type": "string", + "description": "The queue of the worker the workflow is bound to, where its tasks are\nrouted: the stable identity of a single-session worker, or the worker\ninstance key of a multi-session worker. Always set." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nWhich worker a workflow (which is the session) is bound to. The server records it on history events\nso it can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs\nshould not read or interpret it." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nWhich worker a workflow is bound to. The server records it on history events\nso it can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs\nshould not read or interpret it." }, "v1SetCurrentDeploymentResponse": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 69266ed47..7a6d3007f 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -10790,18 +10790,6 @@ components: description: |- BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows. Keep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest. - BoundWorkerInfo: - type: object - properties: - workerQueue: - type: string - description: |- - The worker's queue: the stable identity of a single-session worker, or - the worker instance key of a multi-session worker. The workflow's tasks - are routed here. - description: |- - EXPERIMENTAL. Subject to redesign or removal. - The worker a workflow is bound to. Recorded by the server. BuildIdAssignmentRule: type: object properties: @@ -16879,13 +16867,15 @@ components: True when the workflow is bound to a single-session worker. Such a binding never moves to another worker. False for a multi-session worker, whose binding moves with the worker that starts the workflow's tasks. - boundWorkerInfo: - allOf: - - $ref: '#/components/schemas/BoundWorkerInfo' - description: The worker the workflow is bound to. Always set. + workerQueue: + type: string + description: |- + The queue of the worker the workflow is bound to, where its tasks are + routed: the stable identity of a single-session worker, or the worker + instance key of a multi-session worker. Always set. description: |- EXPERIMENTAL. Subject to redesign or removal. - Which worker a workflow (which is the session) is bound to. The server records it on history events + Which worker a workflow is bound to. The server records it on history events so it can rebuild the binding from history (for example on reset). See session_info on WorkflowTaskStartedEventAttributes and inherited_session_info on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 32990f0c2..fb2f9fa16 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -73,7 +73,7 @@ message ActivitySessionOptions { } // EXPERIMENTAL. Subject to redesign or removal. -// Which worker a workflow (which is the session) is bound to. The server records it on history events +// Which worker a workflow is bound to. The server records it on history events // so it can rebuild the binding from history (for example on reset). See // session_info on WorkflowTaskStartedEventAttributes and inherited_session_info // on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs @@ -83,15 +83,8 @@ message SessionInfo { // binding never moves to another worker. False for a multi-session worker, // whose binding moves with the worker that starts the workflow's tasks. bool exclusive_worker = 1; - // The worker the workflow is bound to. Always set. - BoundWorkerInfo bound_worker_info = 2; -} - -// EXPERIMENTAL. Subject to redesign or removal. -// The worker a workflow is bound to. Recorded by the server. -message BoundWorkerInfo { - // The worker's queue: the stable identity of a single-session worker, or - // the worker instance key of a multi-session worker. The workflow's tasks - // are routed here. - string worker_queue = 1; + // The queue of the worker the workflow is bound to, where its tasks are + // routed: the stable identity of a single-session worker, or the worker + // instance key of a multi-session worker. Always set. + string worker_queue = 2; } From 877618de9ce4ca48346c2d0375836713b1d445e6 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 16:37:01 -0500 Subject: [PATCH 21/28] Clarify session option docs Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 5 +++-- temporal/api/session/v1/message.proto | 4 ++-- temporal/api/worker/v1/message.proto | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index ec07b0ea8..6c9d56b13 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -21616,7 +21616,7 @@ }, "sessionOptions": { "$ref": "#/definitions/v1WorkerSessionOptions", - "description": "The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has\nstopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions." + "description": "The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has\nstopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions.\nNot used in the case of single-session workers." } }, "description": "Worker info message, contains information about the worker and its current state.\nAll information is provided by the worker itself." @@ -21767,7 +21767,7 @@ "description": "If specified, the worker can serve multiple sessions at once." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow Session can receive both workflow\ntasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions\n can receive both workflow tasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." }, "v1WorkerSlotsInfo": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 7a6d3007f..146c9b0ad 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -20067,6 +20067,7 @@ components: description: |- The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has stopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions. + Not used in the case of single-session workers. description: |- Worker info message, contains information about the worker and its current state. All information is provided by the worker itself. @@ -20216,8 +20217,8 @@ components: EXPERIMENTAL. Subject to redesign or removal. Sent on workflow and activity polls. Presence means this worker can serve sessions. Currently, the only supported Session type is Workflow Session - (aka Workflow-as-Session). A Workflow Session can receive both workflow - tasks and activity tasks of an execution. + (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions + can receive both workflow tasks and activity tasks of an execution. The server routes a session's work to the worker's sticky queue, so the sticky queue name depends on the admission mode: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index fb2f9fa16..d68c293ed 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -14,8 +14,8 @@ import "google/protobuf/empty.proto"; // EXPERIMENTAL. Subject to redesign or removal. // Sent on workflow and activity polls. Presence means this worker can serve // sessions. Currently, the only supported Session type is Workflow Session -// (aka Workflow-as-Session). A Workflow Session can receive both workflow -// tasks and activity tasks of an execution. +// (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions +// can receive both workflow tasks and activity tasks of an execution. // // The server routes a session's work to the worker's sticky queue, so the // sticky queue name depends on the admission mode: diff --git a/temporal/api/worker/v1/message.proto b/temporal/api/worker/v1/message.proto index 7fad29a0f..ec29e7dd4 100644 --- a/temporal/api/worker/v1/message.proto +++ b/temporal/api/worker/v1/message.proto @@ -142,6 +142,7 @@ message WorkerHeartbeat { // The worker's session options, as sent on its polls. Lets the server recognize a multi-session worker that has // stopped, so it can move the workflows bound to it to other workers. Unset for a worker without sessions. + // Not used in the case of single-session workers. temporal.api.session.v1.WorkerSessionOptions session_options = 26; } From d5ed3f25d61a8695eb86cde04758eafef036052b Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 16:38:16 -0500 Subject: [PATCH 22/28] Fix comment indentation in WorkerSessionOptions doc Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 2 +- temporal/api/session/v1/message.proto | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 6c9d56b13..f01a10710 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -21767,7 +21767,7 @@ "description": "If specified, the worker can serve multiple sessions at once." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions\n can receive both workflow tasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions\ncan receive both workflow tasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." }, "v1WorkerSlotsInfo": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 146c9b0ad..ebdaf6f82 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -20218,7 +20218,7 @@ components: Sent on workflow and activity polls. Presence means this worker can serve sessions. Currently, the only supported Session type is Workflow Session (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions - can receive both workflow tasks and activity tasks of an execution. + can receive both workflow tasks and activity tasks of an execution. The server routes a session's work to the worker's sticky queue, so the sticky queue name depends on the admission mode: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index d68c293ed..a6cfc054d 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -15,7 +15,7 @@ import "google/protobuf/empty.proto"; // Sent on workflow and activity polls. Presence means this worker can serve // sessions. Currently, the only supported Session type is Workflow Session // (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions -// can receive both workflow tasks and activity tasks of an execution. +// can receive both workflow tasks and activity tasks of an execution. // // The server routes a session's work to the worker's sticky queue, so the // sticky queue name depends on the admission mode: From eecc818e4200fd849ab15423de3cbc932e68114a Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 16:57:18 -0500 Subject: [PATCH 23/28] Keep only the exclusive-worker bit in SessionInfo Unset means unbound, {} a multi-session binding, {exclusive_worker: true} a single-session binding. The worker queue comes from the workflow task's scheduled event. Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 8 ++------ openapi/openapiv3.yaml | 21 +++++++++------------ temporal/api/session/v1/message.proto | 19 +++++++++---------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index f01a10710..fa50fea31 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -19993,14 +19993,10 @@ "properties": { "exclusiveWorker": { "type": "boolean", - "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker. False for a multi-session worker,\nwhose binding moves with the worker that starts the workflow's tasks." - }, - "workerQueue": { - "type": "string", - "description": "The queue of the worker the workflow is bound to, where its tasks are\nrouted: the stable identity of a single-session worker, or the worker\ninstance key of a multi-session worker. Always set." + "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nWhich worker a workflow is bound to. The server records it on history events\nso it can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs\nshould not read or interpret it." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker, recorded on history events so the\nserver can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes:\n * unset: not bound (started by a worker without sessions).\n * {}: bound to a multi-session worker.\n * {exclusive_worker: true}: bound to a single-session worker.\nThe worker's queue is the sticky task queue of the workflow task's scheduled\nevent. Not a worker or user option; SDKs should not read or interpret it." }, "v1SetCurrentDeploymentResponse": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index ebdaf6f82..be1e6266b 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16865,21 +16865,18 @@ components: type: boolean description: |- True when the workflow is bound to a single-session worker. Such a - binding never moves to another worker. False for a multi-session worker, - whose binding moves with the worker that starts the workflow's tasks. - workerQueue: - type: string - description: |- - The queue of the worker the workflow is bound to, where its tasks are - routed: the stable identity of a single-session worker, or the worker - instance key of a multi-session worker. Always set. + binding never moves to another worker. description: |- EXPERIMENTAL. Subject to redesign or removal. - Which worker a workflow is bound to. The server records it on history events - so it can rebuild the binding from history (for example on reset). See + How a workflow is bound to a worker, recorded on history events so the + server can rebuild the binding from history (for example on reset). See session_info on WorkflowTaskStartedEventAttributes and inherited_session_info - on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs - should not read or interpret it. + on WorkflowExecutionStartedEventAttributes: + * unset: not bound (started by a worker without sessions). + * {}: bound to a multi-session worker. + * {exclusive_worker: true}: bound to a single-session worker. + The worker's queue is the sticky task queue of the workflow task's scheduled + event. Not a worker or user option; SDKs should not read or interpret it. SetCurrentDeploymentRequest: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index a6cfc054d..65d6e8314 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -73,18 +73,17 @@ message ActivitySessionOptions { } // EXPERIMENTAL. Subject to redesign or removal. -// Which worker a workflow is bound to. The server records it on history events -// so it can rebuild the binding from history (for example on reset). See +// How a workflow is bound to a worker, recorded on history events so the +// server can rebuild the binding from history (for example on reset). See // session_info on WorkflowTaskStartedEventAttributes and inherited_session_info -// on WorkflowExecutionStartedEventAttributes. Not a worker or user option; SDKs -// should not read or interpret it. +// on WorkflowExecutionStartedEventAttributes: +// * unset: not bound (started by a worker without sessions). +// * {}: bound to a multi-session worker. +// * {exclusive_worker: true}: bound to a single-session worker. +// The worker's queue is the sticky task queue of the workflow task's scheduled +// event. Not a worker or user option; SDKs should not read or interpret it. message SessionInfo { // True when the workflow is bound to a single-session worker. Such a - // binding never moves to another worker. False for a multi-session worker, - // whose binding moves with the worker that starts the workflow's tasks. + // binding never moves to another worker. bool exclusive_worker = 1; - // The queue of the worker the workflow is bound to, where its tasks are - // routed: the stable identity of a single-session worker, or the worker - // instance key of a multi-session worker. Always set. - string worker_queue = 2; } From f616960d0912ff0186fcb0c03e109483fb69e858 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Tue, 24 Nov 2026 17:05:53 -0500 Subject: [PATCH 24/28] Trim SessionInfo doc Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 2 -- temporal/api/session/v1/message.proto | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index fa50fea31..d4c9d3ab3 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -19996,7 +19996,7 @@ "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker, recorded on history events so the\nserver can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes:\n * unset: not bound (started by a worker without sessions).\n * {}: bound to a multi-session worker.\n * {exclusive_worker: true}: bound to a single-session worker.\nThe worker's queue is the sticky task queue of the workflow task's scheduled\nevent. Not a worker or user option; SDKs should not read or interpret it." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker, recorded on history events so the\nserver can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes:\n * unset: not bound (started by a worker without sessions).\n * {}: bound to a multi-session worker.\n * {exclusive_worker: true}: bound to a single-session worker." }, "v1SetCurrentDeploymentResponse": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index be1e6266b..64698818a 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16875,8 +16875,6 @@ components: * unset: not bound (started by a worker without sessions). * {}: bound to a multi-session worker. * {exclusive_worker: true}: bound to a single-session worker. - The worker's queue is the sticky task queue of the workflow task's scheduled - event. Not a worker or user option; SDKs should not read or interpret it. SetCurrentDeploymentRequest: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 65d6e8314..6f89c7628 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -80,8 +80,6 @@ message ActivitySessionOptions { // * unset: not bound (started by a worker without sessions). // * {}: bound to a multi-session worker. // * {exclusive_worker: true}: bound to a single-session worker. -// The worker's queue is the sticky task queue of the workflow task's scheduled -// event. Not a worker or user option; SDKs should not read or interpret it. message SessionInfo { // True when the workflow is bound to a single-session worker. Such a // binding never moves to another worker. From 89f0f129275706f2454a6897f3265b3d7939c64e Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Wed, 25 Nov 2026 12:17:30 -0500 Subject: [PATCH 25/28] Address review: service wording, sticky queue note, SessionInfo doc, drop cron Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 16 +++++++-------- openapi/openapiv3.yaml | 28 +++++++++++---------------- temporal/api/history/v1/message.proto | 2 +- temporal/api/session/v1/message.proto | 28 +++++++++++---------------- 4 files changed, 31 insertions(+), 43 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index d4c9d3ab3..44c9eaf76 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -14186,7 +14186,7 @@ "workflowSession": { "type": "object", "properties": {}, - "description": "Run in the workflow's current session (on its sticky queue).\nCurrently requires the activity's task queue to be the workflow's,\nand the workflow's worker to serve sessions." + "description": "Run in the workflow's current session (on its sticky queue).\nCurrently requires the activity's task queue to be the workflow's,\nand the workflow's worker to service sessions." } }, "description": "EXPERIMENTAL. Subject to redesign or removal.\nResolved activity placement. Unset = normal task-queue routing." @@ -17416,7 +17416,7 @@ }, "v1MultiSessionOptions": { "type": "object", - "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe any number of sessions concurrently. Future admission knobs (e.g.\nsession slots) belong here." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nService any number of sessions concurrently. Future admission knobs (e.g.\nsession slots) belong here." }, "v1NamespaceConfig": { "type": "object", @@ -19996,7 +19996,7 @@ "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker, recorded on history events so the\nserver can rebuild the binding from history (for example on reset). See\nsession_info on WorkflowTaskStartedEventAttributes and inherited_session_info\non WorkflowExecutionStartedEventAttributes:\n * unset: not bound (started by a worker without sessions).\n * {}: bound to a multi-session worker.\n * {exclusive_worker: true}: bound to a single-session worker." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker. Empty for a multi-session worker." }, "v1SetCurrentDeploymentResponse": { "type": "object", @@ -20192,10 +20192,10 @@ "properties": { "stableIdentity": { "type": "string", - "description": "Identity the binding is stored under. Required; must be non-empty.\nReuse it across restarts of the same session, not across concurrently\nrunning workers. If multiple workers poll with the same stable_identity\nconcurrently, the server treats them as pollers of a single worker and\nprocess affinity is lost.\n\nNote: this effectively acts as a configurable sticky queue.\nNote: we are currently unsure how this will evolve. May be deprecated as\nthe session model develops." + "description": "Identity the binding is stored under. Required; must be non-empty.\nReuse it across restarts of the same session, not across concurrently\nrunning workers. If multiple workers poll with the same stable_identity\nconcurrently, the server treats them as pollers of a single worker and\nprocess affinity is lost.\n\nNote: this effectively acts as a sticky queue that can be configured by the user.\nNote: we are currently unsure how this will evolve. May be deprecated as\nthe session model develops." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nServe exactly one session for the worker's lifetime, including across\nprocess restarts with the same stable_identity. The server binds the worker\nto the first session that needs a worker, and dispatches no other work here,\neven after that session completes." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nService exactly one session for the worker's lifetime, including across\nprocess restarts with the same stable_identity. The first workflow this\nworker picks up is bound to it, and from then on the worker only receives\nthat workflow's tasks, even after the workflow completes." }, "v1StartActivityExecutionResponse": { "type": "object", @@ -21760,10 +21760,10 @@ }, "multiSession": { "$ref": "#/definitions/v1MultiSessionOptions", - "description": "If specified, the worker can serve multiple sessions at once." + "description": "If specified, the worker can service multiple sessions at once." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can serve\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions\ncan receive both workflow tasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nSent on workflow and activity polls. Presence means this worker can service\nsessions. Currently, the only supported Session type is Workflow Session\n(aka Workflow-as-Session). A Workflow that is bound to a worker servicing sessions\ncan receive both workflow tasks and activity tasks of an execution.\n\nThe server routes a session's work to the worker's sticky queue, so the\nsticky queue name depends on the admission mode:\n * single_session: the worker polls only its sticky queue, named after\n SingleSessionOptions.stable_identity.\n * multi_session: the worker polls the normal queue and its sticky queue,\n named after the poll's worker_instance_key.\nThe server rejects sticky polls whose name does not follow this rule." }, "v1WorkerSlotsInfo": { "type": "object", @@ -22487,7 +22487,7 @@ }, "inheritedSessionInfo": { "$ref": "#/definitions/v1SessionInfo", - "description": "Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server\ncan rebuild it from history. Nil when the previous run was not bound or this run is on a different\ntask queue. Child workflows never inherit it.\nUsed internally by the server; SDKs should not read or interpret this field.\nEXPERIMENTAL. Subject to redesign or removal." + "description": "Session info this run inherited from the previous run (continue-as-new or retry), so the server\ncan rebuild it from history. Nil when the previous run was not bound or this run is on a different\ntask queue. Child workflows never inherit it.\nUsed internally by the server; SDKs should not read or interpret this field.\nEXPERIMENTAL. Subject to redesign or removal." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 64698818a..84c102f6d 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -13628,7 +13628,7 @@ components: properties: {} description: |- EXPERIMENTAL. Subject to redesign or removal. - Serve any number of sessions concurrently. Future admission knobs (e.g. + Service any number of sessions concurrently. Future admission knobs (e.g. session slots) belong here. NamespaceConfig: type: object @@ -16868,13 +16868,7 @@ components: binding never moves to another worker. description: |- EXPERIMENTAL. Subject to redesign or removal. - How a workflow is bound to a worker, recorded on history events so the - server can rebuild the binding from history (for example on reset). See - session_info on WorkflowTaskStartedEventAttributes and inherited_session_info - on WorkflowExecutionStartedEventAttributes: - * unset: not bound (started by a worker without sessions). - * {}: bound to a multi-session worker. - * {exclusive_worker: true}: bound to a single-session worker. + How a workflow is bound to a worker. Empty for a multi-session worker. SetCurrentDeploymentRequest: type: object properties: @@ -17370,15 +17364,15 @@ components: concurrently, the server treats them as pollers of a single worker and process affinity is lost. - Note: this effectively acts as a configurable sticky queue. + Note: this effectively acts as a sticky queue that can be configured by the user. Note: we are currently unsure how this will evolve. May be deprecated as the session model develops. description: |- EXPERIMENTAL. Subject to redesign or removal. - Serve exactly one session for the worker's lifetime, including across - process restarts with the same stable_identity. The server binds the worker - to the first session that needs a worker, and dispatches no other work here, - even after that session completes. + Service exactly one session for the worker's lifetime, including across + process restarts with the same stable_identity. The first workflow this + worker picks up is bound to it, and from then on the worker only receives + that workflow's tasks, even after the workflow completes. StartActivityExecutionRequest: type: object properties: @@ -20207,12 +20201,12 @@ components: multiSession: allOf: - $ref: '#/components/schemas/MultiSessionOptions' - description: If specified, the worker can serve multiple sessions at once. + description: If specified, the worker can service multiple sessions at once. description: |- EXPERIMENTAL. Subject to redesign or removal. - Sent on workflow and activity polls. Presence means this worker can serve + Sent on workflow and activity polls. Presence means this worker can service sessions. Currently, the only supported Session type is Workflow Session - (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions + (aka Workflow-as-Session). A Workflow that is bound to a worker servicing sessions can receive both workflow tasks and activity tasks of an execution. The server routes a session's work to the worker's sticky queue, so the @@ -21186,7 +21180,7 @@ components: allOf: - $ref: '#/components/schemas/SessionInfo' description: |- - Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server + Session info this run inherited from the previous run (continue-as-new or retry), so the server can rebuild it from history. Nil when the previous run was not bound or this run is on a different task queue. Child workflows never inherit it. Used internally by the server; SDKs should not read or interpret this field. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 5de25065c..5f9a29759 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -220,7 +220,7 @@ message WorkflowExecutionStartedEventAttributes { // Serialization context propagated from the Nexus caller that started this workflow. temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 44; - // Session info this run inherited from the previous run (continue-as-new, retry or cron), so the server + // Session info this run inherited from the previous run (continue-as-new or retry), so the server // can rebuild it from history. Nil when the previous run was not bound or this run is on a different // task queue. Child workflows never inherit it. // Used internally by the server; SDKs should not read or interpret this field. diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 6f89c7628..302329807 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -12,9 +12,9 @@ option csharp_namespace = "Temporalio.Api.Session.V1"; import "google/protobuf/empty.proto"; // EXPERIMENTAL. Subject to redesign or removal. -// Sent on workflow and activity polls. Presence means this worker can serve +// Sent on workflow and activity polls. Presence means this worker can service // sessions. Currently, the only supported Session type is Workflow Session -// (aka Workflow-as-Session). A Workflow that is bound to a worker serving sessions +// (aka Workflow-as-Session). A Workflow that is bound to a worker servicing sessions // can receive both workflow tasks and activity tasks of an execution. // // The server routes a session's work to the worker's sticky queue, so the @@ -30,16 +30,16 @@ message WorkerSessionOptions { oneof admission { // If specified, the worker only polls for work belonging to its session. SingleSessionOptions single_session = 1; - // If specified, the worker can serve multiple sessions at once. + // If specified, the worker can service multiple sessions at once. MultiSessionOptions multi_session = 2; } } // EXPERIMENTAL. Subject to redesign or removal. -// Serve exactly one session for the worker's lifetime, including across -// process restarts with the same stable_identity. The server binds the worker -// to the first session that needs a worker, and dispatches no other work here, -// even after that session completes. +// Service exactly one session for the worker's lifetime, including across +// process restarts with the same stable_identity. The first workflow this +// worker picks up is bound to it, and from then on the worker only receives +// that workflow's tasks, even after the workflow completes. message SingleSessionOptions { // Identity the binding is stored under. Required; must be non-empty. // Reuse it across restarts of the same session, not across concurrently @@ -47,14 +47,14 @@ message SingleSessionOptions { // concurrently, the server treats them as pollers of a single worker and // process affinity is lost. // - // Note: this effectively acts as a configurable sticky queue. + // Note: this effectively acts as a sticky queue that can be configured by the user. // Note: we are currently unsure how this will evolve. May be deprecated as // the session model develops. string stable_identity = 1; } // EXPERIMENTAL. Subject to redesign or removal. -// Serve any number of sessions concurrently. Future admission knobs (e.g. +// Service any number of sessions concurrently. Future admission knobs (e.g. // session slots) belong here. message MultiSessionOptions { } @@ -65,7 +65,7 @@ message ActivitySessionOptions { oneof placement { // Run in the workflow's current session (on its sticky queue). // Currently requires the activity's task queue to be the workflow's, - // and the workflow's worker to serve sessions. + // and the workflow's worker to service sessions. google.protobuf.Empty workflow_session = 1; // Future: references to other types of sessions. @@ -73,13 +73,7 @@ message ActivitySessionOptions { } // EXPERIMENTAL. Subject to redesign or removal. -// How a workflow is bound to a worker, recorded on history events so the -// server can rebuild the binding from history (for example on reset). See -// session_info on WorkflowTaskStartedEventAttributes and inherited_session_info -// on WorkflowExecutionStartedEventAttributes: -// * unset: not bound (started by a worker without sessions). -// * {}: bound to a multi-session worker. -// * {exclusive_worker: true}: bound to a single-session worker. +// How a workflow is bound to a worker. Empty for a multi-session worker. message SessionInfo { // True when the workflow is bound to a single-session worker. Such a // binding never moves to another worker. From a045f66c9ce91cbeb53aedd60a6746ae96c10224 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Wed, 25 Nov 2026 12:22:20 -0500 Subject: [PATCH 26/28] Reword stable_identity note Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 2 +- openapi/openapiv3.yaml | 2 +- temporal/api/session/v1/message.proto | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index f670918ba..6bbe88f06 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -20196,7 +20196,7 @@ "properties": { "stableIdentity": { "type": "string", - "description": "Identity the binding is stored under. Required; must be non-empty.\nReuse it across restarts of the same session, not across concurrently\nrunning workers. If multiple workers poll with the same stable_identity\nconcurrently, the server treats them as pollers of a single worker and\nprocess affinity is lost.\n\nNote: this effectively acts as a sticky queue that can be configured by the user.\nNote: we are currently unsure how this will evolve. May be deprecated as\nthe session model develops." + "description": "Identity the binding is stored under. Required; must be non-empty.\nReuse it across restarts of the same session, not across concurrently\nrunning workers. If multiple workers poll with the same stable_identity\nconcurrently, the server treats them as pollers of a single worker and\nprocess affinity is lost.\n\nNote: this is the name of the worker's sticky queue, specified by the user.\nNote: we are currently unsure how this will evolve. May be deprecated as\nthe session model develops." } }, "description": "EXPERIMENTAL. Subject to redesign or removal.\nService exactly one session for the worker's lifetime, including across\nprocess restarts with the same stable_identity. The first workflow this\nworker picks up is bound to it, and from then on the worker only receives\nthat workflow's tasks, even after the workflow completes." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 4550fbed6..48a666e5d 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -17372,7 +17372,7 @@ components: concurrently, the server treats them as pollers of a single worker and process affinity is lost. - Note: this effectively acts as a sticky queue that can be configured by the user. + Note: this is the name of the worker's sticky queue, specified by the user. Note: we are currently unsure how this will evolve. May be deprecated as the session model develops. description: |- diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 302329807..14bc1f912 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -47,7 +47,7 @@ message SingleSessionOptions { // concurrently, the server treats them as pollers of a single worker and // process affinity is lost. // - // Note: this effectively acts as a sticky queue that can be configured by the user. + // Note: this is the name of the worker's sticky queue, specified by the user. // Note: we are currently unsure how this will evolve. May be deprecated as // the session model develops. string stable_identity = 1; From 5dae7e5043a68e8a6444c74ee208b6c673769303 Mon Sep 17 00:00:00 2001 From: Shivam <57200924+Shivs11@users.noreply.github.com> Date: Wed, 25 Nov 2026 15:40:44 -0500 Subject: [PATCH 27/28] Record the bound worker's queue in SessionInfo (#927) **What changed?** `SessionInfo.worker_queue`: the sticky queue of the worker a workflow is bound to (stable identity for single-session, worker instance key for multi-session). **Why?** History has no other record of the bound worker's queue: the workflow task that binds a worker is scheduled on the normal queue, the started/completed events carry no queue, and the started event's `task_queue` is the workflow's normal queue that SDKs read. Without it, a reset to the binding task or a continue-as-new/retry rebuild loses the binding. Written only on history events; read only when the server rebuilds state from them. **Breaking changes** None. New experimental field on top of #885. **Server PR** To follow, with the session stack. Co-authored-by: Claude Opus 5.5 --- openapi/openapiv2.json | 6 +++++- openapi/openapiv3.yaml | 10 +++++++++- temporal/api/session/v1/message.proto | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 6bbe88f06..01e0bf9fe 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -19998,9 +19998,13 @@ "exclusiveWorker": { "type": "boolean", "description": "True when the workflow is bound to a single-session worker. Such a\nbinding never moves to another worker." + }, + "workerQueue": { + "type": "string", + "description": "The sticky queue of the worker the workflow is bound to: the stable\nidentity of a single-session worker, or the worker instance key of a\nmulti-session worker. History has no other record of it, so the server\nneeds it to restore the binding when it rebuilds the workflow from\nhistory. Always set." } }, - "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker. Empty for a multi-session worker." + "description": "EXPERIMENTAL. Subject to redesign or removal.\nHow a workflow is bound to a worker." }, "v1SetCurrentDeploymentResponse": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 48a666e5d..68bd9e173 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -16874,9 +16874,17 @@ components: description: |- True when the workflow is bound to a single-session worker. Such a binding never moves to another worker. + workerQueue: + type: string + description: |- + The sticky queue of the worker the workflow is bound to: the stable + identity of a single-session worker, or the worker instance key of a + multi-session worker. History has no other record of it, so the server + needs it to restore the binding when it rebuilds the workflow from + history. Always set. description: |- EXPERIMENTAL. Subject to redesign or removal. - How a workflow is bound to a worker. Empty for a multi-session worker. + How a workflow is bound to a worker. SetCurrentDeploymentRequest: type: object properties: diff --git a/temporal/api/session/v1/message.proto b/temporal/api/session/v1/message.proto index 14bc1f912..5331a0941 100644 --- a/temporal/api/session/v1/message.proto +++ b/temporal/api/session/v1/message.proto @@ -73,9 +73,15 @@ message ActivitySessionOptions { } // EXPERIMENTAL. Subject to redesign or removal. -// How a workflow is bound to a worker. Empty for a multi-session worker. +// How a workflow is bound to a worker. message SessionInfo { // True when the workflow is bound to a single-session worker. Such a // binding never moves to another worker. bool exclusive_worker = 1; + // The sticky queue of the worker the workflow is bound to: the stable + // identity of a single-session worker, or the worker instance key of a + // multi-session worker. History has no other record of it, so the server + // needs it to restore the binding when it rebuilds the workflow from + // history. Always set. + string worker_queue = 2; } From 779f3f753819a6b4db88c8afdc5ceebd580bb3d7 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Fri, 27 Nov 2026 18:43:07 -0500 Subject: [PATCH 28/28] Add WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED A workflow with session activities waiting for a session worker can only have its workflow tasks completed by a worker servicing sessions; the server fails a completion from any other worker with this cause. Co-Authored-By: Claude Opus 5.5 --- openapi/openapiv2.json | 5 +++-- openapi/openapiv3.yaml | 1 + temporal/api/enums/v1/failed_cause.proto | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 01e0bf9fe..ba3e98e4b 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -22973,10 +22973,11 @@ "WORKFLOW_TASK_FAILED_CAUSE_PAYLOADS_TOO_LARGE", "WORKFLOW_TASK_FAILED_CAUSE_EXTERNAL_STORAGE_FAILURE", "WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED", - "WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE" + "WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE", + "WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED" ], "default": "WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED", - "description": "Workflow tasks can fail for various reasons. Note that some of these reasons can only originate\nfrom the server, and some of them can only originate from the SDK/worker.\n\n - WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND: Between starting and completing the workflow task (with a workflow completion command), some\nnew command (like a signal) was processed into workflow history. The outstanding task will be\nfailed with this reason, and a worker must pick up a new task.\n - WORKFLOW_TASK_FAILED_CAUSE_RESET_STICKY_TASK_QUEUE: The worker wishes to fail the task and have the next one be generated on a normal, not sticky\nqueue. Generally workers should prefer to use the explicit `ResetStickyTaskQueue` RPC call.\n - WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR: The worker encountered a mismatch while replaying history between what was expected, and\nwhat the workflow code actually did.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_CHILD_WORKFLOWS_LIMIT_EXCEEDED: We send the below error codes to users when their requests would violate a size constraint\nof their workflow. We do this to ensure that the state of their workflow does not become too\nlarge because that can cause severe performance degradation. You can modify the thresholds for\neach of these errors within your dynamic config.\n\nSpawning a new child workflow would cause this workflow to exceed its limit of pending child\nworkflows.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_ACTIVITIES_LIMIT_EXCEEDED: Starting a new activity would cause this workflow to exceed its limit of pending activities\nthat we track.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_SIGNALS_LIMIT_EXCEEDED: A workflow has a buffer of signals that have not yet reached their destination. We return this\nerror when sending a new signal would exceed the capacity of this buffer.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_REQUEST_CANCEL_LIMIT_EXCEEDED: Similarly, we have a buffer of pending requests to cancel other workflows. We return this error\nwhen our capacity for pending cancel requests is already reached.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_UPDATE_WORKFLOW_EXECUTION_MESSAGE: Workflow execution update message (update.Acceptance, update.Rejection, or update.Response)\nhas wrong format, or missing required fields.\n - WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_UPDATE: Similar to WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND, but for updates.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_NEXUS_OPERATION_ATTRIBUTES: A workflow task completed with an invalid ScheduleNexusOperation command.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_NEXUS_OPERATIONS_LIMIT_EXCEEDED: A workflow task completed requesting to schedule a Nexus Operation exceeding the server configured limit.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_NEXUS_OPERATION_ATTRIBUTES: A workflow task completed with an invalid RequestCancelNexusOperation command.\n - WORKFLOW_TASK_FAILED_CAUSE_FEATURE_DISABLED: A workflow task completed requesting a feature that's disabled on the server (either system wide or - typically -\nfor the workflow's namespace).\nCheck the workflow task failure message for more information.\n - WORKFLOW_TASK_FAILED_CAUSE_GRPC_MESSAGE_TOO_LARGE: A workflow task failed because a grpc message was too large.\n - WORKFLOW_TASK_FAILED_CAUSE_PAYLOADS_TOO_LARGE: A workflow task failed because payloads were too large.\n - WORKFLOW_TASK_FAILED_CAUSE_EXTERNAL_STORAGE_FAILURE: A workflow task failed because an external storage operation failed.\nCheck the workflow task failure message for more information.\n - WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED: A workflow task is failed because the workflow is paused before the task is started.\n - WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE: A workflow task failed because the request exceeded a size limit." + "description": "Workflow tasks can fail for various reasons. Note that some of these reasons can only originate\nfrom the server, and some of them can only originate from the SDK/worker.\n\n - WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND: Between starting and completing the workflow task (with a workflow completion command), some\nnew command (like a signal) was processed into workflow history. The outstanding task will be\nfailed with this reason, and a worker must pick up a new task.\n - WORKFLOW_TASK_FAILED_CAUSE_RESET_STICKY_TASK_QUEUE: The worker wishes to fail the task and have the next one be generated on a normal, not sticky\nqueue. Generally workers should prefer to use the explicit `ResetStickyTaskQueue` RPC call.\n - WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR: The worker encountered a mismatch while replaying history between what was expected, and\nwhat the workflow code actually did.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_CHILD_WORKFLOWS_LIMIT_EXCEEDED: We send the below error codes to users when their requests would violate a size constraint\nof their workflow. We do this to ensure that the state of their workflow does not become too\nlarge because that can cause severe performance degradation. You can modify the thresholds for\neach of these errors within your dynamic config.\n\nSpawning a new child workflow would cause this workflow to exceed its limit of pending child\nworkflows.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_ACTIVITIES_LIMIT_EXCEEDED: Starting a new activity would cause this workflow to exceed its limit of pending activities\nthat we track.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_SIGNALS_LIMIT_EXCEEDED: A workflow has a buffer of signals that have not yet reached their destination. We return this\nerror when sending a new signal would exceed the capacity of this buffer.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_REQUEST_CANCEL_LIMIT_EXCEEDED: Similarly, we have a buffer of pending requests to cancel other workflows. We return this error\nwhen our capacity for pending cancel requests is already reached.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_UPDATE_WORKFLOW_EXECUTION_MESSAGE: Workflow execution update message (update.Acceptance, update.Rejection, or update.Response)\nhas wrong format, or missing required fields.\n - WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_UPDATE: Similar to WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND, but for updates.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_NEXUS_OPERATION_ATTRIBUTES: A workflow task completed with an invalid ScheduleNexusOperation command.\n - WORKFLOW_TASK_FAILED_CAUSE_PENDING_NEXUS_OPERATIONS_LIMIT_EXCEEDED: A workflow task completed requesting to schedule a Nexus Operation exceeding the server configured limit.\n - WORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_NEXUS_OPERATION_ATTRIBUTES: A workflow task completed with an invalid RequestCancelNexusOperation command.\n - WORKFLOW_TASK_FAILED_CAUSE_FEATURE_DISABLED: A workflow task completed requesting a feature that's disabled on the server (either system wide or - typically -\nfor the workflow's namespace).\nCheck the workflow task failure message for more information.\n - WORKFLOW_TASK_FAILED_CAUSE_GRPC_MESSAGE_TOO_LARGE: A workflow task failed because a grpc message was too large.\n - WORKFLOW_TASK_FAILED_CAUSE_PAYLOADS_TOO_LARGE: A workflow task failed because payloads were too large.\n - WORKFLOW_TASK_FAILED_CAUSE_EXTERNAL_STORAGE_FAILURE: A workflow task failed because an external storage operation failed.\nCheck the workflow task failure message for more information.\n - WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED: A workflow task is failed because the workflow is paused before the task is started.\n - WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE: A workflow task failed because the request exceeded a size limit.\n - WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED: A workflow task was completed by a worker that does not service sessions while the workflow has session\nactivities waiting for a session worker. Only a worker servicing sessions can complete the workflow's tasks\nuntil one binds the workflow. The task is retried; check the workflow task failure message for more information." }, "v1WorkflowTaskFailedEventAttributes": { "type": "object", diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 68bd9e173..3bf8d3332 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -21769,6 +21769,7 @@ components: - WORKFLOW_TASK_FAILED_CAUSE_EXTERNAL_STORAGE_FAILURE - WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED - WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE + - WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED type: string format: enum failure: diff --git a/temporal/api/enums/v1/failed_cause.proto b/temporal/api/enums/v1/failed_cause.proto index ba0d74273..a1e004de8 100644 --- a/temporal/api/enums/v1/failed_cause.proto +++ b/temporal/api/enums/v1/failed_cause.proto @@ -90,6 +90,10 @@ enum WorkflowTaskFailedCause { WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_PAUSE_REQUESTED_BEFORE_TASK_STARTED = 39; // A workflow task failed because the request exceeded a size limit. WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE = 40; + // A workflow task was completed by a worker that does not service sessions while the workflow has session + // activities waiting for a session worker. Only a worker servicing sessions can complete the workflow's tasks + // until one binds the workflow. The task is retried; check the workflow task failure message for more information. + WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED = 41; } // Activity tasks can fail for various reasons. Note that some of these reasons can only originate