Add continue-as-new version support - #254
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: df26610a-beb4-44ea-a04a-6aedeb316d2a
There was a problem hiding this comment.
Pull request overview
This PR adds orchestration version migration support to the core durabletask SDK by extending OrchestrationContext.continue_as_new() to accept an optional new_version, then wiring that value through to the CompleteOrchestrationAction.newVersion protobuf field.
Changes:
- Added a
new_version: str | None = Nonekeyword argument toOrchestrationContext.continue_as_new(). - Persisted and serialized the supplied version into the complete-orchestration action sent to the backend.
- Expanded unit test coverage and documented the change in the root changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/durabletask/test_orchestration_executor.py | Adds parametrized test coverage for continued-as-new with and without new_version. |
| durabletask/worker.py | Tracks new_version during continue-as-new and forwards it into the completion action. |
| durabletask/task.py | Extends the public OrchestrationContext.continue_as_new() API and documents the new parameter. |
| durabletask/internal/helpers.py | Adds new_version support to the completion-action builder and maps it to newVersion. |
| CHANGELOG.md | Documents the new user-facing API capability under ## Unreleased. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| complete_action = get_and_validate_complete_orchestration_action_list(1, actions) | ||
| assert complete_action.orchestrationStatus == pb.ORCHESTRATION_STATUS_CONTINUED_AS_NEW | ||
| assert complete_action.result.value == json.dumps(2) | ||
| assert complete_action.HasField("newVersion") is (new_version is not None) |
There was a problem hiding this comment.
Updated to use equality comparison.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: df26610a-beb4-44ea-a04a-6aedeb316d2a
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Reviewed the complete diff and surrounding execution/versioning paths. The implementation correctly omits newVersion when unspecified (preserving the current version) and sets it only for the next continue-as-new generation; replay behavior and provider inheritance remain intact. No new abstract member is introduced. Targeted executor and Azure Functions compatibility tests, affected-file flake8, and strict Pyright on the changed source files passed. No actionable findings.
Summary
new_versionargument toOrchestrationContext.continue_as_new()CompleteOrchestrationAction.newVersionCloses #127
Testing
python -m pytest tests\durabletask\test_orchestration_executor.py -k continue_as_newpython -m flake8 durabletaskpython -m flake8 tests\durabletask