Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Problem

Flowcharts with multiple triggers fail when resuming: "Activity X is not reachable from the flowchart graph. Unable to schedule its outbound activities"

This occurs when:

  1. Workflow starts via trigger A, schedules activities
  2. Workflow suspends on trigger B (with canStartWorkflow: false)
  3. Trigger B resumes the instance, becoming the new TriggerActivityId
  4. GetFlowGraph() recreates FlowGraph with trigger B as root
  5. Activities from trigger A's path now appear "dangling" and throw

Solution

Modified MaybeScheduleOutboundActivitiesAsync to distinguish between:

  • Truly dangling activities: No outbound connections (still throws)
  • Resumption dangling: Has outbound connections but unreachable from current root (now allowed)
// Before: threw for any dangling activity
if (flowGraph.IsDanglingActivity(activity))
{
    throw new($"Activity {activity.Id} is not reachable...");
}

// After: only throw if truly isolated
var outboundConnections = flowGraph.GetOutboundConnections(activity);
if (flowGraph.IsDanglingActivity(activity) && outboundConnections.Count == 0)
{
    throw new($"Activity {activity.Id} is not reachable and has no outbound connections...");
}

Activities with outbound connections were legitimately scheduled and should complete regardless of FlowGraph root changes during resumption.

Original prompt

This section details on the original issue you should resolve

<issue_title>Unable to schedule outbound activity</issue_title>
<issue_description>Hello,

I have created minimal project for clean slate operation
PFA zip of the project along with reproducing steps

Step1 : Save Definition with below JSON

