Skip to content

Conversation

@bachuv
Copy link
Contributor

@bachuv bachuv commented Jan 26, 2026

Adding the rewind API for the Java SDK.

  • Added a new rewindPostUri to HttpManagementPayload
  • Introduced rewindInstance API in DurableTaskClient
  • Update protobuf definitions
  • Added tests and samples

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

@bachuv bachuv self-assigned this Jan 26, 2026
@bachuv bachuv requested a review from a team as a code owner January 26, 2026 17:42
Copilot AI review requested due to automatic review settings January 28, 2026 01:43
RestAssured.baseURI = "http://localhost";
// Use port 8080 for Docker, 7071 for local func start
String port = System.getenv("FUNCTIONS_PORT");
RestAssured.port = port != null ? Integer.parseInt(port) : 8080;
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 pull request adds support for the rewind functionality in the Java SDK for Durable Task Framework. Rewind allows failed orchestrations to be replayed from their last known good state, which is useful for recovering from transient failures.

Changes:

  • Added rewindInstance API methods to DurableTaskClient and DurableTaskGrpcClient for rewinding failed orchestrations
  • Added rewindPostUri field to HttpManagementPayload to support HTTP-based rewind operations in Azure Functions
  • Updated protobuf definitions with ExecutionRewoundEvent and related changes to support the rewind feature

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
client/src/main/java/com/microsoft/durabletask/DurableTaskClient.java Adds public API methods for rewinding orchestration instances with optional reason parameter
client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java Implements rewindInstance by building and sending RewindInstanceRequest via gRPC
azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/HttpManagementPayload.java Adds rewindPostUri field with reason parameter placeholder for HTTP-based rewind operations
samples/src/main/java/io/durabletask/samples/RewindPattern.java Demonstrates rewind functionality with sample code that fails once then succeeds after rewind
endtoendtests/src/test/java/com/functions/EndToEndTests.java Adds end-to-end test for rewind functionality and improves test configuration with @BeforeAll setup
endtoendtests/src/main/java/com/functions/RewindTest.java Implements Azure Functions-based test orchestration that demonstrates the rewind feature
internal/durabletask-protobuf/protos/orchestrator_service.proto Adds ExecutionRewoundEvent and extends multiple messages with new fields for rewind support
internal/durabletask-protobuf/PROTO_SOURCE_COMMIT_HASH Updates to reflect the new protobuf source version
CHANGELOG.md Documents the new rewind client API feature
.github/workflows/build-validation.yml Increases emulator initialization wait time and adds logging for better CI reliability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

@Override
public void rewindInstance(String instanceId, @Nullable String reason) {
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing null check for instanceId parameter. Similar methods in this class like terminate() at line 249 use Helpers.throwIfArgumentNull(instanceId, "instanceId") to validate the parameter. This validation should be added for consistency and to provide a clear error message when null is passed.

Suggested change
public void rewindInstance(String instanceId, @Nullable String reason) {
public void rewindInstance(String instanceId, @Nullable String reason) {
Helpers.throwIfArgumentNull(instanceId, "instanceId");

Copilot uses AI. Check for mistakes.

message OrchestrationTraceContext {
google.protobuf.StringValue spanID = 1;
google.protobuf.Timestamp spanStartTime = 2;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at the end of line 338. Please remove the extra spaces after the semicolon to maintain consistent formatting.

Suggested change
google.protobuf.Timestamp spanStartTime = 2;
google.protobuf.Timestamp spanStartTime = 2;

Copilot uses AI. Check for mistakes.
rpc QueryInstances(QueryInstancesRequest) returns (QueryInstancesResponse);

rpc ListInstanceIds(ListInstanceIdsRequest) returns (ListInstanceIdsResponse);

Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at the end of line 776. Please remove the extra spaces to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
RestAssured.baseURI = "http://localhost";
// Use port 8080 for Docker, 7071 for local func start
String port = System.getenv("FUNCTIONS_PORT");
RestAssured.port = port != null ? Integer.parseInt(port) : 8080;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential uncaught 'java.lang.NumberFormatException'.

Suggested change
RestAssured.port = port != null ? Integer.parseInt(port) : 8080;
int resolvedPort = 8080;
if (port != null && !port.isEmpty()) {
try {
resolvedPort = Integer.parseInt(port);
} catch (NumberFormatException e) {
System.err.println("Invalid FUNCTIONS_PORT value '" + port + "'. Falling back to default port " + resolvedPort + ".");
}
}
RestAssured.port = resolvedPort;

Copilot uses AI. Check for mistakes.
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.

2 participants