@kb-labs/workflow-daemon 2.107.0 → 2.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -163,6 +163,8 @@ async function createWorkflowWorker(options) {
163
163
  return true;
164
164
  }
165
165
  }
166
+ let failedStepFailure;
167
+ let failedStepRetry;
166
168
  const jobPromise = (async () => {
167
169
  try {
168
170
  let wasCancelled = false;
@@ -442,6 +444,8 @@ async function createWorkflowWorker(options) {
442
444
  const stepDurationMs = Date.now() - stepStartTime;
443
445
  const error = new Error(result.error?.message ?? "Step execution failed");
444
446
  await engine.markStepFailed(run.id, job.id, step.id, error);
447
+ failedStepFailure = result.failure;
448
+ failedStepRetry = step.spec.retry;
445
449
  stepLogger.error("Step failed", error, {
446
450
  runId: run.id,
447
451
  jobId: job.id,
@@ -514,7 +518,8 @@ async function createWorkflowWorker(options) {
514
518
  } catch (error) {
515
519
  const err = error instanceof Error ? error : new Error(String(error));
516
520
  const jobDuration = Date.now() - jobStartTime;
517
- await engine.markJobFailed(run.id, job.id, err);
521
+ const retryPolicy = failedStepRetry ?? job.retries;
522
+ await engine.markJobFailed(run.id, job.id, err, failedStepFailure, retryPolicy);
518
523
  analytics?.track("workflow.worker.job.failed", {
519
524
  runId: run.id,
520
525
  jobId: job.id,