Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for specifying tags when calling suborchestrations with retry policies, resolving issue #559. The implementation ensures tags are properly propagated when retry policies are used.
Key changes:
- Updated
TaskOrchestrationContextWrapper.csto pass tags toCreateSubOrchestrationInstanceWithRetry - Added integration test
ScheduleSubOrchestrationWithTagsAndRetryPolicyto verify the new functionality
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Worker/Core/Shims/TaskOrchestrationContextWrapper.cs | Added options.Tags parameter to the CreateSubOrchestrationInstanceWithRetry call when a retry policy is specified |
| test/Grpc.IntegrationTests/OrchestrationPatterns.cs | Added integration test for suborchestrations with both tags and retry policy |
added 2 commits
December 30, 2025 16:25
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
test/Grpc.IntegrationTests/OrchestrationPatterns.cs:175
- The test is missing the standard "Arrange", "Act", and "Assert" comments that help structure unit tests according to the project's C# Unit Test Guidelines. These comments should be added to clearly separate the test setup, execution, and verification phases.
public async Task ScheduleSubOrchestrationWithTagsAndRetryPolicy()
{
TaskName orchestratorName = nameof(ScheduleSubOrchestrationWithTagsAndRetryPolicy);
// Schedule a new orchestration instance with tags
SubOrchestrationOptions subOrchestrationOptions = new()
{
InstanceId = "instance_id",
Tags = new Dictionary<string, string>
{
{ "tag1", "value1" },
{ "tag2", "value2" }
},
Retry = new RetryPolicy(maxNumberOfAttempts: 2, firstRetryInterval: TimeSpan.FromSeconds(5))
};
int failCounter = 0;
await using HostTestLifetime server = await this.StartWorkerAsync(b =>
{
b.AddTasks(tasks => tasks.AddOrchestratorFunc<int, int>(orchestratorName, async (ctx, input) =>
{
if (failCounter < 1 && input == 2)
{
failCounter++;
throw new Exception("Simulated failure");
}
int result = 1;
if (input < 2)
{
// recursively call this same orchestrator
result += await ctx.CallSubOrchestratorAsync<int>(orchestratorName, input: input + 1, subOrchestrationOptions);
}
return result;
}));
});
// Confirm the first attempt failed
await server.Client.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input: 1);
OrchestrationMetadata metadata = await server.Client.WaitForInstanceCompletionAsync(
subOrchestrationOptions.InstanceId, this.TimeoutToken);
Assert.NotNull(metadata);
Assert.Equal(OrchestrationRuntimeStatus.Failed, metadata.RuntimeStatus);
// Wait for the retry to happen
while (metadata.RuntimeStatus != OrchestrationRuntimeStatus.Completed && !this.TimeoutToken.IsCancellationRequested)
{
await Task.Delay(TimeSpan.FromSeconds(1), this.TimeoutToken);
metadata = await server.Client.WaitForInstanceCompletionAsync(
subOrchestrationOptions.InstanceId, this.TimeoutToken);
}
// Confirm the second attempt succeeded
Assert.Equal(OrchestrationRuntimeStatus.Completed, metadata.RuntimeStatus);
Assert.NotNull(metadata.Tags);
Assert.Equal(2, metadata.Tags.Count);
Assert.Equal("value1", metadata.Tags["tag1"]);
Assert.Equal("value2", metadata.Tags["tag2"]);
}
YunchuWang
approved these changes
Jan 5, 2026
… IDisposable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
test/Grpc.IntegrationTests/OrchestrationPatterns.cs:177
- This test lacks Arrange, Act, and Assert section comments which are recommended in the unit test guidelines for this repository. Adding these comments would improve test readability and make the test structure clearer.
public async Task ScheduleSubOrchestrationWithTagsAndRetryPolicy()
{
TaskName orchestratorName = nameof(ScheduleSubOrchestrationWithTagsAndRetryPolicy);
// Schedule a new orchestration instance with tags and a retry policy
SubOrchestrationOptions subOrchestrationOptions = new()
{
InstanceId = "instance_id",
Tags = new Dictionary<string, string>
{
{ "tag1", "value1" },
{ "tag2", "value2" }
},
Retry = new RetryPolicy(maxNumberOfAttempts: 2, firstRetryInterval: TimeSpan.FromSeconds(15))
};
int failCounter = 0;
await using HostTestLifetime server = await this.StartWorkerAsync(b =>
{
b.AddTasks(tasks => tasks.AddOrchestratorFunc<int, int>(orchestratorName, async (ctx, input) =>
{
if (failCounter < 1 && input == 2)
{
failCounter++;
throw new Exception("Simulated failure");
}
int result = 1;
if (input < 2)
{
// recursively call this same orchestrator
result += await ctx.CallSubOrchestratorAsync<int>(orchestratorName, input: input + 1, subOrchestrationOptions);
}
return result;
}));
});
using CancellationTokenSource timeoutTokenSource = new(TimeSpan.FromMinutes(1));
// Confirm the first attempt failed
await server.Client.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input: 1);
OrchestrationMetadata metadata = await server.Client.WaitForInstanceCompletionAsync(
subOrchestrationOptions.InstanceId, timeoutTokenSource.Token);
Assert.NotNull(metadata);
Assert.Equal(OrchestrationRuntimeStatus.Failed, metadata.RuntimeStatus);
// Wait for the retry to happen
while (metadata.RuntimeStatus != OrchestrationRuntimeStatus.Completed && !timeoutTokenSource.Token.IsCancellationRequested)
{
await Task.Delay(TimeSpan.FromSeconds(1), timeoutTokenSource.Token);
metadata = await server.Client.WaitForInstanceCompletionAsync(
subOrchestrationOptions.InstanceId, timeoutTokenSource.Token);
}
// Confirm the second attempt succeeded
Assert.Equal(OrchestrationRuntimeStatus.Completed, metadata.RuntimeStatus);
Assert.NotNull(metadata.Tags);
Assert.Equal(2, metadata.Tags.Count);
Assert.Equal("value1", metadata.Tags["tag1"]);
Assert.Equal("value2", metadata.Tags["tag2"]);
}
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
YunchuWang
approved these changes
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues / work items
Project checklist
release_notes.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):