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