Skip to content

fix: apply DAPR_API_TIMEOUT_SECONDS to workflow gRPC connections#954

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

fix: apply DAPR_API_TIMEOUT_SECONDS to workflow gRPC connections#954
famarting wants to merge 7 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
Contributor

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.16%. Comparing base (bffb749) to head (0c677b6).
⚠️ Report is 93 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.16% +2.52%  ========================================== Files 84 104 +20 Lines 4473 7417 +2944 ========================================== + Hits 3875 6613 +2738  - Misses 598 804 +206 

☔ 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!!

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.

I see your changes update only the aio client. Can you pls update the one here too python-sdk/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py and also pls add tests to make the build happy for code cov 🙏

@famarting
Copy link
Contributor Author

I see your changes update only the aio client. Can you pls update the one here too python-sdk/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py and also pls add tests to make the build happy for code cov 🙏

@sicoyle I'm confused, the file ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py is already updated in this PR, what other changes are you referring to?

@sicoyle
Copy link
Contributor

sicoyle commented Mar 18, 2026

@sicoyle I'm confused, the file ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py is already updated in this PR, what other changes are you referring to?

@famarting I only know bc I have missed the other client myself in past PRs hehe.

Your PR file changes are for ext/dapr-ext-workflow/dapr/ext/workflow/aio/dapr_workflow_client.py note the AIO in the path. The client file at python-sdk/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py also needs updating pls.

Context: There are two separate clients one that is synchronous and uses client.TaskHubGrpcClient from durabletask. The other is async and uses aioclient.AsyncTaskHubGrpcClient from durabletask.aio. Can you update the other client pls :)

@famarting
Copy link
Contributor Author

@sicoyle I'm confused, the file ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py is already updated in this PR, what other changes are you referring to?

@famarting I only know bc I have missed the other client myself in past PRs hehe.

Your PR file changes are for ext/dapr-ext-workflow/dapr/ext/workflow/aio/dapr_workflow_client.py note the AIO in the path. The client file at python-sdk/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py also needs updating pls.

Context: There are two separate clients one that is synchronous and uses client.TaskHubGrpcClient from durabletask. The other is async and uses aioclient.AsyncTaskHubGrpcClient from durabletask.aio. Can you update the other client pls :)

this PR is already updating client.TaskHubGrpcClient and aioclient.AsyncTaskHubGrpcClient from the aio and non aio dapr_workflow_client.py , am I missing something else?

Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants