Skip to content

Add standalone activity start delay support - #691

Merged
eamsden merged 2 commits into
mainfrom
ea/saa-delay
May 18, 2026
Merged

eamsden merged 2 commits into
mainfrom
ea/saa-delay

Conversation

@eamsden

@eamsden eamsden commented May 14, 2026

Copy link
Copy Markdown
Contributor

Expose StartDelay on StartActivityOptions, validate that it is non-negative, and pass it through to StartActivityExecutionRequest.

Add integration coverage for delayed standalone activity dispatch and document the new option.

What was changed

Added StartActivityOptions.StartDelay for standalone activities.

The client now validates that StartDelay is non-negative and maps it to StartActivityExecutionRequest.StartDelay when starting a standalone activity. The README standalone activity section now mentions the new option.

Added tests covering client-side rejection of negative start delays and an integration test that verifies a delayed standalone activity starts after the configured delay.

Why?

Standalone activities support delayed first dispatch at the service API level, but the .NET client was not exposing or wiring that field. This gives users a typed way to delay the first activity task without affecting retries.

Checklist

  1. Closes N/A

  2. How was this tested:
    dotnet format --verify-no-changes

dotnet build -p:RestoreLockedMode=true

dotnet test tests/Temporalio.Tests/Temporalio.Tests.csproj --no-restore --filter FullyQualifiedName~Temporalio.Tests.Client.TemporalClientActivityTests.StartActivityAsync_NegativeStartDelay_Throws

dotnet test tests/Temporalio.Tests/Temporalio.Tests.csproj --no-restore --filter FullyQualifiedName~Temporalio.Tests.Client.TemporalClientActivityTests.StartActivityAsync_StartDelay_WaitsProperly

  1. Any docs updates needed?
    README updated for standalone activity StartDelay. No docs.temporal.io update included.

@eamsden
eamsden requested a review from a team as a code owner May 14, 2026 00:06

@maciejdudko maciejdudko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just needs a small change in test setup.

[Fact]
public async Task StartActivityAsync_StartDelay_WaitsProperly()
{
await using var env = await Temporalio.Testing.WorkflowEnvironment.StartLocalAsync(new()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, use the default test env and set the CLI version and dynamic config globally:

DownloadVersion = "v1.7.0",

Expose StartDelay on StartActivityOptions, validate that it is non-negative, and pass it through to StartActivityExecutionRequest.

Add integration coverage for delayed standalone activity dispatch and document the new option.
@eamsden
eamsden force-pushed the ea/saa-delay branch 2 times, most recently from 3d04723 to 968f055 Compare May 18, 2026 17:01
Comment thread README.md Outdated
`Workflow.ExecuteActivityAsync`.
* `Id` and `TaskQueue` are required on `StartActivityOptions`. Either `ScheduleToCloseTimeout` or
`StartToCloseTimeout` must also be set.
* `StartDelay` can be set to delay dispatch of the first activity task.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is not meant to describe all available options, mentioning StartDelay isn't relevant here. Remove this.

Move the delayed standalone activity server version and dynamic config into the shared local test environment, then use the default client and worker helper in the start-delay test.
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.

2 participants