Sorry for the delay, you can reproduce it with a parent workflow that does this:
public class ParentWorkflowImpl implements ParentWorkflow {
@Override
public void performTask(String input) {
try {
ChildWorkflowOptions childOptions = ChildWorkflowOptions.newBuilder()
.setWorkflowId(Workflow.getInfo() .getWorkflowId() + "-child1")
.setCancellationType(ChildWorkflowCancellationType.WAIT_CANCELLATION_REQUESTED)
.setParentClosePolicy(ParentClosePolicy.PARENT_CLOSE_POLICY_REQUEST_CANCEL)
.validateAndBuildWithDefaults();
ChildWorkflow1 child = Workflow.newChildWorkflowStub(ChildWorkflow1.class, childOptions);
child.performChildTask("testInput");
} catch (TemporalFailure e) {
if (CancellationScope.current().isCancelRequested()) {
Workflow.newDetachedCancellationScope(() -> {
LocalActivityTest act = Workflow.newLocalActivityStub(LocalActivityTest.class,
LocalActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.ofSeconds(5))
.validateAndBuildWithDefaults());
act.execute();
}).run();
throw e;
}
}
And a child that just blocks on a Workflow.await(() -> false) call. If you cancel the parent, the child will cancel, but the parent hits the LocalActivity: invalid REQUEST_PREPARED->NON_REPLAY_WORKFLOW_TASK_STARTED error.
The issue started with 1.24.0, it doesn’t reproduce with 1.23.2. It also doesn’t reproduce if the ChildWorkflowCancellationType is WAIT_CANCELLATION_COMPLETED. Let me know if you need a complete reproducer project, and I will put that together.