Fix flowchart error when rescheduling activities inside sub-processes #7179
+46
−4
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.
When rescheduling a completed activity inside a sub-process and then completing it, the flowchart throws:
Activity {id} is not reachable from the flowchart graph. Unable to schedule it's outbound activities.The flowchart receives completion callbacks for all descendant activities, but its connection graph only contains direct children. When an activity inside a sub-process completes, the flowchart attempts to verify it's not dangling by checking the graph, which fails since only the sub-process container itself is in the graph.
Changes
IsDirectChild()helper to check ifcompletedActivityContext.ParentActivityExecutionContext == flowchartContextProcessChildCompletedAsync()OnChildCompletedTokenBasedLogicAsync(), extractClearTokensAndCompleteFlowchartAsync()helperWhen a non-direct child completes, the flowchart now only checks if it should complete rather than attempting to schedule outbound connections.
Applies to both counter-based and token-based execution modes.
Original prompt
This section details on the original issue you should resolve
<issue_title>Error occurs when completing a rescheduled step in a workflow which was re-scheduled after completion.</issue_title>
<issue_description>@sfmskywalker
Description
Error occurs when completing a rescheduled step in a workflow that was moved backward.
Issue Summary: When I reschedule a completed step to move the workflow backward and then try to complete that step again, an error is thrown.
Error Details: Activity 2c39c6367b2855a0 is not reachable from the flowchart graph. Unable to schedule it's outbound activities.
Steps to Reproduce
To help us identify the issue more quickly, please follow these guidelines:
Detailed Steps:
Code Snippets:
Main Workflow JSON that reproduces this issue:
main-workflow.json
Sub-Process SP-1 JSON (demonstrates the Event activities within sub-process):
SP-1.json
Sub-Process SP-2 JSON (demonstrates the Event activities within sub-process):
SP-2.json
Sub-Process SP-3 JSON (demonstrates the Event activities within sub-process):
SP-3.json
Sub-Process SP-4 JSON (demonstrates the Event activities within sub-process):
SP-4.json
Reproduction Rate: Every time when attempting to complete a rescheduled step
Screenshots:
Additional Configuration:
...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
This change is