Skip to content

fix: apply DAPR_API_TIMEOUT_SECONDS to workflow gRPC connections#954

Open
famarting wants to merge 4 commits intodapr:mainfrom
famarting:workflows-respect-timeouts
Open

fix: apply DAPR_API_TIMEOUT_SECONDS to workflow gRPC connections#954
famarting wants to merge 4 commits intodapr:mainfrom
famarting:workflows-respect-timeouts

Conversation

@famarting
Copy link
Contributor

Summary

  • Workflow gRPC connections (DaprWorkflowClient, async DaprWorkflowClient, WorkflowRuntime) were not respecting DAPR_API_TIMEOUT_SECONDS
  • Added DaprClientTimeoutInterceptor / DaprClientTimeoutInterceptorAsync to the durabletask client and worker gRPC channels
  • User-provided interceptors on WorkflowRuntime are preserved alongside the timeout interceptor

Test plan

  • All 54 existing workflow unit tests pass
  • Verify with DAPR_API_TIMEOUT_SECONDS set to a custom value that workflow gRPC calls respect it
  • Verify that explicit per-call timeouts (e.g. timeout_in_seconds on wait_for_workflow_completion) still take precedence

The workflow extension's gRPC connections (DaprWorkflowClient, async
DaprWorkflowClient, and WorkflowRuntime) were not respecting the
DAPR_API_TIMEOUT_SECONDS environment variable, unlike the core SDK's
DaprGrpcClient which applies it via a timeout interceptor.

Pass DaprClientTimeoutInterceptor (sync) and
DaprClientTimeoutInterceptorAsync (async) to the durabletask
TaskHubGrpcClient, AsyncTaskHubGrpcClient, and TaskHubGrpcWorker
so that workflow gRPC calls get the configured default timeout.

Signed-off-by: Fabian Martinez <fabian@diagrid.io>
Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
@famarting famarting requested review from a team as code owners March 12, 2026 18:40
Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures workflow-related gRPC connections (workflow client, async workflow client, and workflow runtime worker) respect the global DAPR_API_TIMEOUT_SECONDS default by adding the SDK’s timeout interceptor to the underlying durabletask gRPC channels.

Changes:

  • Add DaprClientTimeoutInterceptor to the durabletask worker channel in WorkflowRuntime, while preserving user-provided interceptors.
  • Add DaprClientTimeoutInterceptor to the sync DaprWorkflowClient durabletask channel.
  • Add DaprClientTimeoutInterceptorAsync to the async DaprWorkflowClient durabletask channel.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py Prepends timeout interceptor and merges it with any user-provided interceptors for the worker channel.
ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py Adds timeout interceptor to the durabletask sync workflow client channel.
ext/dapr-ext-workflow/dapr/ext/workflow/aio/dapr_workflow_client.py Adds timeout interceptor to the durabletask async workflow client channel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 69 to 76
self.__obj = client.TaskHubGrpcClient(
host_address=uri.endpoint,
metadata=metadata,
secure_channel=uri.tls,
log_handler=options.log_handler,
log_formatter=options.log_formatter,
interceptors=[DaprClientTimeoutInterceptor()],
)
Comment on lines 66 to 73
self.__obj = aioclient.AsyncTaskHubGrpcClient(
host_address=uri.endpoint,
metadata=metadata,
secure_channel=uri.tls,
log_handler=options.log_handler,
log_formatter=options.log_formatter,
interceptors=[DaprClientTimeoutInterceptorAsync()],
)
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.08%. Comparing base (bffb749) to head (538cf3f).
⚠️ Report is 90 commits behind head on main.

Files with missing lines Patch % Lines
...ext-workflow/dapr/ext/workflow/workflow_runtime.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #954      +/-   ##
==========================================
+ Coverage   86.63%   89.08%   +2.45%     
==========================================
  Files          84      103      +19     
  Lines        4473     7347    +2874     
==========================================
+ Hits         3875     6545    +2670     
- Misses        598      802     +204     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
Copy link
Contributor

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

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

thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants