Skip to content

Add stable destinations and lifetime single-session isolation - #1687

Draft
THardy98 wants to merge 10 commits into
review/sticky-activity-pollingfrom
dev/sticky-activities-v2
Draft

THardy98 wants to merge 10 commits into
review/sticky-activity-pollingfrom
dev/sticky-activities-v2

Conversation

@THardy98

@THardy98 THardy98 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

  • SingleSessionOptions { stable_identity }: the worker polls only its sticky queues, named by stable_identity, for workflow and activity tasks.
  • WorkerSessionOptions is sent on workflow and activity polls so the server can bind the worker to one workflow for its lifetime.
  • Single-session workers are excluded from eager workflow start, which would bypass binding.
  • stable_identity must be non-empty; single-session workers may use one fixed activity slot (paired mode still needs two).

Why?

Worker-workflow binding for the AgentCore demo: a workflow stays on one worker identity across restarts. Stacked on #1691.

Checklist

  1. Closes: N/A (API: WorkerSessionOptions + ActivitySessionOptions -- Defining Sessions api#885, server: temporalio/temporal shivam/agentcore-single-session)
  2. How was this tested: unit tests for sticky-only polling at the stable destination, identity validation, and single-session replay; existing suite.
  3. Any docs updates needed? Not yet (experimental).

@THardy98 THardy98 changed the title Add activity sessions on shared sticky polling Add stable destinations and lifetime single-session isolation Oct 21, 2026
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from f0971e2 to 20d0d89 Compare October 21, 2026 01:22
@THardy98
THardy98 changed the base branch from refactor/shared-sticky-poll-admission to review/sticky-activity-polling October 21, 2026 01:22
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from 20d0d89 to c454d8f Compare October 21, 2026 12:01
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from c454d8f to 0de941f Compare October 21, 2026 13:54
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch 2 times, most recently from a87a7c2 to 110e736 Compare October 28, 2026 15:02
@THardy98
THardy98 added this pull request to stack #1719 October 28, 2026 15:38
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from 110e736 to ae440be Compare October 28, 2026 15:47
THardy98 added a commit to temporalio/sdk-python that referenced this pull request Oct 28, 2026
Pin Core to the rebased session stack (temporalio/sdk-rust#1687 at
ae440be3), which adopts temporalio/api#885 at d183f54c. Regenerate the
Python protos and encode workflow-session placement as the
`workflow_session` Empty field instead of the old bool, which a server
built on the new API would otherwise ignore.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from ae440be to 59f8a8f Compare October 28, 2026 20:17
THardy98 added a commit to temporalio/sdk-python that referenced this pull request Oct 28, 2026
Pin Core to the session stack (temporalio/sdk-rust#1687 at 59f8a8f7),
which adopts the session API from temporalio/api#885, regenerate the Python
protos, refresh the bridge lockfile, and import Core's release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from 59f8a8f to 6e88cb5 Compare October 28, 2026 21:08
THardy98 added a commit to temporalio/sdk-python that referenced this pull request Oct 28, 2026
Pin Core to the session stack (temporalio/sdk-rust#1687 at 6e88cb53),
which adopts the session API from temporalio/api#885, regenerate the Python
protos, refresh the bridge lockfile, and import Core's release notes.
Import temporalio/api sticky-activity-session-options at 6811161a3c59c7773ac236dbf9adf9eb359f9288 as an exact subtree snapshot. Register session messages and keep scheduling and poll session options absent until feature plumbing is implemented.

git-subtree-dir: crates/protos/protos/api_upstream
git-subtree-split: 6811161a3c59c7773ac236dbf9adf9eb359f9288
Replace crates/protos/protos/api_upstream with an exact snapshot of
temporalio/api sticky-activity-session-options at
d183f54c642fe320218bc3bf8592b2533540f050, which merges the revised
session API shape (temporalio/api#893) and current upstream main.
- Activity session placement uses the WorkflowSession variant; options
  with no placement keep normal task-queue routing instead of failing.
- Session workers send WorkerSessionOptions on sticky polls, advertising
  that they can serve sessions.
Session workflows should only run, including replay, on workers that serve
sessions; replaying elsewhere silently drops the activity affinity the
workflow expects. Validate workflow-session activities during replay too, and
keep the replay worker's session options instead of clearing them, so a
replay worker without session options fails the workflow task.
@THardy98
THardy98 force-pushed the dev/sticky-activities-v2 branch from 6e88cb5 to e3b2642 Compare October 29, 2026 18:02

This branch has not been deployed

No deployments
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