Skip to content

feat: workflow execution lifecycle -- COMPLETED and FAILED status transitions #1042

@Aureliolo

Description

@Aureliolo

When tasks created by a workflow execution complete or fail, the WorkflowExecution should transition to terminal status accordingly.

Currently, activate() creates an execution in RUNNING status and cancel_execution() transitions to CANCELLED, but there is no mechanism to advance an execution to COMPLETED or FAILED based on task outcomes.

What needs to happen

  1. COMPLETED transition: When all TASK nodes in the execution have their corresponding tasks completed successfully, the execution should transition to COMPLETED with completed_at set.

  2. FAILED transition: When any task fails (or a configurable failure policy is met), the execution should transition to FAILED with error and completed_at set.

  3. Event constants: WORKFLOW_EXEC_COMPLETED and WORKFLOW_EXEC_FAILED are already defined in src/synthorg/observability/events/workflow_execution.py but are currently unused -- they should be used when logging these transitions.

Implementation options

  • Polling: A periodic check that queries task statuses for running executions
  • Event-driven: TaskEngine emits events on task completion/failure, and a listener updates the execution
  • Callback: The workflow execution service registers a callback with the TaskEngine at activation time

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:lowNice to have, can deferscope:medium1-3 days of workspec:task-workflowDESIGN_SPEC Section 6 - Task & Workflow Enginetype:featureNew feature implementationv0.6Minor version v0.6v0.6.2Patch release v0.6.2

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions