fix(sandbox): recreate orphaned microVMs with --replace

A session VM create that fails partway leaves an orphaned msb sandbox that msb ls omits but every later create rejects as already existing, so the session could never get a VM again. Retry the create once with --replace when msb reports the name already exists.
This commit is contained in:
Chris Scott committed 2026-10-15 16:53:49 -04:00
1 parent 052218d5d6
commit 27c673d830
4 files changed
+123 -6

No files matched your search

+2 -1
View File
@@ -214,7 +214,7 @@ function parseSandboxNamedMountSpec(spec: string): { name: string; guest: string
return { name, guest }
}
export function buildSandboxCreateArgs(spec: SandboxVmSpec): string[] {
export function buildSandboxCreateArgs(spec: SandboxVmSpec, options: { replace?: boolean } = {}): string[] {
const tmpfsSizeMib = resolveSandboxRuntimeTmpfsSizeMib(spec.memoryMib)
if (tmpfsSizeMib === null) throw new Error('sandbox memory must be positive to size the runtime tmpfs')
const workdir = spec.projectMounts[0]
@@ -222,6 +222,7 @@ export function buildSandboxCreateArgs(spec: SandboxVmSpec): string[] {
return [
'run',
'-d',
...(options.replace === true ? ['--replace'] : []),
'--name',
spec.name,
'--label',