Repository navigation
Add orchestration restart options and source instance metadata - #833
Varshitha Bachu (bachuv) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new RestartAsync overload makes previously valid default-literal calls fail to compile, while property unpacking can also lose backend-supplied lineage for date-like source IDs.
2 open issues
What changed in this PR
This PR adds caller-selected restart IDs and optional version overrides to the Durable Task SDK, plus immediate source-instance metadata for cloned orchestrations.
Changes:
- Add restart options and gRPC handling, including validation and returned-ID checks.
- Expose
SourceInstanceIdand forward request properties through the standalone worker. - Add focused tests and document usage, backend requirements, and protobuf provenance.
| File | Description |
|---|---|
test/Worker/Grpc.Tests/GrpcOrchestrationRunnerTests.cs |
Test lineage during execution and replay. |
test/Worker/Grpc.Tests/GrpcDurableTaskWorkerTests.cs |
Test standalone worker lineage forwarding. |
test/Worker/Core.Tests/Shims/TaskOrchestrationContextWrapperTests.cs |
Test property-backed source metadata. |
test/Client/Grpc.Tests/GrpcDurableTaskClientRestartTests.cs |
Cover restart options, validation, compatibility, and errors. |
src/Worker/Grpc/GrpcDurableTaskWorker.Processor.cs |
Forward request properties into orchestration contexts. |
src/Grpc/versions.txt |
Record provenance of the imported protobuf patch. |
src/Grpc/orchestrator_service.proto |
Add optional target-ID and version fields. |
src/Client/Grpc/GrpcDurableTaskClient.cs |
Implement explicit restart options and shared error handling. |
src/Client/Core/RestartOrchestrationOptions.cs |
Define target-ID and version options. |
src/Client/Core/DurableTaskClient.cs |
Add the virtual restart-options overload. |
src/Abstractions/TaskOrchestrationContext.cs |
Expose immediate source-instance metadata. |
README.md |
Document cloning usage and compatibility limitations. |
Review effort: Balanced
There was a problem hiding this comment.
The SDK-side approach largely accomplishes the stated goal for a supporting backend, and I don't see a material new performance regression. The property-conversion comparison was an isolated microbenchmark with the default null logger factory, not an end-to-end throughput benchmark. Backend support remains a deployment prerequisite, as documented.
Requesting changes for the two existing inline findings, both independently reproduced: restart overload source compatibility and opaque source-ID preservation.
The unrelated, pre-existing logging improvement request is now a non-blocking file-level comment.
There was a problem hiding this comment.
🟡 Changes recommended
The PR description advertises an unimplemented restart API and outdated compatibility behavior, so callers following it would encounter compilation errors and misleading older-server guidance.
1 open issue
2 resolved since last review
Review effort: Balanced



Summary
What changed?
RestartAsync(string instanceId, string newInstanceId, string? version, CancellationToken cancellation)with four required arguments. The existingbooloverload remains unchanged, including calls usingdefault.CloneInstanceRPC for explicit target IDs and version overrides. The existingRestartInstanceRequestis unchanged.version: nulluses the backend's restart default;version: ""explicitly selects an unversioned orchestration.TaskOrchestrationContext.SourceInstanceIdin both worker paths, preserving IDs as opaque strings, includingdt:anddto:prefixes.Why is this change needed?
Issues / work items
Project checklist
release_notes.mdCloneInstance.AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
844a78e.dotnet test .\test\Client\Grpc.Tests\Client.Grpc.Tests.csproj --no-restore --filter 'FullyQualifiedName~GrpcDurableTaskClientRestartTests|FullyQualifiedName~GrpcDurableTaskClientTests.ScheduleNewOrchestrationInstanceAsync' --verbosity quiet -clp:ErrorsOnly— Passed, 37 tests.dotnet test .\test\Worker\Grpc.Tests\Worker.Grpc.Tests.csproj --no-restore --filter 'FullyQualifiedName~GrpcOrchestrationRunnerTests|FullyQualifiedName~OnRunOrchestratorAsync_Properties_ExposeImmediateSource' --verbosity quiet -clp:ErrorsOnly— Passed, 27 tests.dotnet test .\test\Grpc.IntegrationTests\Grpc.IntegrationTests.csproj --no-restore --filter 'FullyQualifiedName~DurableTaskGrpcClientIntegrationTests.RestartAsync' --verbosity quiet -clp:ErrorsOnly— Passed, 4 tests.Manual validation (only if runtime/behavior changed)
Notes for reviewers
boolrestart overload and its RPC contract remain unchanged. The new context member is virtual rather than abstract; serializer defaults are unchanged.CloneInstance. Older servers returnUNIMPLEMENTED, surfaced asNotSupportedException, without performing a legacy restart. The client never falls back toRestartInstance.InvalidOperationException. The client cannot independently verify whether a supporting backend honored a version override.SourceInstanceIdidentifies the immediate source when source and target IDs differ. It is separate from parent metadata and is not inherited by sub-orchestrations; same-ID lineage is backend-specific.