Skip to content

Standalone Activities start delay#455

Open
GregoryTravis wants to merge 79 commits into
mainfrom
gmt/saa-start-delay
Open

Standalone Activities start delay#455
GregoryTravis wants to merge 79 commits into
mainfrom
gmt/saa-start-delay

Conversation

@GregoryTravis

@GregoryTravis GregoryTravis commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add start_delay: option to Client#start_activity / #execute_activity for Standalone Activities.

Mirrors the existing Client#start_workflow(start_delay:) semantics on the activity side. When set, the server creates the activity immediately (visible in describe/list responses with status RUNNING, run state SCHEDULED) but defers dispatch to a worker until the delay elapses. Marked experimental per existing project convention.

Spec

Public API surface

client.start_activity(
  MyActivity, ...,
  id: 'act-1', task_queue: 'tq', start_to_close_timeout: 60,
  start_delay: 30.0   # ← new; seconds, nullable, non-negative
)
  • Added start_delay: kwarg (default nil) to Temporalio::Client#start_activity and #execute_activity.
  • Added start_delay field to Client::Interceptor::StartActivityInput so interceptors can observe / modify it.
  • Client-side validation: raises ArgumentError, 'start_delay must be non-negative' for negative values (matches dotnet's ArgumentException). nil / 0 are accepted as "no delay."
  • Wired onto StartActivityExecutionRequest.start_delay (proto field 22, already present in generated bindings — no proto regeneration needed).

Behavior covered by tests

# Test Verifies
1 test_start_activity_rejects_negative_start_delay ArgumentError raised pre-RPC for negative values (mirrors dotnet's NegativeStartDelay_Throws)
2 test_start_activity_with_start_delay_dispatches_after_delay last_started_time - schedule_time >= delay - 500ms
3 test_start_activity_with_zero_start_delay_dispatches_immediately start_delay: 0 behaves like no delay
4 test_start_activity_with_nil_start_delay_dispatches_immediately start_delay: nil behaves like no delay
5 test_cancel_during_start_delay_transitions_to_canceled_immediately Server cancels the activity within the delay window without waiting for dispatch
6 test_terminate_during_start_delay_transitions_to_terminated_immediately Same for terminate
7 test_start_delay_extends_schedule_to_start_timeout ScheduleToStart timeout window begins after the delay (activity with schedule_to_start_timeout: 0.5s and start_delay: 1.0s dispatches successfully)
8 test_start_delay_extends_schedule_to_close_timeout ScheduleToClose timeout window begins after the delay (same shape)

Test environment

test/test.rb:

  • Bumped dev_server_download_version from v1.7.0 to v1.7.1-standalone-nexus-operations to include SAA supprt.
  • Added --dynamic-config-value activity.startDelayEnabled=true to the dev-server args.

…ds, and new nullability for old fields, and a factory for creating the standalone version.

Enums for activity id reuse and conflict policies.
SAA-specific errors.
…e polling.

Add test_async_completion_heartbeat_and_fail_standalone in addition to previous heartbeat test.
Don’t use queue mechanism for gathering id info when it can be gotten directly.
Consistency of parameter names and ordering.
Add static_details.
Use constant for “activity:” prefix.
GregoryTravis and others added 27 commits June 1, 2026 15:27
Co-authored-by: Maciej Dudkowski <maciej.dudkowski@temporal.io>
Co-authored-by: Maciej Dudkowski <maciej.dudkowski@temporal.io>
Co-authored-by: Maciej Dudkowski <maciej.dudkowski@temporal.io>
@GregoryTravis GregoryTravis requested a review from a team as a code owner June 8, 2026 19:46
@GregoryTravis GregoryTravis changed the title Gmt/saa start delay Standalone Activities start delay Jun 8, 2026
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