Skip to content

Workflow wedged in :running when build_run_context raises (unregistered step type) #207

Description

@duncanita

Severity: medium
Found in: 2026-07-22 code review

Location

lib/dag/runner.rb:124 (call site), :159 (acquire_running transitions :pending -> :running first), :187 (@registry.lookup raises inside build_run_context), :191 (klass.new(config:) raises for cached step instances).

Failure mode

Runner#call transitions the workflow to :running before build_run_context runs. build_run_context can raise for reachable, non-exotic reasons: UnknownStepTypeError for a definition node whose type was never registered (create_workflow does not validate registry membership), StaleRevisionError on corrupt storage, or a cached step's constructor raising on invalid config. The exception propagates out of #call, leaving the workflow in :running with zero events. Worse, it is unrecoverable: resume allows :running but re-enters the same build_run_context and raises identically, so the workflow can never reach a terminal state.

Minimal trigger

Register only :noop, store a definition with add_node(:a, type: :typo), call runner.call(id)UnknownStepTypeError, workflow stuck :running forever.

Fix direction

Rescue build_run_context failures inside #call, transition the workflow to :failed (with a diagnostic event) before re-raising, so the row never wedges in :running. Related: safe_call_step (runner.rb:438-453) gives the same constructor error a different behavior for cache_instances: false — see the companion low-severity issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions