feat: Add Stop mode to Run button to be able to cancel runs (workflows with Manual Trigger only)#482
Open
feat: Add Stop mode to Run button to be able to cancel runs (workflows with Manual Trigger only)#482
Conversation
The Workflow DevKit runtime has no abort mechanism, so after the cancel endpoint sets status to "cancelled" the runtime continues executing steps and writing "success" logs to the DB. This causes steps to flash green and node borders to stick on their last color. Add three layers of defense: - Server-side guards in workflow-logging.ts: logStepStartDb, logStepCompleteDb, updateCurrentStep, and incrementCompletedSteps all bail out when the execution is in a terminal state (cancelled/success/error) - Cancel endpoint cleanup: mark any in-flight "running" step logs as "error" and protect the internal PATCH route from overwriting a cancelled execution - Client-side fixes: Runs panel does one final log refresh when an execution transitions to terminal then stops polling it; toolbar resets nodes to idle on cancel; new runsRefreshTriggerAtom gives instant Run row appearance after clicking Run instead of waiting for the 2s poll
joelorzet
reviewed
Mar 4, 2026
| await db | ||
| .update(workflowExecutionLogs) | ||
| .set({ | ||
| status: "error", |
There was a problem hiding this comment.
We have a cancelled status. Would be good to use it instead of error
joelorzet
approved these changes
Mar 4, 2026
joelorzet
left a comment
There was a problem hiding this comment.
Just a comment about status to keep consistency. Lgtm!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
workflow-logging.tsnow bail out of all logging functions (logStepStartDb,logStepCompleteDb,updateCurrentStep,incrementCompletedSteps) when the execution is in a terminal staterunsRefreshTriggerAtom(replaces 2s poll delay)Scope
The Stop button currently only appears during manual test runs (triggered via the toolbar Run button). Schedule, Webhook, and Event-triggered executions run server-side and have no UI stop mechanism yet. The cancel API endpoint is trigger-agnostic and works for any execution ID -- a per-execution Stop button in the Runs panel would be needed to let users cancel non-manual runs.
Test plan
pnpm check && pnpm type-check-- both pass clean