rivetkit 3.0.0-preview.4 → 3.0.0-preview.5

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.
Files changed (64) hide show
  1. package/dist/browser/client.js +25 -19
  2. package/dist/browser/client.js.map +1 -1
  3. package/dist/browser/inspector/client.js +1 -1
  4. package/dist/browser/inspector/client.js.map +1 -1
  5. package/dist/tsup/{chunk-OR3LWJGW.js → chunk-AW7C2XT5.js} +2 -2
  6. package/dist/tsup/{chunk-DCUTYXIX.js → chunk-BAXQGOBL.js} +2 -2
  7. package/dist/tsup/{chunk-SR362FVR.cjs → chunk-CFGRIV62.cjs} +2 -2
  8. package/dist/tsup/{chunk-SR362FVR.cjs.map → chunk-CFGRIV62.cjs.map} +1 -1
  9. package/dist/tsup/{chunk-S5QNPQ6K.cjs → chunk-CLY73DEM.cjs} +3 -3
  10. package/dist/tsup/{chunk-S5QNPQ6K.cjs.map → chunk-CLY73DEM.cjs.map} +1 -1
  11. package/dist/tsup/{chunk-LTMP7OMQ.cjs → chunk-EON5X6B7.cjs} +3 -3
  12. package/dist/tsup/{chunk-LTMP7OMQ.cjs.map → chunk-EON5X6B7.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-C45DIKGB.js → chunk-EOUH7MP7.js} +30 -24
  14. package/dist/tsup/chunk-EOUH7MP7.js.map +1 -0
  15. package/dist/tsup/{chunk-5IZ36V3N.cjs → chunk-GJUWI47D.cjs} +167 -161
  16. package/dist/tsup/chunk-GJUWI47D.cjs.map +1 -0
  17. package/dist/tsup/{chunk-KSQ3VVZX.cjs → chunk-KEHBPXZE.cjs} +3 -3
  18. package/dist/tsup/{chunk-KSQ3VVZX.cjs.map → chunk-KEHBPXZE.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-ZWBTTPP3.js → chunk-KJM23DKG.js} +2 -2
  20. package/dist/tsup/{chunk-MAUVZIXL.js → chunk-KKSIGBUN.js} +2 -2
  21. package/dist/tsup/{chunk-MAUVZIXL.js.map → chunk-KKSIGBUN.js.map} +1 -1
  22. package/dist/tsup/{chunk-WE5DMJFV.cjs → chunk-MVDTFTCY.cjs} +7 -7
  23. package/dist/tsup/{chunk-WE5DMJFV.cjs.map → chunk-MVDTFTCY.cjs.map} +1 -1
  24. package/dist/tsup/{chunk-SLIGV2T4.cjs → chunk-PHFXQQGE.cjs} +4 -4
  25. package/dist/tsup/{chunk-SLIGV2T4.cjs.map → chunk-PHFXQQGE.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-IPDSE33U.js → chunk-SJUGJ5DT.js} +2 -2
  27. package/dist/tsup/{chunk-KM34T23X.js → chunk-W4CGRSYM.js} +3 -3
  28. package/dist/tsup/{chunk-WQFXPN6S.js → chunk-W5DDGJBO.js} +4 -4
  29. package/dist/tsup/{chunk-U2QBZJTL.cjs → chunk-ZOFNA4SR.cjs} +10 -10
  30. package/dist/tsup/{chunk-U2QBZJTL.cjs.map → chunk-ZOFNA4SR.cjs.map} +1 -1
  31. package/dist/tsup/client/mod.cjs +5 -5
  32. package/dist/tsup/client/mod.js +4 -4
  33. package/dist/tsup/common/log.cjs +2 -2
  34. package/dist/tsup/common/log.js +1 -1
  35. package/dist/tsup/common/websocket.cjs +3 -3
  36. package/dist/tsup/common/websocket.js +2 -2
  37. package/dist/tsup/db/drizzle.cjs +2 -2
  38. package/dist/tsup/db/drizzle.js +1 -1
  39. package/dist/tsup/db/mod.cjs +3 -3
  40. package/dist/tsup/db/mod.js +2 -2
  41. package/dist/tsup/inspector/mod.cjs +5 -5
  42. package/dist/tsup/inspector/mod.js +4 -4
  43. package/dist/tsup/inspector/workflow.cjs +4 -4
  44. package/dist/tsup/inspector/workflow.js +3 -3
  45. package/dist/tsup/mod.cjs +86 -86
  46. package/dist/tsup/mod.cjs.map +1 -1
  47. package/dist/tsup/mod.js +5 -5
  48. package/dist/tsup/test/mod.cjs +6 -6
  49. package/dist/tsup/test/mod.js +4 -4
  50. package/dist/tsup/utils.cjs +2 -2
  51. package/dist/tsup/utils.js +1 -1
  52. package/dist/tsup/workflow/mod.cjs +7 -7
  53. package/dist/tsup/workflow/mod.js +4 -4
  54. package/package.json +9 -9
  55. package/src/client/actor-conn.ts +21 -24
  56. package/src/client/lifecycle-errors.ts +13 -0
  57. package/dist/tsup/chunk-5IZ36V3N.cjs.map +0 -1
  58. package/dist/tsup/chunk-C45DIKGB.js.map +0 -1
  59. /package/dist/tsup/{chunk-OR3LWJGW.js.map → chunk-AW7C2XT5.js.map} +0 -0
  60. /package/dist/tsup/{chunk-DCUTYXIX.js.map → chunk-BAXQGOBL.js.map} +0 -0
  61. /package/dist/tsup/{chunk-ZWBTTPP3.js.map → chunk-KJM23DKG.js.map} +0 -0
  62. /package/dist/tsup/{chunk-IPDSE33U.js.map → chunk-SJUGJ5DT.js.map} +0 -0
  63. /package/dist/tsup/{chunk-KM34T23X.js.map → chunk-W4CGRSYM.js.map} +0 -0
  64. /package/dist/tsup/{chunk-WQFXPN6S.js.map → chunk-W5DDGJBO.js.map} +0 -0
