@rivetkit/workflow-engine 0.0.0-05-09-fix-workflow-engine-only-commit-step-state-after-success.cc1baa6 → 0.0.0-counter-latency-serverless-docs.cb4ffa1

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.
@@ -2291,8 +2291,13 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2291
2291
  return output;
2292
2292
  } catch (error) {
2293
2293
  if (error instanceof StepTimeoutError) {
2294
+ if (entry.kind.type === "step") {
2295
+ entry.kind.data.error = String(error);
2296
+ }
2297
+ entry.dirty = true;
2294
2298
  metadata.status = "exhausted";
2295
2299
  metadata.error = String(error);
2300
+ await this.flushStorage();
2296
2301
  await this.notifyStepError(config2, metadata.attempts, error, {
2297
2302
  willRetry: false
2298
2303
  });
@@ -2306,8 +2311,13 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2306
2311
  );
2307
2312
  }
2308
2313
  if (error instanceof CriticalError || error instanceof RollbackError) {
2314
+ if (entry.kind.type === "step") {
2315
+ entry.kind.data.error = String(error);
2316
+ }
2317
+ entry.dirty = true;
2309
2318
  metadata.status = "exhausted";
2310
2319
  metadata.error = String(error);
2320
+ await this.flushStorage();
2311
2321
  await this.notifyStepError(config2, metadata.attempts, error, {
2312
2322
  willRetry: false
2313
2323
  });
@@ -2320,9 +2330,14 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2320
2330
  })
2321
2331
  );
2322
2332
  }
2333
+ if (entry.kind.type === "step") {
2334
+ entry.kind.data.error = String(error);
2335
+ }
2336
+ entry.dirty = true;
2323
2337
  const willRetry = metadata.attempts <= maxRetries;
2324
2338
  metadata.status = willRetry ? "failed" : "exhausted";
2325
2339
  metadata.error = String(error);
2340
+ await this.flushStorage();
2326
2341
  if (willRetry) {
2327
2342
  const retryDelay = calculateBackoff(
2328
2343
  metadata.attempts,
@@ -4195,4 +4210,4 @@ export {
4195
4210
  runWorkflow,
4196
4211
  replayWorkflowFromStep
4197
4212
  };
4198
- //# sourceMappingURL=chunk-ODIFRE72.js.map
4213
+ //# sourceMappingURL=chunk-CIDHCIH7.js.map