elsa-workflows / elsa-workflows/elsa-core

Workflow does not continue to next Flowchart step after a "ScheduleActivity" Alteration has been executed, starting with v3.3.1

Open
#6,458 2 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
Given a **Flowchart** workflow with multiple steps, each of which is a Sequence of activities, if the workflow faults on a bookmarking step, and then we run a **ScheduleActivity alteration** (after fixing the underlying exception case), then the alteration runs successfully, but when resuming from the bookmark, Elsa will run the rest of the steps in the current sequence, but it will NOT continue to the next Flowchart step.

This works fine in Elsa v3.3.0, but the issue presents itself starting with v3.3.1.

This applies to the **ContinueWithIncidentStrategy** which is required, as far as I can tell, to resume a faulted workflow...something very important for our enterprise customers.

One interesting behavior I see is that when the fault occurs in v3.3.1+, not only is the faulting activity's status set to "Faulted", but all ancestor activities in the workflow are also set to a "Faulted" status. This does not occur in v3.3.0...only the activity that faulted is set to "Faulted" and the ancestor activities remain in "Running".

## Steps to Reproduce
I've created a github repo to reproduce this issue with simplified activities.

[https://github.com/cali-llama/elsa-bug-demo](https://github.com/cali-llama/elsa-bug-demo)

On the main branch, which is currently targeting **Elsa v3.3.1** nugets, you can see the problem is you run the project's web api and then...

1. start a workflow by hitting the `http://localhost:5151/workflow/start` endpoint, which will cause the workflow to start and then exception, and then subsequently run the alteration.
2. resume the workflow by hitting the `http://localhost:5151/workflow/resume` endpoint.

Given the following workflow...
```
public class FaultingBookmarkWorkflow : WorkflowBase
{
protected override void Build(IWorkflowBuilder builder)
{
builder.WorkflowOptions.IncidentStrategyType = typeof(ContinueWithIncidentsStrategy);
var flowStepOne = new Sequence
{
Activities =
{
new WriteLine("Step 1, Pre Event"),
new FaultingEvent("Resume"){ Id = Constants.FaultingEventActivityId },
new WriteLine("Step 1, Post Event")
}
};

var flowStepTwo = new Sequence
{
Activities =
{
new WriteLine("Step 2, First Activity")
}
};

builder.Root = new Flowchart
{
Activities = { flowStepOne, flowStepTwo },
Connections = { new Connection(flowStepOne, flowStepTwo) }
};
}
}
```

When you do this you will see that the final `WriteLine` activity with "Step2, First Activity" does not get executed when resuming the workflow. If you change the Elsa nuget targets to v3.3.0, this works as expected.

## Environment
I'm running .NET9 via Mono on a MacOS Apple M2 Max ARM chip

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.