Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b23db7b
Add activity session_options
ShahabT Oct 14, 2026
c28c289
`single_workflow_mode` poll flag
ShahabT Oct 15, 2026
7132c51
Model single-session isolation in poll session options
THardy98 Oct 19, 2026
be0506d
Clarify session affinity documentation and remove dev reservations
THardy98 Oct 19, 2026
d59dfca
Name worker session options and use next available poll tags
THardy98 Oct 19, 2026
01c117a
Rename activity routing intent to use_workflow_session
THardy98 Oct 19, 2026
6811161
Record activity session options in scheduled history events
THardy98 Oct 20, 2026
c561d0b
Merge remote-tracking branch 'origin/main' into sticky-activity-sessi…
THardy98 Oct 23, 2026
d183f54
Propose basic session API shape (#893)
THardy98 Oct 27, 2026
7fd0921
Document that stable_identity is required
THardy98 Oct 28, 2026
d6e6f6d
Merge remote-tracking branch 'origin/main' into shivam/885-sync-main
Shivs11 Nov 17, 2026
47cb323
Renumber session_options to 12 and regenerate openapi
Shivs11 Nov 17, 2026
3f47869
Add MultiSessionOptions; route its sessions to the instance-key stick…
Shivs11 Nov 24, 2026
a54da84
Record a workflow's session info on history events
Shivs11 Nov 20, 2026
4686407
Move BoundWorkerInfo's future-fields note into its doc comment for ap…
Shivs11 Nov 24, 2026
c6980ad
Carry a worker's session options on its heartbeat
Shivs11 Nov 24, 2026
e9c0ac9
Name a multi-session worker's queue after its instance key in BoundWo…
Shivs11 Nov 24, 2026
a0628f0
Merge remote-tracking branch 'origin/main' into sticky-activity-sessi…
Shivs11 Nov 24, 2026
a5ac2d9
Renumber poll session_options to 13 after main took 12
Shivs11 Nov 24, 2026
d555c70
Document how the sticky queue is named for each session admission mode
Shivs11 Nov 24, 2026
252a312
Document which polls carry session options for each admission mode
Shivs11 Nov 24, 2026
d67ca94
Note that a multi-session worker's sticky queue is named after its in…
Shivs11 Nov 24, 2026
d77590e
Flatten BoundWorkerInfo into SessionInfo.worker_queue
Shivs11 Nov 24, 2026
877618d
Clarify session option docs
Shivs11 Nov 24, 2026
d5ed3f2
Fix comment indentation in WorkerSessionOptions doc
Shivs11 Nov 24, 2026
eecc818
Keep only the exclusive-worker bit in SessionInfo
Shivs11 Nov 24, 2026
f616960
Trim SessionInfo doc
Shivs11 Nov 24, 2026
89f0f12
Address review: service wording, sticky queue note, SessionInfo doc, …
Shivs11 Nov 25, 2026
528579f
Merge remote-tracking branch 'origin/main' into shivam/885-one-pr
Shivs11 Nov 25, 2026
a045f66
Reword stable_identity note
Shivs11 Nov 25, 2026
5dae7e5
Record the bound worker's queue in SessionInfo (#927)
Shivs11 Nov 25, 2026
779f3f7
Add WORKFLOW_TASK_FAILED_CAUSE_SESSION_WORKER_REQUIRED
Shivs11 Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 72 additions & 2 deletions openapi/openapiv2.json

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -13619,6 +13631,13 @@ components:
aip.dev/not-precedent: Negative values make no sense to represent. --)
format: uint32
description: Metadata relevant for metering purposes
MultiSessionOptions:
type: object
properties: {}
description: |-
EXPERIMENTAL. Subject to redesign or removal.
Service any number of sessions concurrently. Future admission knobs (e.g.
session slots) belong here.
NamespaceConfig:
type: object
properties:
Expand Down Expand Up @@ -16847,6 +16866,25 @@ 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.
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.
SetCurrentDeploymentRequest:
type: object
properties:
Expand Down Expand Up @@ -17330,6 +17368,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 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: |-
EXPERIMENTAL. Subject to redesign or removal.
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:
Expand Down Expand Up @@ -20007,6 +20066,13 @@ 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.
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.
Expand Down Expand Up @@ -20141,6 +20207,31 @@ 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 service multiple sessions at once.
description: |-
EXPERIMENTAL. Subject to redesign or removal.
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 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
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:
Expand Down Expand Up @@ -21101,6 +21192,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 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.
EXPERIMENTAL. Subject to redesign or removal.
description: Always the first event in workflow history
WorkflowExecutionTerminatedEventAttributes:
type: object
Expand Down Expand Up @@ -21669,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:
Expand Down Expand Up @@ -21781,6 +21882,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:
Expand Down
3 changes: 3 additions & 0 deletions temporal/api/command/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions temporal/api/enums/v1/failed_cause.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions temporal/api/history/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -218,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 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.
// EXPERIMENTAL. Subject to redesign or removal.
temporal.api.session.v1.SessionInfo inherited_session_info = 45;
}


Expand Down Expand Up @@ -341,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 {
Expand Down Expand Up @@ -467,6 +480,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 {
Expand Down
87 changes: 87 additions & 0 deletions temporal/api/session/v1/message.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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";

import "google/protobuf/empty.proto";

// EXPERIMENTAL. Subject to redesign or removal.
// 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 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
// 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.
oneof admission {
// If specified, the worker only polls for work belonging to its session.
SingleSessionOptions single_session = 1;
// If specified, the worker can service multiple sessions at once.
MultiSessionOptions multi_session = 2;
}
}

// EXPERIMENTAL. Subject to redesign or removal.
// 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 {
Comment thread
Shivs11 marked this conversation as resolved.
Resolved
// 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 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;
}

// EXPERIMENTAL. Subject to redesign or removal.
// Service any number of sessions concurrently. 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 {
Comment thread
Shivs11 marked this conversation as resolved.
Resolved
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 service sessions.
google.protobuf.Empty workflow_session = 1;

// Future: references to other types of sessions.
}
}

// EXPERIMENTAL. Subject to redesign or removal.
// 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;
}
6 changes: 6 additions & 0 deletions temporal/api/worker/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "google/protobuf/timestamp.proto";
import "temporal/api/common/v1/message.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.
Expand Down Expand Up @@ -138,6 +139,11 @@ 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.
// Not used in the case of single-session workers.
temporal.api.session.v1.WorkerSessionOptions session_options = 26;
}

// Detailed worker information.
Expand Down
Loading
Loading