package/dist/tsup/mod.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  decodeWorkflowHistoryTransport
3
- } from "./chunk-ZWBTTPP3.js";
3
+ } from "./chunk-KJM23DKG.js";
4
4
  import {
5
5
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
6
6
  ActorConfigSchema,
@@ -35,18 +35,18 @@ import {
35
35
  runWithActorInvocationSpan,
36
36
  tryParseEndpoint,
37
37
  updateRunnerConfig
38
- } from "./chunk-C45DIKGB.js";
38
+ } from "./chunk-EOUH7MP7.js";
39
39
  import {
40
40
  makePrefixedKey,
41
41
  removePrefixFromKey
42
42
  } from "./chunk-A2CF6PFH.js";
43
- import "./chunk-IPDSE33U.js";
44
43
  import {
45
44
  bindNativeStateTransactionContext,
46
45
  db,
47
46
  registerNativeStateTransactionOpener
48
- } from "./chunk-OR3LWJGW.js";
47
+ } from "./chunk-AW7C2XT5.js";
49
48
  import "./chunk-JTHHCZCZ.js";
49
+ import "./chunk-SJUGJ5DT.js";
50
50
  import {
51
51
  LogLevelSchema,
52
52
  VERSION,
@@ -80,7 +80,7 @@ import {
80
80
  parsePortEnv,
81
81
  stringifyError,
82
82
  toUint8Array
83
- } from "./chunk-MAUVZIXL.js";
83
+ } from "./chunk-KKSIGBUN.js";
84
84
  import {
85
85
  INTERNAL_ERROR_CODE,
86
86
  RivetError,
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkWE5DMJFVcjs = require('../chunk-WE5DMJFV.cjs');
3
+ var _chunkMVDTFTCYcjs = require('../chunk-MVDTFTCY.cjs');
4
4
 
5
5
 
6
- var _chunk5IZ36V3Ncjs = require('../chunk-5IZ36V3N.cjs');
6
+ var _chunkGJUWI47Dcjs = require('../chunk-GJUWI47D.cjs');
7
7
  require('../chunk-RTWH3AX3.cjs');
8
- require('../chunk-S5QNPQ6K.cjs');
9
8
  require('../chunk-KVFIONKQ.cjs');
10
- require('../chunk-SR362FVR.cjs');
9
+ require('../chunk-CLY73DEM.cjs');
10
+ require('../chunk-CFGRIV62.cjs');
11
11
  require('../chunk-MGI2VVF6.cjs');
12
12
 
13
13
  // src/test/ready.ts
@@ -36,8 +36,8 @@ async function setupTest(c, registry) {
36
36
  registry.config.noWelcome = true;
37
37
  registry.start();
38
38
  await waitForRegistryReady(registry);
39
- const client = _chunkWE5DMJFVcjs.createClient.call(void 0, {
40
- ..._chunk5IZ36V3Ncjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
39
+ const client = _chunkMVDTFTCYcjs.createClient.call(void 0, {
40
+ ..._chunkGJUWI47Dcjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
41
41
  disableMetadataLookup: false
42
42
  });
43
43
  c.onTestFinished(async () => {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createClient
3
- } from "../chunk-KM34T23X.js";
3
+ } from "../chunk-W4CGRSYM.js";
4
4
  import {
5
5
  convertRegistryConfigToClientConfig
6
- } from "../chunk-C45DIKGB.js";
6
+ } from "../chunk-EOUH7MP7.js";
7
7
  import "../chunk-A2CF6PFH.js";
8
- import "../chunk-IPDSE33U.js";
9
8
  import "../chunk-JTHHCZCZ.js";
10
- import "../chunk-MAUVZIXL.js";
9
+ import "../chunk-SJUGJ5DT.js";
10
+ import "../chunk-KKSIGBUN.js";
11
11
  import "../chunk-ZOVJDAOW.js";
12
12
 
13
13
  // src/test/ready.ts
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkSR362FVRcjs = require('./chunk-SR362FVR.cjs');
22
+ var _chunkCFGRIV62cjs = require('./chunk-CFGRIV62.cjs');
23
23
  require('./chunk-MGI2VVF6.cjs');
24
24
 
25
25
 
@@ -42,5 +42,5 @@ require('./chunk-MGI2VVF6.cjs');
42
42
 
43
43
 
44
44
 
45
- exports.EXTRA_ERROR_LOG = _chunkSR362FVRcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkSR362FVRcjs.SinglePromiseQueue; exports.VERSION = _chunkSR362FVRcjs.VERSION; exports.arrayBuffersEqual = _chunkSR362FVRcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkSR362FVRcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkSR362FVRcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkSR362FVRcjs.combineUrlPath; exports.dbg = _chunkSR362FVRcjs.dbg; exports.detectRuntime = _chunkSR362FVRcjs.detectRuntime; exports.getEnvUniversal = _chunkSR362FVRcjs.getEnvUniversal; exports.httpUserAgent = _chunkSR362FVRcjs.httpUserAgent; exports.interval = _chunkSR362FVRcjs.interval; exports.joinSignals = _chunkSR362FVRcjs.joinSignals; exports.jsonParseCompat = _chunkSR362FVRcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkSR362FVRcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkSR362FVRcjs.promiseWithResolvers; exports.setLongTimeout = _chunkSR362FVRcjs.setLongTimeout; exports.sleep = _chunkSR362FVRcjs.sleep; exports.stringifyError = _chunkSR362FVRcjs.stringifyError; exports.toUint8Array = _chunkSR362FVRcjs.toUint8Array;
45
+ exports.EXTRA_ERROR_LOG = _chunkCFGRIV62cjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkCFGRIV62cjs.SinglePromiseQueue; exports.VERSION = _chunkCFGRIV62cjs.VERSION; exports.arrayBuffersEqual = _chunkCFGRIV62cjs.arrayBuffersEqual; exports.assertUnreachable = _chunkCFGRIV62cjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkCFGRIV62cjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkCFGRIV62cjs.combineUrlPath; exports.dbg = _chunkCFGRIV62cjs.dbg; exports.detectRuntime = _chunkCFGRIV62cjs.detectRuntime; exports.getEnvUniversal = _chunkCFGRIV62cjs.getEnvUniversal; exports.httpUserAgent = _chunkCFGRIV62cjs.httpUserAgent; exports.interval = _chunkCFGRIV62cjs.interval; exports.joinSignals = _chunkCFGRIV62cjs.joinSignals; exports.jsonParseCompat = _chunkCFGRIV62cjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkCFGRIV62cjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkCFGRIV62cjs.promiseWithResolvers; exports.setLongTimeout = _chunkCFGRIV62cjs.setLongTimeout; exports.sleep = _chunkCFGRIV62cjs.sleep; exports.stringifyError = _chunkCFGRIV62cjs.stringifyError; exports.toUint8Array = _chunkCFGRIV62cjs.toUint8Array;
46
46
  //# sourceMappingURL=utils.cjs.map
@@ -19,7 +19,7 @@ import {
19
19
  sleep,
20
20
  stringifyError,
21
21
  toUint8Array
22
- } from "./chunk-MAUVZIXL.js";
22
+ } from "./chunk-KKSIGBUN.js";
23
23
  import "./chunk-ZOVJDAOW.js";
24
24
  export {
25
25
  EXTRA_ERROR_LOG,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2;
2
2
 
3
- var _chunkU2QBZJTLcjs = require('../chunk-U2QBZJTL.cjs');
4
- require('../chunk-KSQ3VVZX.cjs');
5
- require('../chunk-SLIGV2T4.cjs');
3
+ var _chunkZOFNA4SRcjs = require('../chunk-ZOFNA4SR.cjs');
4
+ require('../chunk-KEHBPXZE.cjs');
5
+ require('../chunk-PHFXQQGE.cjs');
6
6
 
7
7
 
8
8
 
@@ -13,7 +13,7 @@ var _chunkHDVZ6YZGcjs = require('../chunk-HDVZ6YZG.cjs');
13
13
  var _chunkRTWH3AX3cjs = require('../chunk-RTWH3AX3.cjs');
14
14
 
15
15
 
16
- var _chunkSR362FVRcjs = require('../chunk-SR362FVR.cjs');
16
+ var _chunkCFGRIV62cjs = require('../chunk-CFGRIV62.cjs');
17
17
 
18
18
 
19
19
 
@@ -743,7 +743,7 @@ function workflow(fn, options = {}) {
743
743
  function getWorkflowInspector(actorId) {
744
744
  let workflowInspector = workflowInspectors.get(actorId);
745
745
  if (!workflowInspector) {
746
- workflowInspector = _chunkU2QBZJTLcjs.createWorkflowInspectorAdapter.call(void 0, );
746
+ workflowInspector = _chunkZOFNA4SRcjs.createWorkflowInspectorAdapter.call(void 0, );
747
747
  workflowInspectors.set(actorId, workflowInspector);
748
748
  }
749
749
  return workflowInspector;
@@ -816,13 +816,13 @@ function workflow(fn, options = {}) {
816
816
  if (shouldRethrowWorkflowError(error)) {
817
817
  runCtx.log.error({
818
818
  msg: "workflow run failed",
819
- error: _chunkSR362FVRcjs.stringifyError.call(void 0, error)
819
+ error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error)
820
820
  });
821
821
  throw error;
822
822
  }
823
823
  runCtx.log.warn({
824
824
  msg: "workflow failed and will sleep until woken",
825
- error: _chunkSR362FVRcjs.stringifyError.call(void 0, error)
825
+ error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error)
826
826
  });
827
827
  } finally {
828
828
  runCtx.abortSignal.removeEventListener("abort", onAbort);
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createWorkflowInspectorAdapter
3
- } from "../chunk-WQFXPN6S.js";
4
- import "../chunk-DCUTYXIX.js";
5
- import "../chunk-ZWBTTPP3.js";
3
+ } from "../chunk-W5DDGJBO.js";
4
+ import "../chunk-BAXQGOBL.js";
5
+ import "../chunk-KJM23DKG.js";
6
6
  import {
7
7
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
8
8
  defineRunHandler
@@ -13,7 +13,7 @@ import {
13
13
  } from "../chunk-A2CF6PFH.js";
14
14
  import {
15
15
  stringifyError
16
- } from "../chunk-MAUVZIXL.js";
16
+ } from "../chunk-KKSIGBUN.js";
17
17
  import {
18
18
  RivetError,
19
19
  isActorAbortedError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivetkit",
3
- "version": "3.0.0-preview.4",
3
+ "version": "3.0.0-preview.5",
4
4
  "description": "Lightweight libraries for building stateful actors on edge platforms",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -211,15 +211,15 @@
211
211
  "@hono/zod-openapi": "^1.1.5",
212
212
  "@opentelemetry/api": "^1.1.0",
213
213
  "@rivetkit/bare-ts": "^0.6.2",
214
- "@rivetkit/engine-api-full": "3.0.0-preview.4",
215
- "@rivetkit/engine-cli": "3.0.0-preview.4",
216
- "@rivetkit/engine-envoy-protocol": "3.0.0-preview.4",
214
+ "@rivetkit/engine-api-full": "3.0.0-preview.5",
215
+ "@rivetkit/engine-cli": "3.0.0-preview.5",
216
+ "@rivetkit/engine-envoy-protocol": "3.0.0-preview.5",
217
217
  "@rivetkit/on-change": "6.0.1",
218
- "@rivetkit/rivetkit-napi": "3.0.0-preview.4",
219
- "@rivetkit/rivetkit-wasm": "3.0.0-preview.4",
220
- "@rivetkit/traces": "3.0.0-preview.4",
221
- "@rivetkit/virtual-websocket": "3.0.0-preview.4",
222
- "@rivetkit/workflow-engine": "3.0.0-preview.4",
218
+ "@rivetkit/rivetkit-napi": "3.0.0-preview.5",
219
+ "@rivetkit/rivetkit-wasm": "3.0.0-preview.5",
220
+ "@rivetkit/traces": "3.0.0-preview.5",
221
+ "@rivetkit/virtual-websocket": "3.0.0-preview.5",
222
+ "@rivetkit/workflow-engine": "3.0.0-preview.5",
223
223
  "cbor-x": "^1.6.0",
224
224
  "drizzle-orm": "0.45.2",
225
225
  "hono": "^4.7.0",
@@ -50,9 +50,7 @@ import {
50
50
  import { ACTOR_CONNS_SYMBOL, type ClientRaw } from "./client";
51
51
  import * as errors from "./errors";
52
52
  import { isRetryableLifecycleReconnectSignal } from "./lifecycle-errors";
53
- import { retryAfterMs } from "./retry-budget";
54
53
  import { logger } from "./log";
55
- import { isInvalidToken } from "./token-provider";
56
54
  import { outboundTelemetryHeaders } from "./outbound-telemetry";
57
55
  import {
58
56
  createQueueSender,
@@ -61,6 +59,8 @@ import {
61
59
  type QueueSendResult,
62
60
  type QueueSendWaitOptions,
63
61
  } from "./queue";
62
+ import { retryAfterMs } from "./retry-budget";
63
+ import { isInvalidToken } from "./token-provider";
64
64
  import {
65
65
  type WebSocketMessage as ConnMessage,
66
66
  messageLength,
@@ -160,6 +160,8 @@ export class ActorConnRaw {
160
160
  #abortController = new AbortController();
161
161
 
162
162
  #connStatus: ActorConnStatus = "idle";
163
+ /** The opening failure that stopped retries. Later actions must fail instead of queueing. */
164
+ #connectionOpenError?: errors.ActorError;
163
165
 
164
166
  #actorId?: string;
165
167
  #connId?: string;
@@ -356,6 +358,8 @@ export class ActorConnRaw {
356
358
  `Invalid action call: expected an options object { name, args }, got ${typeof opts}. Use conn.actionName(...args) for the shorthand API.`,
357
359
  );
358
360
  }
361
+ if (this.#disposed) throw new errors.ActorConnDisposed();
362
+ if (this.#connectionOpenError) throw this.#connectionOpenError;
359
363
  logger().debug({ msg: "action", name: opts.name, args: opts.args });
360
364
 
361
365
  // If we have an active connection, use the websockactionId
@@ -466,6 +470,7 @@ export class ActorConnRaw {
466
470
  }
467
471
 
468
472
  #connectWithRetry() {
473
+ this.#connectionOpenError = undefined;
469
474
  this.#setConnStatus("connecting");
470
475
 
471
476
  // Attempt to reconnect indefinitely
@@ -523,6 +528,11 @@ export class ActorConnRaw {
523
528
  // Wait for result
524
529
  await this.#waitForOpen(this.#onOpenPromise.promise);
525
530
  } catch (error) {
531
+ this.#abandonCurrentSocket(
532
+ isConnectionOpenTimeout(error)
533
+ ? "Connect timeout"
534
+ : "Connection opening failed",
535
+ );
526
536
  if (this.#shouldRetryConnectionOpenError(error)) {
527
537
  throw error;
528
538
  }
@@ -537,7 +547,7 @@ export class ActorConnRaw {
537
547
  { error: stringifyError(error) },
538
548
  );
539
549
 
540
- this.#clearQueuedMessages();
550
+ this.#connectionOpenError = actorError;
541
551
  this.#rejectPendingPromises(actorError, false);
542
552
  this.#dispatchActorError(actorError);
543
553
  this.#setConnStatus("idle");
@@ -573,29 +583,24 @@ export class ActorConnRaw {
573
583
  });
574
584
  try {
575
585
  await Promise.race([open, timedOut]);
576
- } catch (error) {
577
- if (isConnectionOpenTimeout(error)) {
578
- this.#abandonCurrentSocket();
579
- }
580
- throw error;
581
586
  } finally {
582
587
  clearTimeout(timer);
583
588
  }
584
589
  }
585
590
 
586
- #abandonCurrentSocket() {
591
+ #abandonCurrentSocket(reason: string) {
587
592
  const ws = this.#websocket;
588
593
  if (!ws) return;
589
594
  this.#websocket = undefined;
590
595
  this.#abandonedSockets.add(ws);
591
- logger().warn({
592
- msg: "connection did not open in time, retrying",
596
+ logger().debug({
597
+ msg: "closing failed connection attempt",
593
598
  connId: this.#connId,
594
599
  readyState: ws.readyState,
595
- timeoutMs: CONNECT_TIMEOUT_MS,
600
+ reason,
596
601
  });
597
602
  try {
598
- ws.close(1000, "Connect timeout");
603
+ ws.close(1000, reason);
599
604
  } catch (err) {
600
605
  logger().debug({
601
606
  msg: "failed to close abandoned websocket",
@@ -923,18 +928,8 @@ export class ActorConnRaw {
923
928
  }
924
929
  }
925
930
 
926
- // If we have an onOpenPromise, reject it with the error
927
- if (this.#onOpenPromise) {
928
- this.#onOpenPromise.reject(errorToThrow);
929
- }
930
-
931
931
  this.#invalidateActorIfStale(group, code);
932
-
933
- // Reject any in-flight requests
934
- for (const [id, inFlight] of this.#actionsInFlight.entries()) {
935
- inFlight.reject(errorToThrow);
936
- this.#actionsInFlight.delete(id);
937
- }
932
+ this.#rejectPendingPromises(errorToThrow, false);
938
933
 
939
934
  this.#dispatchActorError(errorToThrow);
940
935
  }
@@ -1100,6 +1095,8 @@ export class ActorConnRaw {
1100
1095
  }
1101
1096
 
1102
1097
  #rejectPendingPromises(error: Error, suppressUnhandled: boolean) {
1098
+ // Rejected actions must not survive in the queue and execute after a reconnect.
1099
+ this.#clearQueuedMessages();
1103
1100
  if (this.#onOpenPromise) {
1104
1101
  if (suppressUnhandled) {
1105
1102
  this.#onOpenPromise.promise.catch(() => {});
@@ -77,6 +77,19 @@ function classifyActorError(
77
77
  );
78
78
  }
79
79
 
80
+ if (
81
+ (error.group === "ups" && error.code === "consumer_closed") ||
82
+ (error.group === "depot" && error.code === "request_deadline_exceeded")
83
+ ) {
84
+ // The connection can recover, but an interrupted action may already have run.
85
+ return buildLifecycleBoundaryInfo(
86
+ "reconnect_only",
87
+ "actor_error",
88
+ error.message,
89
+ { group: error.group, code: error.code },
90
+ );
91
+ }
92
+
80
93
  if (
81
94
  error.group === "guard" &&
82
95
  isRetryableGuardGatewayHttpError(error.code)