Skip to content

listWorkflowRuns status filter excludes deprecated-status rows (sleeping, succeeded) #716

Description

@kunaldevxxx

Background

WorkflowRunStatus includes deprecated values 'sleeping' and 'succeeded' kept for backward compatibility. New runs use 'running' and 'completed' respectively. Both backends are aware of the mapping (e.g., toWorkflowRunCounts folds deprecated statuses into their replacements).

Problem

listWorkflowRuns({ status: 'running' }) generates WHERE "status" = 'running', which excludes rows with status = 'sleeping'. Similarly, status: 'completed' excludes 'succeeded' rows. During or after a rolling upgrade where both statuses coexist, callers see incomplete lists.

Expected Behavior

Filtering by status: 'running' returns rows with either 'running' or 'sleeping'. Filtering by status: 'completed' returns rows with either 'completed' or 'succeeded'.

Proposed Solution

Define a mapping in core/workflow-run.ts:
const STATUS_ALIASES = { running: ['running', 'sleeping'], completed: ['completed', 'succeeded'] }
Apply it when building the WHERE clause in both backends, using IN (…) instead of = … for the affected statuses.

Acceptance Criteria

Integration test: insert a run with status = 'sleeping' directly. listWorkflowRuns({ status: 'running' }) includes it.
Integration test: insert a run with status = 'succeeded' directly. listWorkflowRuns({ status: 'completed' }) includes it.
Dashboard displays accurate run counts after upgrade.
Both Postgres and SQLite backends pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions