Skip to content

Fix Faulted workflow when canceling a dangling parallel branch (e.g. Delay) on trigger-resume#7720

Draft
sfmskywalker with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-workflow-failure-delay-activity
Draft

Fix Faulted workflow when canceling a dangling parallel branch (e.g. Delay) on trigger-resume#7720
sfmskywalker with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-workflow-failure-delay-activity

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Purpose

A flowchart branch that runs in parallel (e.g. a self-looping Delay reminder) faults the workflow when it is canceled after the workflow is resumed via a trigger.


Scope

Select one primary concern:

  • Bug fix (behavior change)
  • Refactor (no behavior change)
  • Documentation update
  • Formatting / code cleanup
  • Dependency / build update
  • New feature

If this PR includes multiple unrelated concerns, please split it before requesting review.


Description

Problem

Given a flowchart where a blocking branch runs in parallel with a self-looping Delay:

Start ──> User approval (HTTP) ──> End
  └─────> Send reminder (Delay) ──┐  (self-loop)
                   ↑──────────────┘

Resuming via the HTTP endpoint sets TriggerActivityId, which causes FlowGraph to be rooted at the trigger activity rather than the structural Start. The parallel Delay is then unreachable from that root, so IsDanglingActivity returns true. When the approval branch completes through the terminal End, the flowchart completes and cancels the running Delay; OnCounterFlowActivityCanceledAsyncMaybeScheduleOutboundActivitiesAsync throws "Activity ... is not reachable from the flowchart graph", faulting the workflow. Regression vs 3.3.5; 100% repro on 3.7.0.

Solution

  • Flowchart.OnCounterFlowActivityCanceledAsync: return early when the canceled activity is dangling. Dangling activities have no forward outbound connections to propagate, and flowchart completion is already evaluated earlier in the handler.
  • Tests: integration test reproducing the issue topology with trigger-resume; FlowGraph unit test asserting the self-looping branch is dangling only when rooted at the trigger.

Verification

Steps:

  1. Build the user-approval flowchart: Start → {HttpEndpoint, Delay(self-loop)}, HttpEndpoint → End.
  2. Start the workflow (blocks on the endpoint while the Delay branch runs).
  3. Resume via the HTTP endpoint (sets TriggerActivityId).

Expected outcome: workflow reaches Finished instead of Faulted; the canceled Delay branch no longer throws.

Note: local build/test is blocked because the private cshells-feedz feed (transitive dep of Elsa.Workflows.Core) requires credentials unavailable in the sandbox; tests are expected to run in CI.


Screenshots / Recordings (if applicable)


Commit Convention

We recommend using conventional commit prefixes:

  • fix: – Bug fixes (behavior change)
  • feat: – New features
  • refactor: – Code changes without behavior change
  • docs: – Documentation updates
  • chore: – Maintenance, tooling, or dependency updates
  • test: – Test additions or modifications

Clear commit messages make reviews easier and history more meaningful.


Checklist

  • The PR is focused on a single concern
  • Commit messages follow the recommended convention
  • Tests added or updated (if applicable)
  • Documentation updated (if applicable)
  • No unrelated cleanup included
  • All tests pass

Copilot AI and others added 2 commits June 12, 2026 21:42
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…7717)

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix workflow fails when using Delay activity in Elsa 3.7.0 Fix Faulted workflow when canceling a dangling parallel branch (e.g. Delay) on trigger-resume Jun 12, 2026
Copilot AI requested a review from sfmskywalker June 12, 2026 21:49
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