@workflow/world-testing 5.1.1 → 5.1.2

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.
@@ -28510,7 +28510,7 @@ function SemanticConvention(...names) {
28510
28510
  value
28511
28511
  ]));
28512
28512
  }
28513
- var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowExecutionMode, WorkflowDynamic, WorkflowStartHook, WorkflowStartHookRetentionUntil, WorkflowStartHookOutcome, WorkflowStartHookConflictingRunId, WorkflowStartHookRejectionReason, WorkflowStartHookErrorCode, WorkflowStartHookConfirmAttempts, WorkflowStartHookEnqueueFailed, WorkflowStartHookTrigger, WorkflowDynamicSourceHash, WorkflowDynamicCodeBytes, WorkflowDynamicCodeStorage, WorkflowBundleCompileCacheHit, WorkflowReplayLoadSource, WorkflowParkedEventsCount, WorkflowParkedEventId, WorkflowParkedEventType, WorkflowParkedStartHookEventsCount, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowVm, QuickJSOutcome, QuickJSEventsPreloaded, QuickJSEventsFetchedCount, QuickJSEventsFetchedPages, QuickJSPendingOpsCount, QuickJSInlineSteps, QuickJSSnapshotRestored, QuickJSSnapshotDeltaEvents, QuickJSSnapshotRestoreMs, QuickJSSnapshotFallbackReason, QuickJSSnapshotSaveMs, QuickJSSnapshotPlaintextBytes, QuickJSSnapshotStoredBytes, WorkflowTraceMode, WorkflowTurbo, WorkflowNoopDelivery, WorkflowSuperseded, WorkflowDeliveryAttempt, WorkflowDeliveryCount, WorkflowDeliveryExitReason, WorkflowDeliveryHandoff, WorkflowConsecutiveFenceRefusals, WorkflowReenqueueCount, WorkflowReenqueueSkippedTooOld, WorkflowReenqueueRecovery, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowStepsFailedSerialization, WorkflowOwnedRecoverySteps, WorkflowBackstopWakesArmed, WorkflowInlineEarlyAdvances, WorkflowInlineRunningAtTerminal, WorkflowInlineDiscardedOutcomes, WorkflowInlineSlotsHeldBack, WorkflowDispatchRepublishSkipped, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, FaasInstance, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepRsfsMs, StepFinalSchedulingReplayMs, StepLatencyOptimizations, StepStartStrategy, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, MessagingBatchMessageCount, QueueOverheadMs, DeploymentId, WorkflowRunPinnedDeploymentId, WorkflowDeploymentMismatchRetryCount, WorkflowDeploymentMismatchRecovered, WorkflowRunSpecVersion, WorkflowRunSpecVersionSource, WorkflowCapabilityProbeLatencyMs, WorkflowCapabilityProbeCached, WorkflowCapabilityProbeError, HookToken, HookId, HookFound, HookResilientResume, HookLookupResult, HookResumeCommitted, HookWakePublished, HookResilientResumeMaterialized, HookResumeSetupSource, StepDispatchPrologue, StepDeliveryDecision, StepDeliveryReason, StepDeliveryLogRead, StepDeliveryTimeoutSeconds, ResumeTotalMs, ResumeProducerPrepMs, ResumeQueueDeliveryMs, ResumeSetupMs, ResumeReplayMs, ResumeStepDispatchMs, ResumeStepClaimMs, ResumeStepPrepareMs, ResumeTrigger, ResumeStrategy, ResumeSetupSource, ResumeStepExecution, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, SerializationGuestCodeExecutions, SerializationGuestCodeDetails, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
28513
+ var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowExecutionMode, WorkflowDynamic, WorkflowStartHook, WorkflowStartHookRetentionUntil, WorkflowStartHookOutcome, WorkflowStartHookConflictingRunId, WorkflowStartHookRejectionReason, WorkflowStartHookErrorCode, WorkflowStartHookConfirmAttempts, WorkflowStartHookEnqueueFailed, WorkflowStartHookTrigger, WorkflowDynamicSourceHash, WorkflowDynamicCodeBytes, WorkflowDynamicCodeStorage, WorkflowBundleCompileCacheHit, WorkflowReplayLoadSource, WorkflowParkedEventsCount, WorkflowParkedEventId, WorkflowParkedEventType, WorkflowParkedStartHookEventsCount, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowVm, QuickJSOutcome, QuickJSEventsPreloaded, QuickJSEventsFetchedCount, QuickJSEventsFetchedPages, QuickJSPendingOpsCount, QuickJSInlineSteps, QuickJSSnapshotRestored, QuickJSSnapshotDeltaEvents, QuickJSSnapshotRestoreMs, QuickJSSnapshotFallbackReason, QuickJSSnapshotSaveMs, QuickJSSnapshotPlaintextBytes, QuickJSSnapshotStoredBytes, WorkflowTraceMode, WorkflowTurbo, WorkflowNoopDelivery, WorkflowSuperseded, WorkflowDeliveryAttempt, WorkflowDeliveryCount, WorkflowDeliveryExitReason, WorkflowDeliveryHandoff, WorkflowConsecutiveFenceRefusals, WorkflowReenqueueCount, WorkflowReenqueueSkippedTooOld, WorkflowReenqueueRecovery, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowStepsFailedSerialization, WorkflowOwnedRecoverySteps, WorkflowBackstopWakesArmed, WorkflowInlineEarlyAdvances, WorkflowInlineRunningAtTerminal, WorkflowInlineDiscardedOutcomes, WorkflowInlineSlotsHeldBack, WorkflowDispatchRepublishSkipped, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, FaasInstance, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepRsfsMs, StepFinalSchedulingReplayMs, StepLatencyOptimizations, StepStartStrategy, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, MessagingBatchMessageCount, QueueOverheadMs, DeploymentId, WorkflowRunPinnedDeploymentId, WorkflowDeploymentMismatchRetryCount, WorkflowDeploymentMismatchRecovered, WorkflowRunSpecVersion, WorkflowRunSpecVersionSource, WorkflowCapabilityProbeLatencyMs, WorkflowCapabilityProbeCached, WorkflowCapabilityProbeError, HookToken, HookId, HookFound, HookResilientResume, HookLookupResult, HookResumeCommitted, HookWakePublished, HookResilientResumeMaterialized, HookResumeSetupSource, StepDispatchPrologue, StepDeliveryDecision, StepDeliveryReason, StepDeliveryLogRead, StepDeliveryTimeoutSeconds, ResumeTotalMs, ResumeProducerPrepMs, ResumeQueueDeliveryMs, ResumeSetupMs, ResumeReplayMs, ResumeStepDispatchMs, ResumeStepClaimMs, ResumeStepPrepareMs, ResumeTrigger, ResumeStrategy, ResumeSetupSource, ResumeStepExecution, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, WorkflowEventsLoadStoppedAtLimit, WorkflowEventsLimit, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, SerializationGuestCodeExecutions, SerializationGuestCodeDetails, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
28514
28514
  var init_semantic_conventions = __esm({
28515
28515
  "../core/dist/telemetry/semantic-conventions.js"() {
28516
28516
  "use strict";
@@ -28667,6 +28667,8 @@ var init_semantic_conventions = __esm({
28667
28667
  ErrorType = SemanticConvention("error.type");
28668
28668
  WorldParseFormat = SemanticConvention("workflow.world.parse.format");
28669
28669
  WorkflowEventsPagesLoaded = SemanticConvention("workflow.events.pages_loaded");
28670
+ WorkflowEventsLoadStoppedAtLimit = SemanticConvention("workflow.events.load_stopped_at_limit");
28671
+ WorkflowEventsLimit = SemanticConvention("workflow.events.limit");
28670
28672
  QueueDeserializeTimeMs = SemanticConvention("workflow.queue.deserialize_time_ms");
28671
28673
  QueueExecutionTimeMs = SemanticConvention("workflow.queue.execution_time_ms");
28672
28674
  QueueSerializeTimeMs = SemanticConvention("workflow.queue.serialize_time_ms");
@@ -36310,7 +36312,7 @@ var version2;
36310
36312
  var init_version = __esm({
36311
36313
  "../core/dist/version.js"() {
36312
36314
  "use strict";
36313
- version2 = "5.6.0";
36315
+ version2 = "5.6.1";
36314
36316
  }
36315
36317
  });
36316
36318
 
@@ -37148,6 +37150,7 @@ var init_schema = __esm({
37148
37150
  doc TEXT NOT NULL,
37149
37151
  PRIMARY KEY (run_id, seq)
37150
37152
  ) WITHOUT ROWID;
37153
+ -- Named by INDEXED BY in storage/store.ts: dropping or renaming it breaks correlation lookups.
37151
37154
  CREATE INDEX events_by_correlation ON events (run_id, correlation_id, seq);
37152
37155
 
37153
37156
  CREATE TABLE steps (
@@ -67208,13 +67211,14 @@ function entityCursorClause(cursor, sortOrder, timeColumn, idColumn) {
67208
67211
  ]
67209
67212
  };
67210
67213
  }
67211
- var EVENT_READ_BATCH, Store, EVENT_CURSOR_PREFIX;
67214
+ var EVENT_READ_BATCH, EVENTS_BY_CORRELATION, Store, EVENT_CURSOR_PREFIX;
67212
67215
  var init_store = __esm({
67213
67216
  "../world-local/dist/storage/store.js"() {
67214
67217
  "use strict";
67215
67218
  init_dist4();
67216
67219
  init_codec();
67217
67220
  EVENT_READ_BATCH = 64;
67221
+ EVENTS_BY_CORRELATION = "events INDEXED BY events_by_correlation";
67218
67222
  __name(tagClause, "tagClause");
67219
67223
  __name(tagParams, "tagParams");
67220
67224
  Store = class {
@@ -67295,7 +67299,8 @@ var init_store = __esm({
67295
67299
  return row ? decode3(row.doc) : null;
67296
67300
  }
67297
67301
  findEvent(runId, correlationId, eventType) {
67298
- const row = this.db.get(`SELECT doc FROM events WHERE run_id = ? AND correlation_id = ? AND event_type = ?
67302
+ const row = this.db.get(`SELECT doc FROM ${EVENTS_BY_CORRELATION}
67303
+ WHERE run_id = ? AND correlation_id = ? AND event_type = ?
67299
67304
  ORDER BY seq LIMIT 1`, runId, correlationId, eventType);
67300
67305
  return row ? decode3(row.doc) : null;
67301
67306
  }
@@ -67308,6 +67313,7 @@ var init_store = __esm({
67308
67313
  const sortOrder = options.sortOrder ?? "asc";
67309
67314
  const limit = Math.max(1, options.limit ?? 20);
67310
67315
  const after = parseEventCursor(options.cursor);
67316
+ const source = options.correlationId === void 0 ? "events" : EVENTS_BY_CORRELATION;
67311
67317
  const query = /* @__PURE__ */ __name((from, take) => {
67312
67318
  const clauses = [
67313
67319
  "run_id = ?"
@@ -67323,7 +67329,7 @@ var init_store = __esm({
67323
67329
  clauses.push(sortOrder === "asc" ? "seq > ?" : "seq < ?");
67324
67330
  params.push(from);
67325
67331
  }
67326
- return this.db.all(`SELECT seq, doc FROM events WHERE ${clauses.join(" AND ")}
67332
+ return this.db.all(`SELECT seq, doc FROM ${source} WHERE ${clauses.join(" AND ")}
67327
67333
  ORDER BY seq ${sortOrder === "asc" ? "ASC" : "DESC"} LIMIT ?`, ...params, take);
67328
67334
  }, "query");
67329
67335
  const page = /* @__PURE__ */ __name((data2, hasMore) => {
@@ -68315,10 +68321,10 @@ function createEventsStorage(db, tag) {
68315
68321
  async list(params) {
68316
68322
  assertSafeEntityId("runId", params.runId);
68317
68323
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
68318
- const runRow = db.get("SELECT seq, seq_in_band FROM runs WHERE run_id = ?", params.runId);
68324
+ const runRow = store.getRunAnyTag(params.runId);
68319
68325
  const snapshot = {
68320
- seq: Number(runRow?.seq ?? 0),
68321
- seqInBand: Number(runRow?.seq_in_band ?? IN_BAND_SEQ_AT_RUN_CREATION)
68326
+ seq: runRow?.seq ?? 0,
68327
+ seqInBand: runRow?.seqInBand ?? IN_BAND_SEQ_AT_RUN_CREATION
68322
68328
  };
68323
68329
  const result = store.listEvents(params.runId, {
68324
68330
  cursor: params.pagination?.cursor,
@@ -68329,7 +68335,12 @@ function createEventsStorage(db, tag) {
68329
68335
  return {
68330
68336
  ...result,
68331
68337
  data: resolveData === "all" ? result.data : result.data.map((event) => stripEventDataRefs(event, resolveData)),
68332
- snapshot
68338
+ snapshot,
68339
+ // The ceiling `run_started` reports, so a delivery that did not
68340
+ // write it enforces the same one.
68341
+ ...runRow ? {
68342
+ maxEvents: getMaxEventsForRun(runRow.run)
68343
+ } : {}
68333
68344
  };
68334
68345
  },
68335
68346
  async listByCorrelationId(params) {
@@ -73105,7 +73116,7 @@ var version3;
73105
73116
  var init_version2 = __esm({
73106
73117
  "../world-vercel/dist/version.js"() {
73107
73118
  "use strict";
73108
- version3 = "5.6.0";
73119
+ version3 = "5.6.1";
73109
73120
  }
73110
73121
  });
73111
73122
 
@@ -104158,6 +104169,12 @@ function eventsV4Url(baseUrl, input2) {
104158
104169
  const apiVersion = eventsApiVersion(input2.specVersion, input2.executorSpecVersion);
104159
104170
  return `${baseUrl}/${apiVersion}/runs/${encodeURIComponent(input2.runId)}/events/${encodeURIComponent(input2.eventType)}`;
104160
104171
  }
104172
+ function maxEventsFromHeaders(headers) {
104173
+ const raw = headers.get(MAX_EVENTS_HEADER);
104174
+ if (raw === null || !DECIMAL_COUNTER.test(raw)) return void 0;
104175
+ const parsed = MaxEventsHeaderSchema.safeParse(raw);
104176
+ return parsed.success ? parsed.data : void 0;
104177
+ }
104161
104178
  function snapshotFromHeaders(headers) {
104162
104179
  const seq = headers.get(SNAPSHOT_SEQ_HEADER);
104163
104180
  const seqInBand = headers.get(SNAPSHOT_SEQ_IN_BAND_HEADER);
@@ -104971,6 +104988,7 @@ async function consumeEventFrameStream(response, opName, replayEventObserver) {
104971
104988
  if (frame2.meta._end === 1) {
104972
104989
  const end = EventStreamEndSchema.parse(frame2.meta);
104973
104990
  const snapshot = snapshotFromEnd(end.snapshot) ?? snapshotFromHeaders(response.headers);
104991
+ const maxEvents = maxEventsFromHeaders(response.headers);
104974
104992
  return {
104975
104993
  kind: "complete",
104976
104994
  events,
@@ -104978,6 +104996,9 @@ async function consumeEventFrameStream(response, opName, replayEventObserver) {
104978
104996
  hasMore: end.hasMore,
104979
104997
  ...snapshot ? {
104980
104998
  snapshot
104999
+ } : {},
105000
+ ...maxEvents !== void 0 ? {
105001
+ maxEvents
104981
105002
  } : {}
104982
105003
  };
104983
105004
  }
@@ -105150,6 +105171,9 @@ async function getWorkflowRunEventsV4(runId, params = {}, config3, replayEventOb
105150
105171
  // the first one, so this is the first snapshot the read saw.
105151
105172
  ...consumed.kind === "complete" && consumed.snapshot ? {
105152
105173
  snapshot: consumed.snapshot
105174
+ } : {},
105175
+ ...consumed.kind === "complete" && consumed.maxEvents !== void 0 ? {
105176
+ maxEvents: consumed.maxEvents
105153
105177
  } : {}
105154
105178
  };
105155
105179
  }
@@ -105303,6 +105327,7 @@ var init_events_v4 = __esm({
105303
105327
  noop: CreateEventV4BodySchema
105304
105328
  };
105305
105329
  MaxEventsHeaderSchema = external_exports.coerce.number().int().positive();
105330
+ __name(maxEventsFromHeaders, "maxEventsFromHeaders");
105306
105331
  EventLogSnapshotWireSchema = external_exports.object({
105307
105332
  seq: external_exports.number().int().nonnegative(),
105308
105333
  seqInBand: external_exports.number().int().nonnegative()
@@ -105885,6 +105910,10 @@ async function getWorkflowRunEvents(params, config3) {
105885
105910
  // backend reports them (see `capabilities.inBandFence` in index.ts).
105886
105911
  ...result.snapshot ? {
105887
105912
  snapshot: result.snapshot
105913
+ } : {},
105914
+ // The run's event ceiling, when the backend reports it on a list.
105915
+ ...result.maxEvents !== void 0 ? {
105916
+ maxEvents: result.maxEvents
105888
105917
  } : {}
105889
105918
  };
105890
105919
  }
@@ -109331,7 +109360,9 @@ var init_resume_hook = __esm({
109331
109360
  var serialization_exports = {};
109332
109361
  __export(serialization_exports, {
109333
109362
  FRAMED_STREAM_MAX_RECONNECTS: () => FRAMED_STREAM_MAX_RECONNECTS,
109363
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL: () => FRAMED_STREAM_MAX_STALLS_BELOW_TAIL,
109334
109364
  FRAMED_STREAM_MAX_TOTAL_RECONNECTS: () => FRAMED_STREAM_MAX_TOTAL_RECONNECTS,
109365
+ FRAMED_STREAM_MIN_STALL_SESSION_MS: () => FRAMED_STREAM_MIN_STALL_SESSION_MS,
109335
109366
  SerializationFormat: () => SerializationFormat,
109336
109367
  WorkflowServerReadableStream: () => WorkflowServerReadableStream,
109337
109368
  WorkflowServerWritableStream: () => WorkflowServerWritableStream,
@@ -109698,6 +109729,8 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
109698
109729
  let consumedFrames = 0;
109699
109730
  let reconnectCount = 0;
109700
109731
  let totalReconnectCount = 0;
109732
+ let stallsBelowTail = 0;
109733
+ let sessionStartedAt = 0;
109701
109734
  let reader;
109702
109735
  let canceled = false;
109703
109736
  let cancelReason;
@@ -109730,20 +109763,45 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
109730
109763
  return false;
109731
109764
  }
109732
109765
  if (connectMs === void 0) connectMs = Date.now() - connectStart;
109766
+ sessionStartedAt = Date.now();
109733
109767
  reader = stream.getReader();
109734
109768
  return true;
109735
109769
  }
109736
109770
  __name(connect2, "connect");
109737
- async function isVerifiedComplete() {
109771
+ async function getStreamInfo() {
109738
109772
  try {
109739
109773
  const world = await getWorldLazy();
109740
- const info = await world.streams.getInfo(runId, name);
109741
- return info.done && currentStartIndex + consumedFrames > info.tailIndex;
109774
+ return await world.streams.getInfo(runId, name);
109742
109775
  } catch {
109743
- return true;
109776
+ return void 0;
109744
109777
  }
109745
109778
  }
109779
+ __name(getStreamInfo, "getStreamInfo");
109780
+ function isVerifiedComplete(info) {
109781
+ if (!info) return true;
109782
+ return info.done && currentStartIndex + consumedFrames > info.tailIndex;
109783
+ }
109746
109784
  __name(isVerifiedComplete, "isVerifiedComplete");
109785
+ async function assertNotStalledAtHole(info) {
109786
+ if (consumedFrames > 0 || buffer2.length > 0) {
109787
+ stallsBelowTail = 0;
109788
+ return;
109789
+ }
109790
+ if (Date.now() - sessionStartedAt < FRAMED_STREAM_MIN_STALL_SESSION_MS) {
109791
+ return;
109792
+ }
109793
+ const resolved = info ?? await getStreamInfo();
109794
+ if (!resolved) return;
109795
+ if (resolved.tailIndex < currentStartIndex) {
109796
+ stallsBelowTail = 0;
109797
+ return;
109798
+ }
109799
+ stallsBelowTail++;
109800
+ if (stallsBelowTail >= FRAMED_STREAM_MAX_STALLS_BELOW_TAIL) {
109801
+ throw new StreamError(`Stream "${name}" of run "${runId}" has no readable chunk at index ${currentStartIndex}, below its tail index ${resolved.tailIndex}: ${stallsBelowTail} consecutive reads from that index delivered nothing. The chunk is missing from storage; read from startIndex ${currentStartIndex + 1} or later to continue past it.`);
109802
+ }
109803
+ }
109804
+ __name(assertNotStalledAtHole, "assertNotStalledAtHole");
109747
109805
  async function reconnect() {
109748
109806
  if (canceled) return false;
109749
109807
  if (reader) {
@@ -109801,6 +109859,8 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
109801
109859
  return;
109802
109860
  }
109803
109861
  try {
109862
+ await assertNotStalledAtHole();
109863
+ if (canceled) return;
109804
109864
  if (!await reconnect()) return;
109805
109865
  } catch (reconnectErr) {
109806
109866
  controller.error(reconnectErr);
@@ -109811,10 +109871,11 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
109811
109871
  if (canceled) return;
109812
109872
  if (result.done || !result.value) {
109813
109873
  reader = void 0;
109814
- const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
109874
+ const info = reconnectSupported ? await getStreamInfo() : void 0;
109815
109875
  if (canceled) return;
109816
- if (!verifiedComplete) {
109876
+ if (reconnectSupported && !isVerifiedComplete(info)) {
109817
109877
  try {
109878
+ await assertNotStalledAtHole(info);
109818
109879
  if (!await reconnect()) return;
109819
109880
  } catch (reconnectErr) {
109820
109881
  controller.error(reconnectErr);
@@ -111236,7 +111297,7 @@ function getStreamAndRequestRevivers(allRevivers) {
111236
111297
  }
111237
111298
  return extra;
111238
111299
  }
111239
- var defaultUlid, FRAME_HEADER_SIZE, MAX_FRAME_SIZE, WorkflowServerReadableStream, FRAMED_STREAM_MAX_RECONNECTS, getFramedStreamMaxReconnects, FRAMED_STREAM_MAX_TOTAL_RECONNECTS, getFramedStreamMaxTotalReconnects, STREAM_FLUSH_INTERVAL_MS, getEnvStreamFlushIntervalMs, WorkflowServerWritableStream, prepareReplayPayload, STREAM_AND_REQUEST_KEYS;
111300
+ var defaultUlid, FRAME_HEADER_SIZE, MAX_FRAME_SIZE, WorkflowServerReadableStream, FRAMED_STREAM_MAX_RECONNECTS, getFramedStreamMaxReconnects, FRAMED_STREAM_MAX_TOTAL_RECONNECTS, getFramedStreamMaxTotalReconnects, FRAMED_STREAM_MAX_STALLS_BELOW_TAIL, FRAMED_STREAM_MIN_STALL_SESSION_MS, STREAM_FLUSH_INTERVAL_MS, getEnvStreamFlushIntervalMs, WorkflowServerWritableStream, prepareReplayPayload, STREAM_AND_REQUEST_KEYS;
111240
111301
  var init_serialization2 = __esm({
111241
111302
  "../core/dist/serialization.js"() {
111242
111303
  "use strict";
@@ -111366,6 +111427,8 @@ var init_serialization2 = __esm({
111366
111427
  integer: true,
111367
111428
  min: 1
111368
111429
  }), "getFramedStreamMaxTotalReconnects");
111430
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL = 3;
111431
+ FRAMED_STREAM_MIN_STALL_SESSION_MS = 1e4;
111369
111432
  __name(createReconnectingFramedStream, "createReconnectingFramedStream");
111370
111433
  STREAM_FLUSH_INTERVAL_MS = 0;
111371
111434
  getEnvStreamFlushIntervalMs = /* @__PURE__ */ __name(() => {
@@ -119878,7 +119941,7 @@ __name(start, "start");
119878
119941
  value: "start",
119879
119942
  configurable: true
119880
119943
  });
119881
- })(start, "step//@workflow/core/runtime/start@5.6.0//start");
119944
+ })(start, "step//@workflow/core/runtime/start@5.6.1//start");
119882
119945
 
119883
119946
  // ../core/dist/runtime/runs.js
119884
119947
  function isSingleOrchestratorRun(run2) {
@@ -120518,7 +120581,7 @@ var Run = class _Run {
120518
120581
  value: "readFinishedRunIds",
120519
120582
  configurable: true
120520
120583
  });
120521
- })(Run.readFinishedRunIds, "step//@workflow/core/runtime/run@5.6.0//Run.readFinishedRunIds");
120584
+ })(Run.readFinishedRunIds, "step//@workflow/core/runtime/run@5.6.1//Run.readFinishedRunIds");
120522
120585
  (function(__wf_fn, __wf_id) {
120523
120586
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120524
120587
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120527,7 +120590,7 @@ var Run = class _Run {
120527
120590
  value: "wakeUp",
120528
120591
  configurable: true
120529
120592
  });
120530
- })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.6.0//Run#wakeUp");
120593
+ })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.6.1//Run#wakeUp");
120531
120594
  (function(__wf_fn, __wf_id) {
120532
120595
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120533
120596
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120536,7 +120599,7 @@ var Run = class _Run {
120536
120599
  value: "cancel",
120537
120600
  configurable: true
120538
120601
  });
120539
- })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.6.0//Run#cancel");
120602
+ })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.6.1//Run#cancel");
120540
120603
  (function(__wf_fn, __wf_id) {
120541
120604
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120542
120605
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120545,7 +120608,7 @@ var Run = class _Run {
120545
120608
  value: "readReturnValue",
120546
120609
  configurable: true
120547
120610
  });
120548
- })(Run.prototype["readReturnValue"], "step//@workflow/core/runtime/run@5.6.0//Run#readReturnValue");
120611
+ })(Run.prototype["readReturnValue"], "step//@workflow/core/runtime/run@5.6.1//Run#readReturnValue");
120549
120612
  (function(__wf_fn, __wf_id) {
120550
120613
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120551
120614
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120554,7 +120617,7 @@ var Run = class _Run {
120554
120617
  value: "getReadable",
120555
120618
  configurable: true
120556
120619
  });
120557
- })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.6.0//Run#getReadable");
120620
+ })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.6.1//Run#getReadable");
120558
120621
  (function(__wf_fn, __wf_id) {
120559
120622
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120560
120623
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120563,7 +120626,7 @@ var Run = class _Run {
120563
120626
  value: "getWritable",
120564
120627
  configurable: true
120565
120628
  });
120566
- })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.6.0//Run#getWritable");
120629
+ })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.6.1//Run#getWritable");
120567
120630
  (function(__wf_fn, __wf_id) {
120568
120631
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120569
120632
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120572,7 +120635,7 @@ var Run = class _Run {
120572
120635
  value: "exists",
120573
120636
  configurable: true
120574
120637
  });
120575
- })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.6.0//Run#exists");
120638
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.6.1//Run#exists");
120576
120639
  (function(__wf_fn, __wf_id) {
120577
120640
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120578
120641
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120581,7 +120644,7 @@ var Run = class _Run {
120581
120644
  value: "status",
120582
120645
  configurable: true
120583
120646
  });
120584
- })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.6.0//Run#status");
120647
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.6.1//Run#status");
120585
120648
  (function(__wf_fn, __wf_id) {
120586
120649
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120587
120650
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120590,7 +120653,7 @@ var Run = class _Run {
120590
120653
  value: "workflowName",
120591
120654
  configurable: true
120592
120655
  });
120593
- })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.6.0//Run#workflowName");
120656
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.6.1//Run#workflowName");
120594
120657
  (function(__wf_fn, __wf_id) {
120595
120658
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120596
120659
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120599,7 +120662,7 @@ var Run = class _Run {
120599
120662
  value: "createdAt",
120600
120663
  configurable: true
120601
120664
  });
120602
- })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#createdAt");
120665
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#createdAt");
120603
120666
  (function(__wf_fn, __wf_id) {
120604
120667
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120605
120668
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120608,7 +120671,7 @@ var Run = class _Run {
120608
120671
  value: "startedAt",
120609
120672
  configurable: true
120610
120673
  });
120611
- })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#startedAt");
120674
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#startedAt");
120612
120675
  (function(__wf_fn, __wf_id) {
120613
120676
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120614
120677
  __wf_reg.set(__wf_id, __wf_fn);
@@ -120617,7 +120680,7 @@ var Run = class _Run {
120617
120680
  value: "completedAt",
120618
120681
  configurable: true
120619
120682
  });
120620
- })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#completedAt");
120683
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#completedAt");
120621
120684
  (function(__wf_cls, __wf_id) {
120622
120685
  var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
120623
120686
  __wf_reg.set(__wf_id, __wf_cls);
@@ -120627,7 +120690,7 @@ var Run = class _Run {
120627
120690
  enumerable: false,
120628
120691
  configurable: false
120629
120692
  });
120630
- })(Run, "class//@workflow/core/runtime/run@5.6.0//Run");
120693
+ })(Run, "class//@workflow/core/runtime/run@5.6.1//Run");
120631
120694
 
120632
120695
  // ../workflow/dist/stdlib.js
120633
120696
  async function fetch2(...args) {