Repository navigation
Closed
Labels
Description
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
- Define ONE canonical status enum used everywhere:
running, success, failed, cancelled, skipped - Remove
ExecutionStatusfrommodels.py(queue-specific, misleading) - Align activity states with execution states (both should use
"success"or both"completed") - Add
"skipped"to the canonical enum - Update all code paths to reference the single enum
Files to Change
src/backend/models.py— ExecutionStatus enumsrc/backend/services/task_execution_service.py— status writessrc/backend/services/activity_service.py— activity state valuessrc/backend/services/execution_queue.py— queue status referencessrc/backend/db/schedules.py— execution creationsrc/scheduler/database.py— scheduler execution creationsrc/backend/routers/chat.py— status values in chat router
Activity
fix: Update scheduler tests for EXEC-024 backend delegation refactor
vybe commentedon Mar 12, 2026
Already implemented in commit cc04fff. TaskExecutionStatus enum is now canonical.
refactor: Standardize execution status values and add cleanup service