n8n 2.28.1 → 2.28.3

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.
@@ -2814,7 +2814,7 @@ let InstanceAiService = class InstanceAiService {
2814
2814
  }),
2815
2815
  };
2816
2816
  const archivedWorkflowIds = await this.temporaryWorkflowService.reapForRun(threadId, user, aiCreatedWorkflowIds, this.backgroundTasks.getRunningTasks(threadId).length);
2817
- this.publishRunFinish(threadId, runId, 'cancelled', cancellationReason, archivedWorkflowIds);
2817
+ this.publishRunFinish(threadId, runId, 'cancelled', cancellationReason, archivedWorkflowIds, user.id);
2818
2818
  if (activeSnapshotStorage) {
2819
2819
  await this.saveAgentTreeSnapshot(threadId, runId, activeSnapshotStorage);
2820
2820
  }
@@ -3400,6 +3400,7 @@ let InstanceAiService = class InstanceAiService {
3400
3400
  };
3401
3401
  const archivedWorkflowIds = await this.temporaryWorkflowService.reapForRun(opts.threadId, opts.user, undefined, this.backgroundTasks.getRunningTasks(opts.threadId).length);
3402
3402
  await this.finalizeRun(opts.threadId, opts.runId, result.status, opts.snapshotStorage, {
3403
+ userId: opts.user.id,
3403
3404
  archivedWorkflowIds,
3404
3405
  workSummary: result.workSummary,
3405
3406
  usage: result.usage,
@@ -3445,7 +3446,7 @@ let InstanceAiService = class InstanceAiService {
3445
3446
  }),
3446
3447
  };
3447
3448
  const archivedWorkflowIds = await this.temporaryWorkflowService.reapForRun(opts.threadId, opts.user, undefined, this.backgroundTasks.getRunningTasks(opts.threadId).length);
3448
- this.publishRunFinish(opts.threadId, opts.runId, 'cancelled', cancellationReason, archivedWorkflowIds);
3449
+ this.publishRunFinish(opts.threadId, opts.runId, 'cancelled', cancellationReason, archivedWorkflowIds, opts.user.id);
3449
3450
  await this.saveAgentTreeSnapshot(opts.threadId, opts.runId, opts.snapshotStorage);
3450
3451
  return;
3451
3452
  }
@@ -3762,7 +3763,7 @@ let InstanceAiService = class InstanceAiService {
3762
3763
  reason,
3763
3764
  });
3764
3765
  const archivedWorkflowIds = await this.temporaryWorkflowService.reapForRun(suspended.threadId, suspended.user, undefined, this.backgroundTasks.getRunningTasks(suspended.threadId).length);
3765
- this.publishRunFinish(suspended.threadId, suspended.runId, 'cancelled', reason, archivedWorkflowIds);
3766
+ this.publishRunFinish(suspended.threadId, suspended.runId, 'cancelled', reason, archivedWorkflowIds, suspended.user.id);
3766
3767
  await this.saveAgentTreeSnapshot(suspended.threadId, suspended.runId, this.dbSnapshotStorage, true);
3767
3768
  await this.maybeFinalizeRunTraceRoot(suspended.runId, {
3768
3769
  status: 'cancelled',
@@ -3775,7 +3776,7 @@ let InstanceAiService = class InstanceAiService {
3775
3776
  });
3776
3777
  void this.suspendedThreads.dropPendingConfirmation(suspended.requestId);
3777
3778
  }
3778
- publishRunFinish(threadId, runId, status, reason, archivedWorkflowIds) {
3779
+ publishRunFinish(threadId, runId, status, reason, archivedWorkflowIds, userId) {
3779
3780
  const effectiveStatus = status === 'errored' ? 'error' : status;
3780
3781
  const hasArchived = archivedWorkflowIds && archivedWorkflowIds.length > 0;
3781
3782
  this.eventBus.publish(threadId, {
@@ -3792,10 +3793,11 @@ let InstanceAiService = class InstanceAiService {
3792
3793
  thread_id: threadId,
3793
3794
  run_id: runId,
3794
3795
  status: effectiveStatus,
3796
+ ...(userId ? { user_id: userId } : {}),
3795
3797
  });
3796
3798
  }
3797
3799
  async finalizeRun(threadId, runId, status, snapshotStorage, options) {
3798
- this.publishRunFinish(threadId, runId, status, undefined, options?.archivedWorkflowIds);
3800
+ this.publishRunFinish(threadId, runId, status, undefined, options?.archivedWorkflowIds, options?.userId);
3799
3801
  this.emitRunMetrics(threadId, status, options);
3800
3802
  await this.saveAgentTreeSnapshot(threadId, runId, snapshotStorage);
3801
3803
  if (status === 'completed' && options?.userId && options?.modelId) {