Fix durabletask issues surfaced during Azure Functions investigation#174
Merged
andystaples merged 2 commits intoJul 14, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes several correctness issues in the core durabletask worker that were surfaced while investigating Azure Functions support, and adds a couple of small API/serialization improvements to improve interoperability with alternate JSON converters.
Changes:
- Fixed multiple replay/runtime edge cases in
durabletask/worker.py(timer timezone normalization, orchestration version presence check, ignoregenericEventduring replay, and avoid deserializing empty lock-grant results in the legacy entity protocol). - Added a
Task.resultread-only property as an alias forTask.get_result(). - Improved scheduled-entity JSON round-tripping under non-default converters (explicit hooks and converter-aware rebuild logic), and exported ambient history-export context helpers.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| durabletask/worker.py | Fixes replay/runtime bugs (timers, version presence, generic events, legacy entity lock results). |
| durabletask/task.py | Adds Task.result property aliasing get_result(). |
| durabletask/scheduled/orchestrator.py | Adds explicit to_json/from_json hooks for ScheduleOperationRequest to support converters that can’t serialize bare dataclasses. |
| durabletask/scheduled/models.py | Makes ScheduleState.from_json converter-aware and adds a helper to reliably rebuild nested ScheduleConfiguration. |
| durabletask/extensions/history_export/init.py | Re-exports bind_context / clear_context in the public module surface. |
| CHANGELOG.md | Documents user-facing additions and fixes under ## Unreleased. |
berndverst
previously approved these changes
Jul 14, 2026
berndverst
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While building out Azure Functions support, several pre-existing issues in the core
durabletaskSDK were surfaced. This PR splits those fixes out into a dedicated, self-contained change so they can be reviewed independently of the larger Functions work.Fixes (
durabletask/worker.py)fire_atwere compared against the orchestration's naive UTC clock, which could cause them to fire at the wrong time. Timezone-aware fire times are now normalized to naive UTC before scheduling.executionStarted.versionwithHasField("version"). A singular protobuf message field is always truthy, so the version was being set onOrchestrationContexteven when none was provided.genericEventhandling — Replaying agenericEventhistory event (for example, the marker the Durable Functions extension appends when rewinding an orchestration) raisedOrchestrationStateError. Such informational events are now ignored during replay, matching the .NET worker.resultand raised. Lock-granted events no longer attempt result deserialization.Additions
Task.result— New read-only property aliasingTask.get_result()(durabletask/task.py).bind_context/clear_context— Now exported fromdurabletask.extensions.history_exportfor managing the ambient history-export context.Serialization robustness (default wire format unchanged)
ScheduleState.from_jsongains an optionalconverterparameter plus a_rebuild_configurationhelper so the nestedScheduleConfigurationround-trips under alternate converters (durabletask/scheduled/models.py).ScheduleOperationRequestgains explicitto_json/from_jsonhooks, mirroring the plain dataclass field mapping so the wire format is unchanged for the default JSON converter while remaining serializable by converters that require an explicit hook (durabletask/scheduled/orchestrator.py).Validation
flake8clean on all changed files.CHANGELOG.mdupdated with ADDED / FIXED entries for the user-facing changes.