From 2d915e8428ee3c6ae59aeeaf09d8eee19002331d Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 07:42:19 +0000 Subject: [PATCH] (janitor/dead-code): remove unused withSandbox helper in cloud-agent-next services/cloud-agent-next/src/helpers.ts is dead code. It exports a single function, `withSandbox`, that has zero call sites anywhere in the repo. Evidence of unreachability: - Repo-wide search for the symbol `withSandbox` matches only its own definition; the only similar symbol, `withSandboxOperationTimeoutLog` (sandbox-timeout-logging.ts), is unrelated and still in use. - The file is never imported, statically or dynamically, by any source, test, or script. The only `../helpers/...` import in the service resolves to `test/helpers/session-setup.ts`, a different path. - `src/index.ts` (the Worker entry point) does not re-export it, and no barrel re-exports it. Dynamic/configured entry points checked: - wrangler.jsonc `main` is `src/index.ts`; no Durable Object, queue, cron, migration, or RPC config references helpers.ts or `withSandbox`. - No `import()`, `require()`, `export * from`, or side-effect import points at the file. - The file has no module-level side effects (only imports plus one async function declaration), so removal changes no initialization behavior. - Kilo-Org/kilocode (the external API consumer) contains no reference to `withSandbox`; cloud-agent-next is not consumed by import from any app. Contract/compatibility: `withSandbox` is not part of any published package, tRPC route, or Durable Object RPC surface, and no persisted data or migration references it. Validation: cloud-agent-next typecheck (`tsgo --noEmit`), oxlint (0 warnings, 0 errors), and vitest unit suite (3306 passed / 3 skipped) all pass after removal. Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com> --- services/cloud-agent-next/src/helpers.ts | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 services/cloud-agent-next/src/helpers.ts diff --git a/services/cloud-agent-next/src/helpers.ts b/services/cloud-agent-next/src/helpers.ts deleted file mode 100644 index 0c24708936..0000000000 --- a/services/cloud-agent-next/src/helpers.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { getSandbox } from '@cloudflare/sandbox'; -import type { TRPCContext } from './types.js'; -import { getSandboxNamespace } from './sandbox-id.js'; - -/** - * Sets up a sandbox instance and invokes a callback. - * Simplifies sandbox initialization by encapsulating the setup logic. - * @param ctx The TRPC context containing environment - * @param sandboxId The sandbox identifier for sandbox isolation - * @param fn Async callback that receives the configured sandbox instance - * @returns The result of the callback function - */ -export async function withSandbox( - ctx: TRPCContext, - sandboxId: string, - fn: (sandbox: ReturnType) => Promise -): Promise { - const sandbox = getSandbox(getSandboxNamespace(ctx.env, sandboxId), sandboxId); - return await fn(sandbox); -}