Skip to content

Standardize execution status values across codebase #92

Closed

Description

@vybe

Problem

There are three different ExecutionStatus enums and none match what's actually written to the database:

Location Enum Values Actually Used in DB?
models.py:180 (queue) queued, running, completed, failed, timeout Only for in-memory queue objects
process_engine/enums.py:27 pending, running, paused, completed, failed, cancelled Process tables only
schedule_executions table (actual) running, success, failed, skipped, cancelled YES — the real DB

Key Mismatches

  • Enum says COMPLETED, database stores "success"
  • Enum says TIMEOUT, database stores "failed" with error message
  • "skipped" exists in database but in NO enum
  • Activities use "completed" for success, executions use "success" — two words for the same outcome

Where statuses are written

DB Status Written By Code Location
"running" create_task_execution() db/schedules.py:494, scheduler/database.py:231
"success" TaskExecutionService task_execution_service.py:254
"failed" TaskExecutionService (timeout, HTTP error, exception) task_execution_service.py:297,330,354
"skipped" Scheduler only scheduler/database.py:290
"cancelled" Execution termination endpoint chat.py:1318

Required Changes

  1. Define ONE canonical status enum used everywhere: running, success, failed, cancelled, skipped
  2. Remove ExecutionStatus from models.py (queue-specific, misleading)
  3. Align activity states with execution states (both should use "success" or both "completed")
  4. Add "skipped" to the canonical enum
  5. Update all code paths to reference the single enum

Files to Change

  • src/backend/models.py — ExecutionStatus enum
  • src/backend/services/task_execution_service.py — status writes
  • src/backend/services/activity_service.py — activity state values
  • src/backend/services/execution_queue.py — queue status references
  • src/backend/db/schedules.py — execution creation
  • src/scheduler/database.py — scheduler execution creation
  • src/backend/routers/chat.py — status values in chat router

Activity

  1. added
    priority-p1
    on Mar 11, 2026
  2. reopened this on Mar 11, 2026
  3. vybe commented on Mar 12, 2026

    @vybe
    ContributorAuthor

    Already implemented in commit cc04fff. TaskExecutionStatus enum is now canonical.

  4. added a commit that references this issue on Mar 16, 2026
    cc04fff
  5. added
    complexity-low
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions