BaryoDev / BaryoDev/barakoCMS

A workflow run cannot be cancelled, only retried

Open
#699 0 comments 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
C#
Stars
6
Forks
7
Avg merge
4h 42m
Merged PRs (30d)
307

Description

`Features/WorkflowRuns/Endpoints.cs` has three endpoints: `ListRunsEndpoint`, `GetRunEndpoint`, `RetryAttemptEndpoint`. There is no way to stop a run.

So an operator who realises a workflow is pointed at the wrong URL, or is about to email the wrong list, watches it run. `WorkflowRetryPolicy.MaxAttempts` is 5 and the backoff reaches ten minutes, so a bad run keeps trying for the best part of an hour. Deleting the workflow definition does not help: `WorkflowRunQueue` copies the parameters into the run when it queues it, deliberately, so queued runs carry on with the definition they were built from.

`WorkflowActionResult.PermanentFailure` covers the case where the action itself knows it is misconfigured. It does not cover the operator knowing.

### Shape

A cancel on the run, and probably on a single pending attempt, reaching only work that has not started. An attempt currently `Running` under a live lease is out of scope: the request is already with the third party and cancelling the record would not recall it. That attempt finishes and records its outcome, and the run stops after it.

Worth deciding explicitly whether cancel is a distinct terminal state or reuses `Skipped`. A distinct state is probably right, because "nobody asked for this to stop" and "the content was deleted" are different things for anyone reading the run later, and `AttemptStatus` already keeps `Unknown` separate for exactly that kind of reason.

Gate it on a capability rather than reusing `RetryWorkflowActions`. Stopping a run and re-sending one are different powers.

### Relationship to existing issues

#577 asks for compensation, undoing the steps that succeeded when a run is abandoned. That presupposes a way to abandon one, which does not exist yet. This is the smaller half and a prerequisite.

### Where I checked

`barakoCMS/Features/WorkflowRuns/Endpoints.cs`, `barakoCMS/Features/Workflows/WorkflowRunner.cs`, `barakoCMS/Models/WorkflowRun.cs`. Grepped both feature folders for cancel outside `CancellationToken` and found only comments. Searched open issues; #577 is related and does not cover this.

Contributor guide

Open the contributing guide

Research direction

Start with barakoCMS/Features/WorkflowRuns/Endpoints.cs, barakoCMS/Features/Workflows/WorkflowRunner.cs, and barakoCMS/Models/WorkflowRun.cs to trace run and attempt state transitions. Decide the terminal state and capability needed for cancellation, then verify that pending work stops while an attempt under a live lease can finish and the run stops afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authorization, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.