{"model":{"definitionId":"Hiten V Test","name":"Hiten V Test","description":null,"inputs":[],"outputs":[],"option":[],"variables":[{"id":"5b77a66d-64f7-4f3a-ad1d-81316703dedb","name":"RootTrigger","typeName":"Object","value":null,"storageDriverTypeName":"Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"},{"id":"70552eab-2cbf-43bf-9a23-52ab26b9274c","name":"CreateChildTask1","typeName":"Object","value":null,"storageDriverTypeName":"Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"},{"id":"48241bec-839b-4d23-8483-fc9e856df3c5","name":"CreateChildTask2","typeName":"Object","value":null,"storageDriverTypeName":"Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"},{"id":"6e29a489-1804-43fe-b51b-6de0dddbb68a","name":"SendEmail3","typeName":"Object","value":null,"storageDriverTypeName":"Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"}],"root":{"name":"Flowchart1","type":"Elsa.Flowchart","activities":[{"name":"RecordCreated","type":"ElsaCleanSlate.Triggers.RecordCreated","customProperties":{"canStartWorkflow":true,"runAsynchronously":false},"statusId":{"typeName":"Int16","expression":{"type":"Literal","value":0}},"fieldId":{"typeName":"String","expression":{"type":"Literal","value":""}},"entityTypeId":{"typeName":"Int16","expression":{"type":"Literal","value":5}},"taskTypeId":{"typeName":"Int32","expression":{"type":"Literal","value":0}},"entityId":{"typeName":"Int32"},"id":"a2541a4d-1f06-4cff-a6f6-2ffcdea29e87","isImmediateTrigger":{"typeName":"Boolean","expression":{"type":"Literal","value":true}},"result":{"typeName":"Object","memoryReference":{"id":"5b77a66d-64f7-4f3a-ad1d-81316703dedb"}}},{"name":"CreateChildTask1","type":"ElsaCleanSlate.Activities.CreateChildTask","result":{"typeName":"Object","memoryReference":{"id":"70552eab-2cbf-43bf-9a23-52ab26b9274c"}},"inputJson":{"typeName":"String","expression":{"type":"JavaScript","value":"JSON.stringify({Metadata:{TaskTitle:"AP02 Task from Workflow"},EntityId:0,EntityTypeId:5,ParentTaskId:getVariable('RootTrigger').EntityId,ChildTaskTypeId:75})"}},"conditionJson":{"typeName":"String"},"id":"70552eab-2cbf-43bf-9a23-52ab26b9274c"},{"name":"RecordUpdated","type":"ElsaCleanSlate.Triggers.RecordUpdated","customProperties":{"canStartWorkflow":true,"runAsynchronously":false},"statusId":{"typeName":"Int16","expression":{"type":"Literal","value":0}},"fieldId":{"typeName":"String","expression":{"type":"Literal","value":""}},"entityTypeId":{"typeName":"Int16","expression":{"type":"Literal","value":5}},"taskTypeId":{"typeName":"Int32","expression":{"type":"Literal","value":0}},"entityId":{"typeName":"Int32"},"id":"8f13496a-3372-4c01-8f38-7fae5f346899","isImmediateTrigger":{"typeName":"Boolean","expression":{"type":"Literal","value":true}},"result":{"typeName":"Object","memoryReference":{"id":"5b77a66d-64f7-4f3a-ad1d-81316703dedb"}}},{"name":"CreateChildTask2","type":"ElsaCleanSlate.Activities.CreateChildTask","result":{"typeName":"Object","memoryReference":{"id":"48241bec-839b-4d23-8483-fc9e856df3c5"}},"inputJson":{"typeName":"String","expression":{"type":"JavaScript","value":"JSON.stringify({Metadata:{TaskTitle:"Ap Task Type from Workflow"},EntityId:0,EntityTypeId:5,ParentTaskId:getVariable('RootTrigger').EntityId,ChildTaskTypeId:65})"}},"conditionJson":{"typeName":"String"},"id":"48241bec-839b-4d23-8483-fc9e856df3c5"},{"name":"RecordUpdated","type":"ElsaCleanSlate.Triggers.RecordUpdated","customProperties":{"canStartWorkflow":false,"runAsynchronously":false},"statusId":{"typeName":"Int16","expression":{"type":"Literal","value":0}},"fieldId":{"typeName":"String","expression":{"type":"Literal","value":""}},"entityTypeId":{"typeName":"Int16","expression":{"type":"Literal","value":5}},"taskTypeId":{"typeName":"Int32","expression":{"type":"Literal","value":65}},"entityId":{"typeName":"Int32","expression":{"type":"JavaScript","value":"getVariable('CreateChildTask2').EntityId"}},"id":"c7c6effb-1e91-47d1-a407-4ad87fedfd57"},{"name":"SendEmail3","type":"ElsaCleanSlate.Activities.SendEmail","result":{"typeName":"Object","memoryReference":{"id":"6e29a489-1804-43fe-b51b-6de0dddbb68a"}},"inputJson":{"typeName":"String","expression":{"type":"JavaScript","value":"JSON.stringify({Priority:0,IsAllowOnlyAssignedMembers:false,EmailTo:"[email protected]",ToGroups:"",ToRoles:"",AllowedCc:false,AllowedBcc:false,EmailCc:"",CcGroups:"",CcRoles:"",EmailBcc:"",BccGroups:"",BccRoles:"",EmailSubject:"Custom Subject ",EmailBody:"

Test mail 

",EntityTypeId:5,EntityId:getVariable('CreateChildTask2').EntityId})"}},"conditionJson":{"typeName":"String"},"id":"6e29a489-1804-43fe-b51b-6de0ddd...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 27, 2026 11:31
Modified MaybeScheduleOutboundActivitiesAsync to handle activities that appear
dangling from one trigger's perspective but were legitimately scheduled by another
trigger. Now only throws exception if activity has no outbound connections.

Co-authored-by: sfmskywalker <[email protected]>
Copilot AI changed the title [WIP] Fix issue scheduling outbound activity in project Fix dangling activity exception when resuming flowcharts with multiple triggers Jan 27, 2026
Copilot AI requested a review from sfmskywalker January 27, 2026 11:42
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.

Unable to schedule outbound activity

2 participants