Repository navigation
Add eager start support for standalone activities - #12349
Open
wenlong-gu wants to merge 22 commits into
Open
wenlong-gu wants to merge 22 commits into
wenlong-gu wants to merge 22 commits into
Conversation
…-saa # Conflicts: # chasm/lib/activity/responses.go
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The eager response omits standard execution metadata, loses SDK metadata, and lacks the documented rollout metrics.
Review effort: Balanced
Findings: 4
Open (4)
What changed in this PR
Adds eager delivery of the first standalone Activity task, bypassing initial Matching dispatch while preserving persisted state and timeout protection.
Changes:
- Adds namespace-gated eager-start handling and task construction.
- Extends state-machine, parity, and functional coverage.
- Documents lifecycle, safety, and performance behavior.
| File | Description |
|---|---|
tests/activity_workflow_driver.go |
Adds eager workflow Activity driver. |
tests/activity_standalone_test.go |
Tests eager response deduplication. |
tests/activity_standalone_driver.go |
Supports eager standalone tasks. |
tests/activity_parity_test.go |
Adds eager retry parity coverage. |
tests/activity_driver.go |
Models eagerly started attempts. |
docs/architecture/saa-eager-start-plan.md |
Documents design and validation. |
chasm/lib/activity/statemachine.go |
Adds atomic eager-start transition. |
chasm/lib/activity/statemachine_test.go |
Tests eager transition tasks. |
chasm/lib/activity/responses.go |
Builds eager worker responses and tokens. |
chasm/lib/activity/model/vocabulary.go |
Adds eager model configuration. |
chasm/lib/activity/model/model.go |
Models initially started state. |
chasm/lib/activity/model/model_test.go |
Tests eager model behavior. |
chasm/lib/activity/handler.go |
Creates and returns eager tasks. |
chasm/lib/activity/frontend.go |
Applies eligibility fallback. |
chasm/lib/activity/frontend_test.go |
Tests fallback conditions. |
chasm/lib/activity/config.go |
Adds namespace eager-start configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fretz12
reviewed
Oct 5, 2026
fretz12
reviewed
Oct 6, 2026
Contributor
|
can you make the PR desc follow the standard template? And personally I'd prefer to just keep it concise and to the point rather than too much AI noise |
wenlong-gu
added a commit
to temporalio/api
that referenced
this pull request
Oct 8, 2026
## Task overview Part 1 of 3 for ACT-1118, adding eager start for Standalone Activities (SAA). Today, an SAA start must create the activity, enqueue a dispatch task, send it through Matching, and wait for a worker poll. This adds queue latency even when the caller has a ready local worker. The complete solution lets an eligible `StartActivityExecution` request return the first Activity task directly in its response. The server persists the activity before returning that task and skips only the initial Matching dispatch. For safety, an eager task is returned only for a newly created execution. Same-request-ID retries and conflicts such as `USE_EXISTING` return the existing execution without re-delivering the task, because Activity code may have external side effects. ## Scope of this PR Adds the additive public API contract: - `StartActivityExecutionRequest.request_eager_execution` - `StartActivityExecutionResponse.eager_activity_task` There is no runtime server behavior in this PR. ## Related PRs - API-Go: temporalio/api-go#319 updates this proto submodule and regenerates the Go API types. - Temporal: temporalio/temporal#12349 implements request eligibility, the eager state transition, task construction, retry/conflict safety, and tests. ## Validation - API linter passes. ## Benchmark context This contract-only PR has no runtime behavior. The Temporal implementation was measured locally in an in-process server test cluster over 200 paired runs: | Path | p50 | p95 | p99 | |---|---:|---:|---:| | Normal SAA | 2.372 ms | 58.654 ms | 88.855 ms | | Eager SAA | 1.588 ms | 5.028 ms | 7.362 ms | The measurement covers server-side task delivery only; it excludes SDK worker scheduling, user Activity execution, network latency, and production load.
temporal-cicd Bot
pushed a commit
to temporalio/api-go
that referenced
this pull request
Oct 8, 2026
## Task overview Part 1 of 3 for ACT-1118, adding eager start for Standalone Activities (SAA). Today, an SAA start must create the activity, enqueue a dispatch task, send it through Matching, and wait for a worker poll. This adds queue latency even when the caller has a ready local worker. The complete solution lets an eligible `StartActivityExecution` request return the first Activity task directly in its response. The server persists the activity before returning that task and skips only the initial Matching dispatch. For safety, an eager task is returned only for a newly created execution. Same-request-ID retries and conflicts such as `USE_EXISTING` return the existing execution without re-delivering the task, because Activity code may have external side effects. ## Scope of this PR Adds the additive public API contract: - `StartActivityExecutionRequest.request_eager_execution` - `StartActivityExecutionResponse.eager_activity_task` There is no runtime server behavior in this PR. ## Related PRs - API-Go: #319 updates this proto submodule and regenerates the Go API types. - Temporal: temporalio/temporal#12349 implements request eligibility, the eager state transition, task construction, retry/conflict safety, and tests. ## Validation - API linter passes. ## Benchmark context This contract-only PR has no runtime behavior. The Temporal implementation was measured locally in an in-process server test cluster over 200 paired runs: | Path | p50 | p95 | p99 | |---|---:|---:|---:| | Normal SAA | 2.372 ms | 58.654 ms | 88.855 ms | | Eager SAA | 1.588 ms | 5.028 ms | 7.362 ms | The measurement covers server-side task delivery only; it excludes SDK worker scheduling, user Activity execution, network latency, and production load.
# Conflicts: # go.mod # go.sum # tests/mixedbrain/go.mod # tests/mixedbrain/go.sum
wenlong-gu
force-pushed
the
codex/saa-eager-start-saa
branch
from
October 9, 2026 00:43
63cae51 to
e75545e
Compare
fretz12
reviewed
Oct 12, 2026
VegetarianOrc
pushed a commit
to temporalio/api
that referenced
this pull request
Oct 12, 2026
## Task overview Part 1 of 3 for ACT-1118, adding eager start for Standalone Activities (SAA). Today, an SAA start must create the activity, enqueue a dispatch task, send it through Matching, and wait for a worker poll. This adds queue latency even when the caller has a ready local worker. The complete solution lets an eligible `StartActivityExecution` request return the first Activity task directly in its response. The server persists the activity before returning that task and skips only the initial Matching dispatch. For safety, an eager task is returned only for a newly created execution. Same-request-ID retries and conflicts such as `USE_EXISTING` return the existing execution without re-delivering the task, because Activity code may have external side effects. ## Scope of this PR Adds the additive public API contract: - `StartActivityExecutionRequest.request_eager_execution` - `StartActivityExecutionResponse.eager_activity_task` There is no runtime server behavior in this PR. ## Related PRs - API-Go: temporalio/api-go#319 updates this proto submodule and regenerates the Go API types. - Temporal: temporalio/temporal#12349 implements request eligibility, the eager state transition, task construction, retry/conflict safety, and tests. ## Validation - API linter passes. ## Benchmark context This contract-only PR has no runtime behavior. The Temporal implementation was measured locally in an in-process server test cluster over 200 paired runs: | Path | p50 | p95 | p99 | |---|---:|---:|---:| | Normal SAA | 2.372 ms | 58.654 ms | 88.855 ms | | Eager SAA | 1.588 ms | 5.028 ms | 7.362 ms | The measurement covers server-side task delivery only; it excludes SDK worker scheduling, user Activity execution, network latency, and production load.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed?
This PR adds eager start support for Standalone Activities (SAA). When an eligible client requests eager start, the server can return the first Activity task directly in the
StartActivityExecutionresponse, avoiding the initial task-queue dispatch round trip.The PR falls back to normal Matching dispatch when eager delivery is not admitted.
Why?
The eager start feature has been implemented for WFA, so this change is to mirror that flow to save latency.
How did you test it?
Local benchmark
Measured 200 paired runs using an in-process Temporal server test cluster:
This is approximately 33% lower p50 and 91–92% lower p95/p99 latency in the
local environment. It measures server-side task delivery only; it excludes SDK
worker scheduling, Activity business-code execution, network latency, and
production load.