From 8250587a664cc4ce62f797b64f8cd8d90c39ebbf Mon Sep 17 00:00:00 2001 From: Brian Reardon Date: Thu, 20 Nov 2025 09:49:41 -0800 Subject: [PATCH 1/2] change e2b template version --- sandbox-sidecar/src/templateRegistry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox-sidecar/src/templateRegistry.ts b/sandbox-sidecar/src/templateRegistry.ts index 9c23c63a8..ae0760aea 100644 --- a/sandbox-sidecar/src/templateRegistry.ts +++ b/sandbox-sidecar/src/templateRegistry.ts @@ -8,7 +8,7 @@ export interface TemplateInfo { } // Template version - bump this when the build recipe changes -const TEMPLATE_VERSION = "0.1.1"; +const TEMPLATE_VERSION = "0.1.2"; // Generate alias matching the build system function aliasFor(engine: string, version: string, tplVersion: string): string { From d53a6b0e6e7e64c15bb73850a2439715c84299a9 Mon Sep 17 00:00:00 2001 From: Brian Reardon Date: Thu, 20 Nov 2025 11:53:19 -0800 Subject: [PATCH 2/2] add buffer pooling fix, feature flag --- sandbox-sidecar/src/runners/e2bRunner.ts | 10 +++++++++- ui/src/components/UnitCreateForm.tsx | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sandbox-sidecar/src/runners/e2bRunner.ts b/sandbox-sidecar/src/runners/e2bRunner.ts index cb163b0fd..3b7d30ae4 100644 --- a/sandbox-sidecar/src/runners/e2bRunner.ts +++ b/sandbox-sidecar/src/runners/e2bRunner.ts @@ -207,7 +207,15 @@ export class E2BSandboxRunner implements SandboxRunner { // Write the config archive const archivePath = `${workDir}/bundle.tar.gz`; const archiveBuffer = Buffer.from(job.payload.configArchive, "base64"); - await sandbox.files.write(archivePath, archiveBuffer.buffer); + + // IMPORTANT: Extract exact-sized ArrayBuffer to avoid writing extra padding bytes + // archiveBuffer.buffer can include unused bytes if the Buffer is a slice/view of a larger ArrayBuffer + // This was causing intermittent "gzip: invalid header" errors + const exactBuffer = archiveBuffer.buffer.slice( + archiveBuffer.byteOffset, + archiveBuffer.byteOffset + archiveBuffer.byteLength + ); + await sandbox.files.write(archivePath, exactBuffer); // Extract the archive (excluding any existing state files to avoid conflicts) // Use gunzip + tar separately for better compatibility across tar versions diff --git a/ui/src/components/UnitCreateForm.tsx b/ui/src/components/UnitCreateForm.tsx index 4d6b9dbc8..d49369b7f 100644 --- a/ui/src/components/UnitCreateForm.tsx +++ b/ui/src/components/UnitCreateForm.tsx @@ -35,8 +35,9 @@ export default function UnitCreateForm({ const [isCreating, setIsCreating] = React.useState(false) const [error, setError] = React.useState(null) - // Remote runs beta is now always enabled - const remoteRunsEnabled = true + // Remote runs are gated by localStorage flag for beta testing + // Set localStorage.setItem('REMOTE_RUNS', 'true') to enable + const remoteRunsEnabled = typeof window !== 'undefined' && localStorage.getItem('REMOTE_RUNS') === 'true' const handleCreate = async () => { if (!unitName.trim()) return