danielgerlag / danielgerlag/workflow-core

Post workflow middleware can't catch cancelled workflow

Open
#1,230 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.9k
Forks
1.3k
Avg merge
1d 1h
Merged PRs (30d)
5

Description

**Describe the bug**
A cancelled workflow not be caught in a post workflow middleware.

**To Reproduce**
1. Create a post workflow middleware following [doc](https://workflow-core.readthedocs.io/en/latest/workflow-middleware/#post-workflow-middleware)
2. Start a workflow with a `CancellationToken`
3. Cancel the workflow with token
4. The middleware is not triggered

**Expected behavior**
The post workflow middleware should be triggered with a "Terminated" status workflow.

**Additional context**

I am not sure if it is by design, if yes, how can I handle a cancelled workflow by using workflow middleware?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the post-workflow middleware documentation linked in the issue, then trace how CancellationToken cancellation is handled in the workflow engine and whether that path invokes post-workflow middleware. Done means a cancelled workflow reaches the middleware with a "Terminated" status, or the documentation explains the supported alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.