Skip to content

Add ContinueAsNewOptions with NewVersion support#682

Open
YunchuWang wants to merge 5 commits intomainfrom
wangbill/continue-as-new-version
Open

Add ContinueAsNewOptions with NewVersion support#682
YunchuWang wants to merge 5 commits intomainfrom
wangbill/continue-as-new-version

Conversation

@YunchuWang
Copy link
Member

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: ContinueAsNewOptions class

  • Added ContinueAsNewOptions with a NewVersion property that allows callers to specify the version the next generation of the orchestration should run as.

Updated: TaskOrchestrationContext

  • Added a new virtual overload: ContinueAsNew(ContinueAsNewOptions, object?, bool) that accepts the options class.
  • Default implementation delegates to the existing abstract ContinueAsNew(object?, bool) method, preserving backward compatibility.

Updated: TaskOrchestrationContextWrapper

  • Overrides the new method to call the DurableTask.Core two-parameter ContinueAsNew(string newVersion, object newInput) when NewVersion is specified.
  • This completes the SDK abstraction gap \u2014 the proto, gRPC sidecar, Core dispatcher, and DTS backend already supported newVersion; only the SDK layer was missing.

Tests

  • 3 unit tests in TaskOrchestrationContextWrapperTests: verify version propagation, null-version fallback, and preserveUnprocessedEvents passthrough.
  • 1 integration test (ContinueAsNewWithNewVersion): end-to-end validation that an orchestrator can migrate from no version to v2 and read back ctx.Version correctly.

Motivation

See #672 \u2014 users need to evolve orchestration logic over time. The underlying infrastructure (proto field CompleteOrchestrationAction.newVersion, Core dispatcher, gRPC sidecar, DTS) all already support version changes on ContinueAsNew, but the portable SDK abstraction layer (TaskOrchestrationContext) had no way to pass a new version through.

Copilot AI review requested due to automatic review settings March 21, 2026 07:09
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 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 ContinueAsNewOptions with a NewVersion property in the public abstractions layer.
  • Adds a new TaskOrchestrationContext.ContinueAsNew(ContinueAsNewOptions, object?, bool) overload and wires it through TaskOrchestrationContextWrapper to DurableTask.Core’s versioned ContinueAsNew.
  • 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.

@YunchuWang YunchuWang force-pushed the wangbill/continue-as-new-version branch from 9256bad to 32efcc8 Compare March 21, 2026 07:14
Copilot AI review requested due to automatic review settings March 21, 2026 07:24
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

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

Copilot AI review requested due to automatic review settings March 21, 2026 16:29
@YunchuWang YunchuWang force-pushed the wangbill/continue-as-new-version branch from 4708a53 to c344e34 Compare March 21, 2026 16:29
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

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 21, 2026 16:56
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

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

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.

Add newVersion support to TaskOrchestrationContext.ContinueAsNew

2 participants