Skip to content

Populate timer origin field#976

Merged
acroca merged 14 commits intodapr:mainfrom
acroca:timers-origin
Apr 16, 2026
Merged

Populate timer origin field#976
acroca merged 14 commits intodapr:mainfrom
acroca:timers-origin

Conversation

@acroca
Copy link
Copy Markdown
Member

@acroca acroca commented Apr 10, 2026

  • Rebuilt latest protos
  • Populate the new origin field in timers.
  • Introduce automatic timer for wait_for_external_event to create a timer associated with such event. Other SDKs follow this same approach.

Signed-off-by: Albert Callarisa <albert@diagrid.io>
@acroca acroca requested review from a team as code owners April 10, 2026 13:13
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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 updates the durable workflow SDK to populate the newly added protobuf origin oneof on timer actions/events, and extends wait_for_external_event to support optional timeouts by internally scheduling a timer (or a far-future timer when no timeout is provided), aligning behavior with other SDKs.

Changes:

  • Add a timeout parameter to wait_for_external_event across the public context APIs and implement it via a composite task that races the external event against a timer.
  • Populate timer origin metadata for user timers (create_timer), external-event wait timers, and retry delay timers (activity + child workflow).
  • Rebuild protobuf Python outputs/stubs and add/adjust unit tests for the new timer-origin behavior.

Reviewed changes

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

Show a summary per file
File Description
ext/dapr-ext-workflow/tests/durabletask/test_orchestration_executor.py Updates existing external-event tests for the new “auto timer” behavior and adds new assertions/tests around timer origin fields.
ext/dapr-ext-workflow/dapr/ext/workflow/workflow_context.py Extends the public workflow context interface to support wait_for_external_event(..., timeout=...).
ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py Threads the new timeout keyword through the public wrapper context to the underlying durable task context.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py Sets timer origins for create-timer and retry timers, and implements external-event timeout/far-future timer scheduling.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py Adds ExternalEventWithTimeoutTask composite task and updates the orchestration context contract for the new timeout parameter.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Extends timer action helper to populate the correct origin oneof field.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/orchestrator_actions_pb2.pyi Regenerated protobuf typing stubs for new timer origin fields.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/orchestrator_actions_pb2.py Regenerated protobuf runtime code for new timer origin fields.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/history_events_pb2.pyi Regenerated protobuf typing stubs for new timer origin fields on history events.
ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/history_events_pb2.py Regenerated protobuf runtime code for new timer origin fields on history events.

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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py
Comment thread ext/dapr-ext-workflow/tests/durabletask/test_orchestration_executor.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py Outdated
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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

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


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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py
acroca added 2 commits April 13, 2026 17:10
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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

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


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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/workflow_context.py
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py Outdated
acroca added 2 commits April 13, 2026 17:19
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 88.20423% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.06%. Comparing base (bffb749) to head (bd9297a).
⚠️ Report is 103 commits behind head on main.

Files with missing lines Patch % Lines
...rkflow/_durabletask/internal/history_events_pb2.py 3.70% 26 Missing ⚠️
...w/tests/durabletask/test_orchestration_executor.py 94.35% 22 Missing ⚠️
.../_durabletask/internal/orchestrator_actions_pb2.py 8.33% 11 Missing ⚠️
...xt-workflow/dapr/ext/workflow/_durabletask/task.py 85.29% 5 Missing ⚠️
...w/dapr/ext/workflow/_durabletask/internal/timer.py 97.67% 1 Missing ⚠️
...-workflow/dapr/ext/workflow/_durabletask/worker.py 98.27% 1 Missing ⚠️
...orkflow/dapr/ext/workflow/dapr_workflow_context.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #976      +/-   ##
==========================================
- Coverage   86.63%   81.06%   -5.58%     
==========================================
  Files          84      137      +53     
  Lines        4473    13184    +8711     
==========================================
+ Hits         3875    10687    +6812     
- Misses        598     2497    +1899     

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

Copy link
Copy Markdown
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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py Outdated
acroca added 2 commits April 13, 2026 17:33
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


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

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/worker.py Outdated
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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.

nice job 👏 👏 👏 🙌 few comments so far and I've reviewed mostttt files

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/internal/helpers.py Outdated
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py
Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py Outdated
if self.is_complete:
return
if completed_task is self._event_task:
if completed_task.is_failed:
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 is missing a few other terminal states i believe in the if conditional check

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

on_child_completed is only called after a child completes, so it's guaranteed to be in one of two states

Comment thread ext/dapr-ext-workflow/dapr/ext/workflow/_durabletask/task.py Outdated
acroca added 3 commits April 15, 2026 15:27
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
Copy link
Copy Markdown
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.

LGTM - thank you 👏

@acroca acroca added this pull request to the merge queue Apr 16, 2026
Merged via the queue into dapr:main with commit 8d35b5f Apr 16, 2026
14 of 15 checks passed
@acroca acroca deleted the timers-origin branch April 16, 2026 06:00
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.

3 participants