@@ -193,9 +193,12 @@ export class LoggingSession {
193193 }
194194 }
195195
196+ /**
197+ * Persist the last-started-block marker. Redis is the primary path when the
198+ * flag is on; falls back to the durable jsonb_set UPDATE when Redis is
199+ * unavailable or the write fails, so a marker is never dropped.
200+ */
196201 private async persistLastStartedBlock ( marker : ExecutionLastStartedBlock ) : Promise < void > {
197- // Redis is the primary path when enabled; fall back to the durable SQL write
198- // when Redis is unavailable or the write fails, so a marker is never dropped.
199202 if ( this . useRedisMarkers && ( await setLastStartedBlock ( this . executionId , marker ) ) ) {
200203 return
201204 }
@@ -216,9 +219,12 @@ export class LoggingSession {
216219 }
217220 }
218221
222+ /**
223+ * Persist the last-completed-block marker. Redis is the primary path when the
224+ * flag is on; falls back to the durable jsonb_set UPDATE when Redis is
225+ * unavailable or the write fails, so a marker is never dropped.
226+ */
219227 private async persistLastCompletedBlock ( marker : ExecutionLastCompletedBlock ) : Promise < void > {
220- // Redis is the primary path when enabled; fall back to the durable SQL write
221- // when Redis is unavailable or the write fails, so a marker is never dropped.
222228 if ( this . useRedisMarkers && ( await setLastCompletedBlock ( this . executionId , marker ) ) ) {
223229 return
224230 }
@@ -1022,6 +1028,13 @@ export class LoggingSession {
10221028 )
10231029 }
10241030
1031+ /**
1032+ * Force-fail terminal boundary that bypasses completeWorkflowExecution. Folds
1033+ * any live Redis progress markers into execution_data before clearing the key,
1034+ * so a run whose markers only ever lived in Redis still keeps its
1035+ * last-started/last-completed breadcrumb. Both the fold and clear are no-ops
1036+ * when the standard completion path already persisted and cleared them.
1037+ */
10251038 static async markExecutionAsFailed (
10261039 executionId : string ,
10271040 errorMessage : string | undefined ,
@@ -1031,11 +1044,6 @@ export class LoggingSession {
10311044 try {
10321045 const message = errorMessage || 'Run failed'
10331046
1034- // This terminal boundary bypasses completeWorkflowExecution, so fold any
1035- // live Redis markers into the row here too — otherwise a run whose markers
1036- // only ever lived in Redis would be saved with error data but no
1037- // last-started/last-completed breadcrumb. Empty when the standard
1038- // completion path already folded and cleared them.
10391047 const markers = await getProgressMarkers ( executionId )
10401048
10411049 let executionData = sql `jsonb_set(
@@ -1068,8 +1076,6 @@ export class LoggingSession {
10681076 )
10691077 )
10701078
1071- // Markers are now durable on the row; drop the Redis key to match the
1072- // standard clear-at-every-boundary invariant.
10731079 void clearProgressMarkers ( executionId )
10741080
10751081 logger . info ( `[${ requestId || 'unknown' } ] Marked execution ${ executionId } as failed` )
0 commit comments