Skip to content

[P1] Terminalize workflow run when onWorkflowRunCreated startup hook fails #5

Description

@brAperia2025

Context: CodeRabbit feedback on upstream PR coleam00#1875 surfaced a likely-valid pending-row bug in our fork.

Problem:

  • packages/workflows/src/executor.ts creates a workflow run and then awaits onWorkflowRunCreated.
  • If createWorkflowRun succeeds but onWorkflowRunCreated throws, the catch path reports a DB creation failure and leaves the created run pending.

Impact:

  • P1. Orphaned pending workflow runs can confuse status, locks, and follow-up workflow dispatch.

Acceptance criteria:

  • Separate createWorkflowRun failure handling from onWorkflowRunCreated failure handling.
  • If the startup hook fails after the run exists, mark that workflow run failed/cancelled with a clear reason before returning.
  • Log hook failure with workflowRunId.
  • Add a regression test for hook failure after successful run creation.

Reference:

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