improvement(logs): state machine of workflow execution (#2560)

* improvement(logs): state machine of workflow execution

* cleanup more code

* fallback consistency

* fix labels

* backfill in migration correctly

* make streaming stop in chat window correctly
This commit is contained in:
Vikhyath Mondreti
2025-12-23 18:27:19 -08:00
committed by GitHub
parent 169dd4a503
commit 8c89507247
22 changed files with 8872 additions and 117 deletions

View File

@@ -0,0 +1,7 @@
ALTER TABLE "workflow_execution_logs" ADD COLUMN "status" text DEFAULT 'running' NOT NULL;--> statement-breakpoint
UPDATE "workflow_execution_logs"
SET "status" = CASE
WHEN "level" = 'error' THEN 'failed'
WHEN "ended_at" IS NOT NULL THEN 'completed'
ELSE 'running'
END;

File diff suppressed because it is too large Load Diff

View File

@@ -918,6 +918,13 @@
"when": 1766460889694,
"tag": "0131_illegal_nova",
"breakpoints": true
},
{
"idx": 132,
"version": "7",
"when": 1766529613309,
"tag": "0132_dazzling_leech",
"breakpoints": true
}
]
}

View File

@@ -304,8 +304,9 @@ export const workflowExecutionLogs = pgTable(
{ onDelete: 'set null' }
),
level: text('level').notNull(), // 'info', 'error'
trigger: text('trigger').notNull(), // 'api', 'webhook', 'schedule', 'manual', 'chat'
level: text('level').notNull(), // 'info' | 'error'
status: text('status').notNull().default('running'), // 'running' | 'pending' | 'completed' | 'failed' | 'cancelled'
trigger: text('trigger').notNull(), // 'api' | 'webhook' | 'schedule' | 'manual' | 'chat'
startedAt: timestamp('started_at').notNull(),
endedAt: timestamp('ended_at'),