Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nemoclaw/src/commands/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -55,6 +56,16 @@ export async function cliEject(opts: EjectOptions): Promise<void> {
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);
Expand Down