Skip to content

Add TimerOptions to Workflow.sleep and timed Workflow.await - #3109

Open
sangkyoonnam wants to merge 2 commits into
temporalio:mainfrom
sangkyoonnam:feat/timer-summary-sleep-await
Open

sangkyoonnam wants to merge 2 commits into
temporalio:mainfrom
sangkyoonnam:feat/timer-summary-sleep-await

Conversation

@sangkyoonnam

Copy link
Copy Markdown
Contributor

What was changed

Workflow.sleep(Duration, TimerOptions) and Workflow.await(Duration, TimerOptions, Supplier) pass the options to the timer they create, so the timer can carry a summary the way newTimer(Duration, TimerOptions) already does. WorkflowOutboundCallsInterceptor gets matching sleep and await methods, with forwarding in its Base and TracingWorkerInterceptor and unsupported-operation stubs in TestActivityEnvironmentInternal, following #2218. The existing overloads still go through the existing interceptor methods, so an interceptor that overrides only those keeps seeing every call it saw before.

Why?

#3108. Python and Go already accept a summary here, and temporalio/features#669 tracks it across SDKs.

Breaking changes: interceptors that implement WorkflowOutboundCallsInterceptor directly, instead of extending the Base, need the two new methods. The interface is @Experimental, and #2218 did the same for newTimer.

Server PR: none needed.

Checklist

  1. Closes Allow a timer summary on Workflow.sleep and Workflow.await with timeout #3108

  2. How was this tested:
    TimerMetadataTest checks the TimerStarted summary for a sleep, an await that times out, and an await whose condition is satisfied. The live await tests take the CANCEL_AWAIT_TIMER_ON_CONDITION branch, so SyncWorkflowContextTest forces the branch without that flag through a mocked replay context. Each of these fails when its branch drops the options.

A replay of awaitTimerConditionOldBehavior.json, recorded without a summary, passes with a workflow that now sets one; replay matches timer commands by type and ID, not metadata, so this needs no SDK flag. :temporal-sdk:test, :temporal-testing:test, and :temporal-opentracing:test pass locally on JDK 21.

  1. Any docs updates needed?
    Javadoc and CHANGELOG are updated. No other docs.

@sangkyoonnam
sangkyoonnam requested a review from a team as a code owner October 1, 2026 15:21

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.

Allow a timer summary on Workflow.sleep and Workflow.await with timeout

1 participant