Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Allow ten minutes for Modal home snapshots (#1402)

Regan Belld61d7bb10ee7
diff --git a/src/sandbox/modal-client.ts b/src/sandbox/modal-client.ts
index a617257b4..5c4136e42 100644
--- a/src/sandbox/modal-client.ts
+++ b/src/sandbox/modal-client.ts
@@ -168,7 +168,7 @@ export function createSdkModalClient(opts: SdkModalClientOptions): ModalClient {
},
async snapshotHome() {
const expiresAtMs = Date.now() + snapshotRetentionMs;
- const image = await sbx.snapshotDirectory("/root", { ttlMs: snapshotRetentionMs });
+ const image = await sbx.snapshotDirectory("/root", { ttlMs: snapshotRetentionMs, timeoutMs: 600_000 });
return { imageId: image.imageId, expiresAtMs };
},
async restoreHome(imageId): Promise<void> {
diff --git a/test/native-provider-clients.test.ts b/test/native-provider-clients.test.ts
index 8bd9e78ae..d03d7b5a9 100644
--- a/test/native-provider-clients.test.ts
+++ b/test/native-provider-clients.test.ts
@@ -48,7 +48,7 @@ mock.module("e2b", {
},
});
-test("Modal native directory snapshot uses explicit finite retention and restores the exact image", async () => {
+test("Modal native directory snapshot has a ten-minute timeout, finite retention, and restores the exact image", async () => {
const client = createSdkModalClient({
tokenId: "id",
tokenSecret: "secret",
@@ -59,7 +59,7 @@ test("Modal native directory snapshot uses explicit finite retention and restore
const session = await client.create({ name: "test" });
const before = Date.now();
const snapshot = await session.snapshotHome!();
- assert.deepEqual(modalCalls[0], ["snapshot", "/root", { ttlMs: 60_000 }]);
+ assert.deepEqual(modalCalls[0], ["snapshot", "/root", { ttlMs: 60_000, timeoutMs: 600_000 }]);
assert.ok(snapshot.expiresAtMs >= before + 60_000);
await session.restoreHome!(snapshot.imageId);
assert.deepEqual(modalCalls[1], ["mount", "/root", { imageId: "im-native" }]);