Skip to content

Add workflow-affine activity polling without isolation controls - #1691

Draft
THardy98 wants to merge 9 commits into
mainfrom
review/sticky-activity-polling
Draft

THardy98 wants to merge 9 commits into
mainfrom
review/sticky-activity-polling

Conversation

@THardy98

@THardy98 THardy98 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

  • Session workers (session_worker_options) also poll their sticky queue for activities, sharing slots, rate limiting, and poll admission with normal activity polling.
  • ScheduleActivity carries ActivitySessionOptions; workflow_session routes the activity to the workflow's sticky queue. Unset keeps normal routing.
  • Core validates session activities: the worker must have session options and the activity must use the workflow's task queue. Violations fail the workflow task, including during replay; replay workers keep their session options.
  • Activity sources drain correctly on shutdown.

Why?

Activity affinity for the Sessions API (temporalio/api#885): activities run on the worker running their workflow. Single-session workers and stable identities follow in #1687.

Checklist

  1. Closes: N/A (API: WorkerSessionOptions + ActivitySessionOptions -- Defining Sessions api#885, server: Add gated routing foundation for workflow-session activities temporal#12630)
  2. How was this tested: unit tests for session validation (including replay), shared poller capacity, and replay with and without session options; existing suite.
  3. Any docs updates needed? Not yet (experimental).

@THardy98
THardy98 force-pushed the review/sticky-activity-polling branch 3 times, most recently from 2981b56 to c6cab4e Compare October 22, 2026 02:44
@THardy98
THardy98 added this pull request to stack #1719 October 28, 2026 15:38
@THardy98
THardy98 force-pushed the review/sticky-activity-polling branch from bcab485 to 1ca71cc Compare October 28, 2026 15:47
@THardy98
THardy98 force-pushed the review/sticky-activity-polling branch from a029473 to ee5cf20 Compare October 28, 2026 21:08
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 review/sticky-activity-polling branch from ee5cf20 to 01c4fb2 Compare October 29, 2026 18:02
Base automatically changed from refactor/shared-sticky-poll-admission to main November 2, 2026 17:41

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