Skip to content

Add MultiSessionOptions with worker_address to session admission - #910

Closed
Shivs11 wants to merge 1 commit into
sticky-activity-session-optionsfrom
shivam/multi-session-options
Closed

Shivs11 wants to merge 1 commit into
sticky-activity-session-optionsfrom
shivam/multi-session-options

Conversation

@Shivs11

@Shivs11 Shivs11 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What changed?
Stacked on #885. Adds a second admission member to WorkerSessionOptions:

oneof admission {
    SingleSessionOptions single_session = 1;
    MultiSessionOptions multi_session = 2;
}

message MultiSessionOptions {
    // Set by the SDK to the worker's sticky queue name; not user-configurable (for now).
    string worker_address = 1;
}

Why?
General (multi-session) workflow sessions need to recover when their worker dies. When the session's next task starts on another worker, including a task taken from the normal queue, the server binds the session to that worker and reschedules pending session work onto its sticky queue. To do that, the server needs the worker's address on the poll. Today, general workers send only WorkerSessionOptions{} on sticky polls.

Breaking changes
None on released APIs (experimental, unreleased).

Server PR
Follows; server-side start binding is still in design.

General (multi-session) workers need to send their address on polls so
the server can bind a workflow session to the worker when a task starts
on it, including tasks taken from the normal queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could be missing something, but in my head a general session worker == multi-session worker since it can serve multiple workflows-as-sessions (which is why i scraped off using 'GeneralSessionOptions' and made this)

@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