the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Delete sandboxPorts for stale sandboxes

+9 -1
+9 -1
apps/sandbox/src/clean.ts
··· 1 - import { and, isNull, lt } from "drizzle-orm"; 1 + import { and, inArray, isNull, lt } from "drizzle-orm"; 2 2 import { getConnection } from "./drizzle.ts"; 3 3 import sandboxes from "./schema/sandboxes.ts"; 4 + import sandboxPorts from "./schema/sandbox-ports.ts"; 4 5 import consola from "consola"; 5 6 import chalk from "chalk"; 6 7 import { workers } from "./workers.ts"; ··· 69 70 "Failed to stop some uninitialized sandboxes on workers. They may have already been stopped or deleted.", 70 71 ); 71 72 }); 73 + 74 + const staleIds = stale.map(({ id }) => id); 75 + 76 + await db 77 + .delete(sandboxPorts) 78 + .where(inArray(sandboxPorts.sandboxId, staleIds)) 79 + .execute(); 72 80 73 81 const deleted = await db 74 82 .delete(sandboxes)