@moinulmoin/eden-runtime-cloudflare 0.11.3 → 0.11.4

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.
@@ -26159,6 +26159,12 @@ var EVE_HOST_CARRY_LIMITS = {
26159
26159
  chunkBytes: 1024 * 1024,
26160
26160
  maxBytes: 1024 * 1024 * 1024
26161
26161
  };
26162
+ var EveSandboxCarryLimitError = class extends Error {
26163
+ constructor() {
26164
+ super("The imported sandbox carry exceeds the archive limit.");
26165
+ this.name = "EveSandboxCarryLimitError";
26166
+ }
26167
+ };
26162
26168
  var EVE_HOST_SNAPSHOT_MAX_ATTEMPTS = 3;
26163
26169
  function isMissingContainerSnapshot(error61) {
26164
26170
  return error61 instanceof Error && /Snapshot ".*" was not found/u.test(error61.message);
@@ -26206,7 +26212,7 @@ var EdenWorldDurableObject = class extends DurableObject {
26206
26212
  if (message.sourceDeploymentId && message.sourceDeploymentId !== deploymentId && message.sandboxSessionId) {
26207
26213
  try {
26208
26214
  const result = await target2.importSandboxSessions(message.sourceDeploymentId, deploymentId, message.messageId, message.sandboxSessionId);
26209
- if (result === "source-export-failed") {
26215
+ if (result === "source-export-failed" || result === "carry-limit-exceeded") {
26210
26216
  await settleUnstarted();
26211
26217
  return { ok: false, sandboxTransferFailed: true };
26212
26218
  }
@@ -26800,7 +26806,7 @@ var EveHostDurableContainer = class extends DurableObject {
26800
26806
  await reader.cancel().catch(() => void 0);
26801
26807
  if (overflowed) {
26802
26808
  await discardWrittenChunks();
26803
- if (required2) throw new Error("The imported sandbox carry exceeds the archive limit.");
26809
+ if (required2) throw new EveSandboxCarryLimitError();
26804
26810
  console.error(
26805
26811
  `The Eve sandbox session carry exceeded ${EVE_HOST_CARRY_LIMITS.maxBytes} compressed bytes; keeping the previous carry.`
26806
26812
  );
@@ -27126,7 +27132,17 @@ var EveHostDurableContainer = class extends DurableObject {
27126
27132
  const errorText = publish.stderr === null ? "" : await new Response(publish.stderr).text();
27127
27133
  if (await publish.exitCode !== 0) throw new Error(`Sandbox import refused: ${errorText.trim()}; staging retained at ${stage}.`);
27128
27134
  await this.ctx.storage.delete(EVE_HOST_CONTAINER_SNAPSHOT_KEY);
27129
- await this.carrySandboxSessionsOut(runtime, true);
27135
+ try {
27136
+ await this.carrySandboxSessionsOut(runtime, true);
27137
+ } catch (error61) {
27138
+ if (error61 instanceof EveSandboxCarryLimitError) {
27139
+ console.error(
27140
+ `The imported sandbox session carry exceeded ${EVE_HOST_CARRY_LIMITS.maxBytes} compressed bytes; failing the sandbox transfer.`
27141
+ );
27142
+ return "carry-limit-exceeded";
27143
+ }
27144
+ throw error61;
27145
+ }
27130
27146
  await this.ctx.storage.put("eden.eve.host.has-imported-sandboxes", true);
27131
27147
  await this.ctx.storage.put(key, true);
27132
27148
  const cleanup = await runtime.exec(["rm", "-rf", stage], { stdout: "ignore", stderr: "ignore" });
@@ -12,7 +12,7 @@ interface EveQueueDeliveryClaim {
12
12
  readonly messageId: string;
13
13
  readonly attempt: number;
14
14
  }
15
- type EveSandboxImportResult = "source-export-failed" | undefined;
15
+ type EveSandboxImportResult = "source-export-failed" | "carry-limit-exceeded" | undefined;
16
16
  /** The deployment's single SQLite-backed Workflow World. */
17
17
  export declare class EdenWorldDurableObject extends DurableObject<EveHostContainerEnvironment> {
18
18
  private readonly core;
@@ -122,6 +122,17 @@ export const EVE_HOST_CARRY_LIMITS = {
122
122
  chunkBytes: 1024 * 1024,
123
123
  maxBytes: 1024 * 1024 * 1024,
124
124
  };
125
+ /**
126
+ * A required carry can never succeed while the sessions archive exceeds the
127
+ * carry cap, so the sandbox transfer must settle as terminally failed
128
+ * instead of retrying forever.
129
+ */
130
+ class EveSandboxCarryLimitError extends Error {
131
+ constructor() {
132
+ super("The imported sandbox carry exceeds the archive limit.");
133
+ this.name = "EveSandboxCarryLimitError";
134
+ }
135
+ }
125
136
  /** Snapshot attempts the alarm retries before destroying anyway so a stuck
126
137
  * snapshot path never keeps billing alive forever. */
127
138
  const EVE_HOST_SNAPSHOT_MAX_ATTEMPTS = 3;
@@ -181,7 +192,7 @@ export class EdenWorldDurableObject extends DurableObject {
181
192
  if (message.sourceDeploymentId && message.sourceDeploymentId !== deploymentId && message.sandboxSessionId) {
182
193
  try {
183
194
  const result = await target.importSandboxSessions(message.sourceDeploymentId, deploymentId, message.messageId, message.sandboxSessionId);
184
- if (result === "source-export-failed") {
195
+ if (result === "source-export-failed" || result === "carry-limit-exceeded") {
185
196
  await settleUnstarted();
186
197
  return { ok: false, sandboxTransferFailed: true };
187
198
  }
@@ -840,7 +851,7 @@ export class EveHostDurableContainer extends DurableObject {
840
851
  if (overflowed) {
841
852
  await discardWrittenChunks();
842
853
  if (required)
843
- throw new Error("The imported sandbox carry exceeds the archive limit.");
854
+ throw new EveSandboxCarryLimitError();
844
855
  console.error(`The Eve sandbox session carry exceeded ${EVE_HOST_CARRY_LIMITS.maxBytes} compressed bytes; keeping the previous carry.`);
845
856
  return;
846
857
  }
@@ -1193,7 +1204,19 @@ export class EveHostDurableContainer extends DurableObject {
1193
1204
  // Persist imports before acknowledging them, including crash recovery.
1194
1205
  // An older whole-container snapshot must not hide the refreshed carry.
1195
1206
  await this.ctx.storage.delete(EVE_HOST_CONTAINER_SNAPSHOT_KEY);
1196
- await this.carrySandboxSessionsOut(runtime, true);
1207
+ try {
1208
+ await this.carrySandboxSessionsOut(runtime, true);
1209
+ }
1210
+ catch (error) {
1211
+ // An archive over the carry cap can never succeed, so the transfer
1212
+ // must settle as terminally failed instead of retrying forever and
1213
+ // pinning the deployment busy.
1214
+ if (error instanceof EveSandboxCarryLimitError) {
1215
+ console.error(`The imported sandbox session carry exceeded ${EVE_HOST_CARRY_LIMITS.maxBytes} compressed bytes; failing the sandbox transfer.`);
1216
+ return "carry-limit-exceeded";
1217
+ }
1218
+ throw error;
1219
+ }
1197
1220
  await this.ctx.storage.put("eden.eve.host.has-imported-sandboxes", true);
1198
1221
  await this.ctx.storage.put(key, true);
1199
1222
  const cleanup = await runtime.exec(["rm", "-rf", stage], { stdout: "ignore", stderr: "ignore" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moinulmoin/eden-runtime-cloudflare",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Cloudflare Worker/Container host runtime for Eden's Eve deployments.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "NOTICE"
21
21
  ],
22
22
  "devDependencies": {
23
- "@moinulmoin/eden-world-cloudflare": "0.11.3",
23
+ "@moinulmoin/eden-world-cloudflare": "0.11.4",
24
24
  "@cloudflare/workers-types": "5.20261006.1"
25
25
  },
26
26
  "repository": {