Uh oh!
There was an error while loading. Please reload this page.
Add ContinueAsNewOptions with NewVersion support - #682
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR adds an SDK-level mechanism to specify a target orchestration version when calling ContinueAsNew, enabling version migration for long-running (eternal) orchestrations while keeping existing ContinueAsNew(object?, bool) implementations working.
Changes:
- Introduces
ContinueAsNewOptionswith aNewVersionproperty in the public abstractions layer. - Adds a new
TaskOrchestrationContext.ContinueAsNew(ContinueAsNewOptions, object?, bool)overload and wires it throughTaskOrchestrationContextWrapperto DurableTask.Core’s versionedContinueAsNew. - Adds unit + integration tests validating version propagation and fallback behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Abstractions/ContinueAsNewOptions.cs | Adds a new options type carrying NewVersion. |
| src/Abstractions/TaskOrchestrationContext.cs | Adds a virtual ContinueAsNew overload that accepts ContinueAsNewOptions. |
| src/Worker/Core/Shims/TaskOrchestrationContextWrapper.cs | Implements the versioned continue-as-new behavior when NewVersion is provided. |
| test/Worker/Core.Tests/Shims/TaskOrchestrationContextWrapperTests.cs | Unit tests validating wrapper behavior with/without version. |
| test/Grpc.IntegrationTests/OrchestrationPatterns.cs | End-to-end integration test validating version migration via ContinueAsNew. |
| src/Abstractions/TaskOrchestrator.cs | Updates XML doc cref to reference the intended ContinueAsNew overload explicitly. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9256bad to
32efcc8CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
4708a53 to
c344e34CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
…ity with ContinueAsNew(null, false)
Uh oh!
There was an error while loading. Please reload this page.
Address review feedback from cgillum: fold newInput and preserveUnprocessedEvents into ContinueAsNewOptions so the new overload takes a single ContinueAsNewOptions parameter. - Add NewInput and PreserveUnprocessedEvents properties to ContinueAsNewOptions - Change ContinueAsNew(ContinueAsNewOptions?, object?, bool) to ContinueAsNew(ContinueAsNewOptions) - Update TaskOrchestrationContextWrapper to match - Update unit and integration tests
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ationContext Forward the new ContinueAsNew overload that accepts ContinueAsNewOptions (with NewVersion) to the inner context. Without this override, the base class default silently drops the options, preventing version migration via ContinueAsNew from working in Azure Functions isolated worker. Depends on: microsoft/durabletask-dotnet#682 (adds ContinueAsNewOptions) Requires bumping Microsoft.DurableTask.Worker.Grpc to the version that includes ContinueAsNewOptions.
Update Microsoft.DurableTask.Client.Grpc, Worker.Grpc, and Abstractions from 1.23.0 to 1.23.1 in Directory.Packages.props (CPM). Version 1.23.1 includes ContinueAsNewOptions from microsoft/durabletask-dotnet#682. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
This PR adds support for specifying a new orchestration version when calling
ContinueAsNew, enabling version migration scenarios for long-running orchestrations.Fixes#672
Changes
New:
ContinueAsNewOptionsclassContinueAsNewOptionswith aNewVersionproperty that allows callers to specify the version the next generation of the orchestration should run as.Updated:
TaskOrchestrationContextvirtualoverload:ContinueAsNew(ContinueAsNewOptions)that accepts the options class.abstract ContinueAsNew(object?, bool)method, preserving backward compatibility.Updated:
TaskOrchestrationContextWrapperContinueAsNew(string newVersion)whenNewVersionis specified.Tests
TaskOrchestrationContextWrapperTests: verify version propagation, null-version fallback, and preserveUnprocessedEvents passthrough.ContinueAsNewWithNewVersion): end-to-end validation that an orchestrator can migrate from no version tov2and read backctx.Versioncorrectly.E2E Testing Results
ContinueAsNewWithNewVersion(in-process)NewVersion='v2'and Core createsExecutionStartedEventwithversion=v2. Gen 2 rejected by extension's defaultversionMatchStrategy: CurrentOrOlder(see note below), so orchestration never completed E2E.Assert.Equal("v2", metadata.ReadOutputAs<string>())Downstream Changes Required
durabletask-dotnetContinueAsNewOptions+TaskOrchestrationContextWrapperoverrideazure-functions-durable-extensionFunctionsOrchestrationContextoverride to delegate new 3-paramContinueAsNewto inner contextAAPT-DTMBPartitionGrain.WorkItems.cs: useaction.CompleteOrchestration.NewVersioninExecutionStartedEvent+ integration testHistory
ContinueAsNew(string newVersion, object input)has existed in DurableTask.Core since Oct 2014 (initial commit by Affan Dar)CompleteOrchestrationAction.newVersion(proto field 4) has existed since Jan 2022 (initial protobuf commit by Chris Gillum)durabletask-dotnetwas the only layer that never exposednewVersion— until nowMotivation
See #672 — users need to evolve orchestration logic over time. The underlying infrastructure (proto field
CompleteOrchestrationAction.newVersion, Core dispatcher, gRPC sidecar) all already support version changes on ContinueAsNew, but the portable SDK abstraction layer (TaskOrchestrationContext) had no way to pass a new version through.