Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Implements orchestration ID reuse policy to control behavior when creating instances with duplicate IDs, matching durabletask-go and durabletask-java functionality.

Changes

Protobuf

  • Added CreateOrchestrationAction enum (ERROR, IGNORE, TERMINATE)
  • Updated OrchestrationIdReusePolicy to include action field and renamed replaceableStatus to operationStatus

Public API

  • CreateOrchestrationAction enum defining three collision behaviors
  • OrchestrationIdReusePolicy class with static factory methods for each action
  • WithIdReusePolicy() extension method on StartOrchestrationOptions
  • IdReusePolicy property on StartOrchestrationOptions

Implementation

  • GrpcDurableTaskClient handles new policy with fallback to legacy DedupeStatuses
  • ProtoUtils conversion methods between public and protobuf types

Usage

// Throw if running instance exists
var options = new StartOrchestrationOptions()
    .WithIdReusePolicy(OrchestrationIdReusePolicy.Error(
        OrchestrationRuntimeStatus.Running));

// Silently ignore if completed instance exists  
var options = new StartOrchestrationOptions()
    .WithIdReusePolicy(OrchestrationIdReusePolicy.Ignore(
        OrchestrationRuntimeStatus.Completed));

// Atomically terminate and replace running instance
var options = new StartOrchestrationOptions()
    .WithIdReusePolicy(OrchestrationIdReusePolicy.Terminate(
        OrchestrationRuntimeStatus.Running));

Existing DedupeStatuses API remains supported for backward compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>Support orchestration ID reuse policy</issue_title>
<issue_description>durabletask-go now support orchestration ID reuse policy, customer can reuse the orchestration ID with three different action ERROR, IGNORE, and TERMINATE with a target runtime status set.

ERROR- If there is an existing workflow then the scheduler throws an exception (this is the current behavior).
IGNORE- If there is an existing workflow already scheduled, then the scheduler does nothing.
TERMINATE- Terminates any existing workflows with the same instance ID and then schedules a new instance as one atomic action, similar to on-demand ContinueAsNew.

SDK needs to expose those options to customer orchestration ID reuse support.

Reference:

  1. Support reusing orchestration id durabletask-go#46
  2. Support orchestration id reuse policy durabletask-java#188</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

{
// Use the new explicit ID reuse policy
P.OrchestrationIdReusePolicy? policy = ProtoUtils.ConvertToProtoReusePolicy(idReusePolicy);
if (policy != null)
Copilot AI changed the title [WIP] Add support for orchestration ID reuse policy Add orchestration ID reuse policy with ERROR, IGNORE, and TERMINATE actions Jan 5, 2026
Copilot AI requested a review from YunchuWang January 5, 2026 22:26
@torosent
Copy link
Member

torosent commented Jan 6, 2026

@copilot This PR contains breaking changes in the proto files

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.

Support orchestration ID reuse policy

3 participants