Skip to content

Carry a worker's session options on its heartbeat - #920

Closed
Shivs11 wants to merge 1 commit into
shivam/session-binding-historyfrom
shivam/session-heartbeat-options
Closed

Shivs11 wants to merge 1 commit into
shivam/session-binding-historyfrom
shivam/session-heartbeat-options

Conversation

@Shivs11

@Shivs11 Shivs11 commented Nov 24, 2026

Copy link
Copy Markdown
Member

What changed?
WorkerHeartbeat.session_options (temporal.api.session.v1.WorkerSessionOptions), the same options the worker sends on its polls.

Why?
Lets the server recognize a stopped multi-session worker (from ShutdownWorker or a missed-heartbeat expiry) and move the workflows bound to it to other workers.

Breaking changes
None. New experimental field; unset for workers without sessions.

Server PR
To follow, on top of the session stack (session worker queue drain).

@Shivs11

Shivs11 commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Folded into #885 so the session API can be reviewed in one place.

@Shivs11 Shivs11 closed this Nov 24, 2026
Shivs11 added a commit that referenced this pull request Nov 30, 2026
)

**What changed?**
- `WorkerSessionOptions` on workflow/activity polls with one required
admission mode: `SingleSessionOptions{stable_identity}` or
`MultiSessionOptions{}`. The worker's sticky queue is named after
`stable_identity` (single-session) or `worker_instance_key`
(multi-session).
- `ActivitySessionOptions` so an activity can run in its workflow's
session.
- `SessionInfo{exclusive_worker}` recorded on
`WorkflowTaskStartedEventAttributes` and
`WorkflowExecutionStartedEventAttributes` (inherited across
continue-as-new/retry/cron), so resets can keep a single-session
worker's binding. Reset for multi-session workers comes later.
- `WorkerHeartbeat.session_options`.
- Folds in #910, #916 and #920.

**Why?**
Workflow as Session: route a workflow's tasks to the worker it is bound
to, keep that binding across resets and new runs, and let the server
move workflows off a stopped multi-session worker.

**Breaking changes**
None. All new fields are experimental.

**Server PR**
(still cooking)
- temporalio/temporal#12630
- temporalio/temporal#12770

---------

Co-authored-by: Shahab <shahab@temporal.io>
Co-authored-by: Thomas Hardy <thomas.hardy@temporal.io>
Co-authored-by: Thomas Hardy <thestaffofmoses@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant