diff --git a/nemoclaw/src/commands/eject.ts b/nemoclaw/src/commands/eject.ts index cfd34281ba4..4b61b65d44b 100644 --- a/nemoclaw/src/commands/eject.ts +++ b/nemoclaw/src/commands/eject.ts @@ -3,6 +3,7 @@ import { existsSync } from "node:fs"; import { join } from "node:path"; +import { execSync } from "node:child_process"; import type { PluginLogger, NemoClawConfig } from "../index.js"; import { execBlueprint } from "../blueprint/exec.js"; import { loadState, clearState } from "../blueprint/state.js"; @@ -55,6 +56,16 @@ export async function cliEject(opts: EjectOptions): Promise { return; } + // Step 0: Ensure sandbox is stopped before restoration + if (state.sandboxName) { + logger.info(`Ensuring sandbox '${state.sandboxName}' is stopped...`); + try { + execSync(`openshell sandbox stop ${state.sandboxName}`, { stdio: "ignore" }); + } catch { + // Best effort — sandbox might already be stopped + } + } + // Step 1: Rollback blueprint if (state.lastRunId && state.blueprintVersion) { const blueprintPath = join(HOME, ".nemoclaw", "blueprints", state.blueprintVersion);