Skip to content

Add experimental activity sessions and worker session options - #1979

Draft
THardy98 wants to merge 2 commits into
mainfrom
dev/sticky-activities
Draft

THardy98 wants to merge 2 commits into
mainfrom
dev/sticky-activities

Conversation

@THardy98

@THardy98 THardy98 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add experimental workflow-session activities and worker session configuration, pinned to Core 0de941f3 (temporalio/sdk-rust#1687, stacked on #1691 and extraction #1686).

  • Activities opt in with workflow.ActivitySessionOptions.workflow_session(); omitted options retain ordinary routing. The factory returns an immutable variant rather than exposing an empty/false options state.
  • worker.WorkerSessionOptions() enables sticky activity polling. Optional worker.SingleSessionOptions(stable_identity=...) selects lifetime dedication to a stable destination; the Python API and bridge reflect the session proto model.
  • Session workers currently require fixed-size activity slots: at least two for paired polling, or one for sticky-only single-session polling. Ordinary resource-tuned workers are unchanged.
  • Update the Core pin, generated bindings, lockfile, and imported Core release notes.

Focused tests

  • Four serverless command cases: ordinary routing, workflow-session routing, and an interceptor adding/removing membership. No matrix over activity caller forms, queue choices, or eager settings.
  • One factory-construction check.
  • Two slot-supplier validation tests and one nested-options native bridge smoke test in the existing test_worker.py. The standalone affinity-forwarding test file is removed.
  • Two opt-in real-server tests use new_worker, the default sandboxed runner, and real worker identities. They cover queued activity/retry colocation, ordinary routing to a separate queue, workflow resumption, persisted membership, offline replay, and backlog draining under activity-capacity pressure.

Server integration scope

Target temporalio/temporal#12630 with system.enableStickyActivityExecution enabled for the test namespace. See tests/worker/STICKY_ACTIVITY_INTEGRATION.md for the command and limitations.

These integration tests disable eager execution and do not configure single-session isolation: the current server PR rejects that policy. They establish observed colocation, not direct observation of every physical queue delivery. Worker-loss recovery, relocation, timeout fallback, lifetime isolation, and AgentCore/WCI lifecycle remain outside this validation.

Validation

  • poe lint: passed, including all three type checkers.
  • Focused activity, worker-session, existing ordinary resource-tuner, and visitor checks against the standard ephemeral server: 20 passed, 2 custom-server tests skipped.
  • Both real-server tests passed against the custom server before this test-only reduction. The latest rerun was blocked by the local server reporting SQL logic error: no such table: namespaces; the existing ordinary resource-tuner control also timed out against that server. No server data/configuration was changed to work around it.
  • git diff --check: passed.
  • The native bridge was previously rebuilt and linted for this Core pin; this follow-up changes tests only. The full Python test suite has not been run locally.

Open in Delta

@THardy98
THardy98 force-pushed the dev/sticky-activities branch 2 times, most recently from 34e6bb6 to 919da29 Compare October 21, 2026 12:01
@THardy98
THardy98 force-pushed the dev/sticky-activities branch from 919da29 to 3f4b21b Compare October 21, 2026 14:02
@THardy98 THardy98 changed the title Expose experimental activity sessions and worker affinity Add experimental activity sessions and worker session options Oct 21, 2026
@THardy98
THardy98 force-pushed the dev/sticky-activities branch 3 times, most recently from 8f28f3b to 07fd242 Compare October 21, 2026 23: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