fix: sync OpenClaw 2026.9.1 lifecycle (#50)
Co-authored-by: mmckeen-nv <mmckeen-nv@users.noreply.github.com>
This commit is contained in:
@@ -49,7 +49,7 @@ This dashboard is validated against the current NVIDIA NemoClaw repo and the Ope
|
||||
|
||||
- OpenShell installer release: `v0.0.116` (`OPENSHELL_VERSION=v0.0.116`)
|
||||
- NemoClaw source ref: `main` (`NEMOCLAW_INSTALL_REF=main`)
|
||||
- OpenClaw base-image build target: `2026.7.1` (`OPENCLAW_VERSION=2026.7.1`) unless overridden
|
||||
- OpenClaw base-image build target: `2026.9.1` (`OPENCLAW_VERSION=2026.9.1`) unless overridden
|
||||
|
||||
Runtime/toolchain versions used during development:
|
||||
|
||||
@@ -100,7 +100,7 @@ Install or refresh the locked OpenShell/NemoClaw pair first:
|
||||
./install_versioned_nemoclaw_openshell.sh
|
||||
```
|
||||
|
||||
That helper defaults to `OPENSHELL_VERSION=v0.0.116`, `NEMOCLAW_INSTALL_REF=main`, and `OPENCLAW_VERSION=2026.7.1`.
|
||||
That helper defaults to `OPENSHELL_VERSION=v0.0.116`, `NEMOCLAW_INSTALL_REF=main`, and `OPENCLAW_VERSION=2026.9.1`.
|
||||
|
||||
Then install the dashboard from the repository root:
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import path from "node:path"
|
||||
import { promisify } from "node:util"
|
||||
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
||||
import { recordActivity } from "@/app/lib/activityLog"
|
||||
import { repairOpenClawExecApprovalsFile } from "@/app/lib/sandboxPrivilegedFiles"
|
||||
import {
|
||||
findNemoClawRegistryEntry,
|
||||
listNemoClawRegistryCandidates,
|
||||
@@ -814,11 +813,6 @@ export async function POST(request: Request) {
|
||||
error: "Sandbox readiness polling produced no verification result.",
|
||||
}
|
||||
const created = readiness.verified
|
||||
const execApprovalsRepair = created && isOpenClawAgent ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
||||
error: error instanceof Error ? error.message : "Failed to repair OpenClaw exec approvals file",
|
||||
})) : null
|
||||
const deviceApproval = created && isOpenClawAgent ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||
console.log(
|
||||
`[sandbox/create] request:complete sandbox=${sandboxName} created=${created} agent=${agent} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`,
|
||||
@@ -852,7 +846,6 @@ export async function POST(request: Request) {
|
||||
attempts: readiness.attempts,
|
||||
elapsedMs: readiness.elapsedMs,
|
||||
},
|
||||
execApprovalsRepair,
|
||||
deviceApproval,
|
||||
stdout: result.stdout,
|
||||
stderr: result.stderr,
|
||||
@@ -868,8 +861,6 @@ export async function POST(request: Request) {
|
||||
: gpuMode === "required"
|
||||
? "GPU passthrough was required for this create run."
|
||||
: "NemoClaw chose GPU passthrough automatically for this create run.",
|
||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
||||
deviceApproval?.note,
|
||||
)
|
||||
: "Blueprint command reported success, but the sandbox never reached a ready verification state afterward.",
|
||||
@@ -911,11 +902,6 @@ export async function POST(request: Request) {
|
||||
error: "Sandbox readiness polling produced no verification result.",
|
||||
}
|
||||
const created = readiness.verified
|
||||
const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
||||
error: error instanceof Error ? error.message : "Failed to repair OpenClaw exec approvals file",
|
||||
})) : null
|
||||
const deviceApproval = created ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||
const policyPrepared = Boolean(policy)
|
||||
console.log(
|
||||
@@ -953,7 +939,6 @@ export async function POST(request: Request) {
|
||||
attempts: readiness.attempts,
|
||||
elapsedMs: readiness.elapsedMs,
|
||||
},
|
||||
execApprovalsRepair,
|
||||
deviceApproval,
|
||||
policyPrepared,
|
||||
note: created
|
||||
@@ -966,8 +951,6 @@ export async function POST(request: Request) {
|
||||
gpuMode === "required"
|
||||
? "GPU passthrough was requested for this create run."
|
||||
: false,
|
||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
||||
deviceApproval?.note,
|
||||
)
|
||||
: "Create command started, but the sandbox never reached a ready verification state afterward.",
|
||||
@@ -1013,11 +996,6 @@ export async function POST(request: Request) {
|
||||
}
|
||||
const created = readiness.verified
|
||||
const registry = created ? skippedNemoClawImageRedeployRegistration() : null
|
||||
const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
||||
error: error instanceof Error ? error.message : "Failed to repair OpenClaw exec approvals file",
|
||||
})) : null
|
||||
const deviceApproval = created ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||
console.log(
|
||||
`[sandbox/create] request:complete sandbox=${sandboxName} created=${created} mode=redeploy-image createTimedOut=${createAttempt.timedOut} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`,
|
||||
@@ -1064,7 +1042,6 @@ export async function POST(request: Request) {
|
||||
elapsedMs: readiness.elapsedMs,
|
||||
},
|
||||
registry,
|
||||
execApprovalsRepair,
|
||||
deviceApproval,
|
||||
note: created
|
||||
? appendNote(
|
||||
@@ -1079,8 +1056,6 @@ export async function POST(request: Request) {
|
||||
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
|
||||
: false,
|
||||
registry?.note,
|
||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
||||
deviceApproval?.note,
|
||||
)
|
||||
: createFailed
|
||||
|
||||
@@ -2,6 +2,7 @@ import { execFile, spawn } from "node:child_process"
|
||||
import { promisify } from "node:util"
|
||||
import { HOST_PATH, OPENCLAW_BIN, OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||
import { getDefaultOpenClawInstance, getOpenClawDashboardPortForSandbox, resolveOpenClawInstance } from "./openclawInstances"
|
||||
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
||||
@@ -421,13 +422,13 @@ async function execSandboxSsh(sandboxName: string, command: string, timeoutMs =
|
||||
}
|
||||
|
||||
async function ensureRemoteSandboxOpenClawDashboard(sandboxName: string) {
|
||||
const command = [
|
||||
`curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null 2>&1`,
|
||||
"||",
|
||||
`(nohup /usr/local/bin/openclaw gateway run --allow-unconfigured --bind loopback --port ${SANDBOX_DASHBOARD_REMOTE_PORT} >/tmp/gateway.log 2>&1 &)`
|
||||
].join(" ")
|
||||
|
||||
await execSandboxSsh(sandboxName, command).catch(() => null)
|
||||
try {
|
||||
await execSandboxSsh(sandboxName, `curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null`, 5000)
|
||||
return true
|
||||
} catch {
|
||||
const restart = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||
if (!restart.ok) return false
|
||||
}
|
||||
|
||||
for (let attempt = 0; attempt < 16; attempt += 1) {
|
||||
try {
|
||||
@@ -448,7 +449,7 @@ async function ensureSandboxOpenClawDashboardTunnel(sandboxName: string) {
|
||||
const initial = await inspectListeningPort(port)
|
||||
if (initial.listenerPresent) return initial
|
||||
|
||||
await ensureRemoteSandboxOpenClawDashboard(sandboxName)
|
||||
if (!await ensureRemoteSandboxOpenClawDashboard(sandboxName)) return initial
|
||||
|
||||
const child = spawn("ssh", buildSandboxSshArgs(sandboxName, [
|
||||
"-N",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { execFile, spawn } from "node:child_process"
|
||||
import { promisify } from "node:util"
|
||||
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||
import { getSandboxInferenceConfig, type SandboxInferenceRoute } from "./sandboxInferenceStore"
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
@@ -199,11 +200,6 @@ async function writeOpenClawConfig(sandboxName: string, config: any) {
|
||||
return result
|
||||
}
|
||||
|
||||
async function restartOpenClawGatewayIfRunning(sandboxName: string) {
|
||||
const script = "for p in /proc/[0-9]*; do cmd=$(tr '\\0' ' ' < \"$p/cmdline\" 2>/dev/null || true); case \"$cmd\" in *'openclaw gateway'*) kill \"${p##*/}\" 2>/dev/null || true;; esac; done"
|
||||
return await runOpenShellExec(sandboxName, script)
|
||||
}
|
||||
|
||||
export async function applySandboxInferenceProfile(sandboxId: string, sandboxName: string) {
|
||||
const config = await getSandboxInferenceConfig(sandboxId)
|
||||
const enabledRoutes = config.routes.filter((route) => route.enabled)
|
||||
@@ -213,12 +209,18 @@ export async function applySandboxInferenceProfile(sandboxId: string, sandboxNam
|
||||
const currentOpenClawConfig = await readCurrentOpenClawConfig(sandboxName)
|
||||
const nextOpenClawConfig = buildOpenClawConfig(currentOpenClawConfig, enabledRoutes, primary)
|
||||
await writeOpenClawConfig(sandboxName, nextOpenClawConfig)
|
||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
||||
|
||||
const routeResult = await runOpenShell(["inference", "set", "--no-verify", "--provider", primary.provider, "--model", primary.model])
|
||||
const restartResult = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||
if (!restartResult.ok) {
|
||||
throw new Error(
|
||||
restartResult.stderr || restartResult.error ||
|
||||
"NemoClaw could not verify the native agent gateway restart after applying inference config",
|
||||
)
|
||||
}
|
||||
return {
|
||||
primaryRoute: primary,
|
||||
routesApplied: enabledRoutes.length,
|
||||
gatewayRoute: routeResult,
|
||||
gatewayRestart: "nemoclaw-native-gateway",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
syncSandboxOpenClawMcpConfig,
|
||||
revokeSandboxOpenClawMcpConfig,
|
||||
} from "./sandboxOpenClawMcpConfig"
|
||||
import { repairOpenClawExecApprovalsFile, writeSandboxFilePrivileged } from "./sandboxPrivilegedFiles"
|
||||
import { writeSandboxFilePrivileged } from "./sandboxPrivilegedFiles"
|
||||
|
||||
export const SANDBOX_MCP_MANIFEST_PATH = "/sandbox/openshell_control_mcp.md"
|
||||
|
||||
@@ -112,8 +112,6 @@ export async function syncSandboxMcpManifest(
|
||||
options.brokerBaseUrl,
|
||||
handoff.token,
|
||||
)
|
||||
const execApprovals = await repairOpenClawExecApprovalsFile(sandboxName)
|
||||
|
||||
return {
|
||||
path: uploaded.path,
|
||||
sandboxName: uploaded.sandboxName,
|
||||
@@ -126,7 +124,6 @@ export async function syncSandboxMcpManifest(
|
||||
expiresAt: handoff.session.expiresAt,
|
||||
},
|
||||
openClaw,
|
||||
execApprovals,
|
||||
markdown: handoff.markdown,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { spawn } from "node:child_process"
|
||||
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||
|
||||
export const OPENSHELL_CONTROL_MCP_SERVER_NAME = "openshell-control"
|
||||
export const OPENCLAW_CONFIG_PATH = "/sandbox/.openclaw/openclaw.json"
|
||||
@@ -61,9 +62,14 @@ async function writeOpenClawConfig(sandboxName: string, config: Record<string, u
|
||||
if (result.code !== 0) throw new Error(result.stderr || "Failed to write OpenClaw MCP config")
|
||||
}
|
||||
|
||||
async function restartOpenClawGatewayIfRunning(sandboxName: string) {
|
||||
const script = "for p in /proc/[0-9]*; do cmd=$(tr '\\0' ' ' < \"$p/cmdline\" 2>/dev/null || true); case \"$cmd\" in *'openclaw gateway'*) kill \"${p##*/}\" 2>/dev/null || true;; esac; done"
|
||||
await runSandboxShell(sandboxName, script)
|
||||
async function restartNativeGateway(sandboxName: string) {
|
||||
const result = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||
if (!result.ok) {
|
||||
throw new Error(
|
||||
result.stderr || result.error ||
|
||||
"NemoClaw could not verify the native agent gateway restart after updating MCP config",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function buildOpenClawMcpServerConfig(brokerBaseUrl: string, token: string) {
|
||||
@@ -94,7 +100,7 @@ export async function syncSandboxOpenClawMcpConfig(
|
||||
...current,
|
||||
mcp,
|
||||
})
|
||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
||||
await restartNativeGateway(sandboxName)
|
||||
|
||||
return {
|
||||
path: OPENCLAW_CONFIG_PATH,
|
||||
@@ -121,7 +127,7 @@ export async function revokeSandboxOpenClawMcpConfig(sandboxName: string) {
|
||||
}
|
||||
|
||||
await writeOpenClawConfig(sandboxName, nextConfig)
|
||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
||||
await restartNativeGateway(sandboxName)
|
||||
|
||||
return {
|
||||
path: OPENCLAW_CONFIG_PATH,
|
||||
|
||||
@@ -51,107 +51,3 @@ export async function writeSandboxFilePrivileged(
|
||||
bytes: payload.byteLength,
|
||||
}
|
||||
}
|
||||
|
||||
export async function repairOpenClawExecApprovalsFile(sandboxName: string) {
|
||||
const normalizeScript = [
|
||||
`const fs = require("fs")`,
|
||||
`const approval = "/sandbox/.openclaw/exec-approvals.json"`,
|
||||
`const tmp = process.argv[1]`,
|
||||
`let source = ""`,
|
||||
`try { source = fs.readFileSync(approval, "utf8") } catch {}`,
|
||||
`const trimmed = source.trim()`,
|
||||
`let payload = "{}\\n"`,
|
||||
`if (trimmed) { try { payload = JSON.stringify(JSON.parse(trimmed), null, 2) + "\\n" } catch {} }`,
|
||||
`fs.writeFileSync(tmp, payload)`,
|
||||
].join("; ")
|
||||
const script = [
|
||||
`mkdir -p /sandbox/.openclaw`,
|
||||
`tmp="/sandbox/.openclaw/.exec-approvals.json.$$"`,
|
||||
`node -e ${shellQuote(normalizeScript)} "$tmp"`,
|
||||
`rm -f /sandbox/.openclaw/exec-approvals.json`,
|
||||
`mv "$tmp" /sandbox/.openclaw/exec-approvals.json`,
|
||||
`chown sandbox:sandbox /sandbox/.openclaw/exec-approvals.json 2>/dev/null || chown 998:998 /sandbox/.openclaw/exec-approvals.json`,
|
||||
`chmod 0600 /sandbox/.openclaw/exec-approvals.json`,
|
||||
].join(" && ")
|
||||
const result = await runSandboxShell(sandboxName, script)
|
||||
if (result.code !== 0) throw new Error(result.stderr || "failed to repair OpenClaw exec approvals file")
|
||||
return {
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
||||
note: "Replaced OpenClaw exec approvals symlink with a real sandbox-owned file for newer OpenClaw versions.",
|
||||
}
|
||||
}
|
||||
|
||||
export async function stabilizeOpenClawGatewayConfig(sandboxName: string) {
|
||||
const patchConfig = [
|
||||
`const fs = require("fs")`,
|
||||
`const path = "/sandbox/.openclaw/openclaw.json"`,
|
||||
`const cfg = JSON.parse(fs.readFileSync(path, "utf8"))`,
|
||||
`cfg.plugins = cfg.plugins && typeof cfg.plugins === "object" && !Array.isArray(cfg.plugins) ? cfg.plugins : {}`,
|
||||
`cfg.plugins.entries = cfg.plugins.entries && typeof cfg.plugins.entries === "object" && !Array.isArray(cfg.plugins.entries) ? cfg.plugins.entries : {}`,
|
||||
`cfg.plugins.entries.bonjour = { ...(cfg.plugins.entries.bonjour || {}), enabled: false }`,
|
||||
`fs.writeFileSync(path, JSON.stringify(cfg, null, 2) + "\\n")`,
|
||||
].join("; ")
|
||||
const script = [
|
||||
`node -e ${shellQuote(patchConfig)}`,
|
||||
`chmod 444 /sandbox/.openclaw/openclaw.json`,
|
||||
`chown root:root /sandbox/.openclaw/openclaw.json`,
|
||||
`(cd /sandbox/.openclaw && sha256sum openclaw.json > .config-hash)`,
|
||||
`chmod 444 /sandbox/.openclaw/.config-hash`,
|
||||
`chown root:root /sandbox/.openclaw/.config-hash`,
|
||||
`mkdir -p /sandbox/.openclaw-data/logs`,
|
||||
`chown -R sandbox:sandbox /sandbox/.openclaw-data/logs 2>/dev/null || chown -R 998:998 /sandbox/.openclaw-data/logs`,
|
||||
`openclaw gateway stop >/dev/null 2>&1 || true`,
|
||||
`if command -v gosu >/dev/null 2>&1; then nohup gosu sandbox openclaw gateway run >/sandbox/.openclaw-data/logs/gateway.log 2>&1 & else nohup openclaw gateway run >/sandbox/.openclaw-data/logs/gateway.log 2>&1 & fi`,
|
||||
].join(" && ")
|
||||
const result = await runSandboxShell(sandboxName, script)
|
||||
if (result.code !== 0) throw new Error(result.stderr || "failed to stabilize OpenClaw gateway config")
|
||||
return {
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw/openclaw.json",
|
||||
note: "Disabled the Bonjour gateway discovery plugin inside the sandbox because it crashes under the OpenShell network namespace.",
|
||||
}
|
||||
}
|
||||
|
||||
export async function repairOpenClawWorkspacePermissions(sandboxName: string) {
|
||||
const mutableDirs = [
|
||||
"agents",
|
||||
"extensions",
|
||||
"workspace",
|
||||
"skills",
|
||||
"hooks",
|
||||
"identity",
|
||||
"devices",
|
||||
"canvas",
|
||||
"cron",
|
||||
"memory",
|
||||
"logs",
|
||||
"credentials",
|
||||
"flows",
|
||||
"sandbox",
|
||||
"telegram",
|
||||
"plugin-runtime-deps",
|
||||
]
|
||||
const mutableFiles = [
|
||||
"update-check.json",
|
||||
]
|
||||
const script = [
|
||||
`mkdir -p /sandbox/.openclaw /sandbox/.openclaw-data/agents/main/agent`,
|
||||
`for dir in ${mutableDirs.map(shellQuote).join(" ")}; do target="/sandbox/.openclaw-data/$dir"; link="/sandbox/.openclaw/$dir"; mkdir -p "$target"; if [ -d "$link" ] && [ ! -L "$link" ]; then cp -a "$link/." "$target/" 2>/dev/null || true; rm -rf "$link"; fi; ln -sfn "$target" "$link"; done`,
|
||||
`for file in ${mutableFiles.map(shellQuote).join(" ")}; do target="/sandbox/.openclaw-data/$file"; link="/sandbox/.openclaw/$file"; if [ ! -e "$target" ]; then if [ -f "$link" ] && [ ! -L "$link" ]; then cp "$link" "$target" 2>/dev/null || : > "$target"; else : > "$target"; fi; fi; if [ -e "$link" ] && [ ! -L "$link" ]; then rm -f "$link"; fi; ln -sfn "$target" "$link"; done`,
|
||||
`approval="/sandbox/.openclaw/exec-approvals.json"; approval_data="/sandbox/.openclaw-data/exec-approvals.json"; tmp="/sandbox/.openclaw/.exec-approvals.reconcile.$$"; if [ -L "$approval" ]; then if [ -s "$approval_data" ]; then cp "$approval_data" "$tmp" 2>/dev/null || : > "$tmp"; else : > "$tmp"; fi; rm -f "$approval"; mv "$tmp" "$approval"; elif [ ! -e "$approval" ]; then : > "$approval"; fi`,
|
||||
`chown -R sandbox:sandbox /sandbox/.openclaw-data 2>/dev/null || chown -R 998:998 /sandbox/.openclaw-data`,
|
||||
`chown sandbox:sandbox /sandbox/.openclaw /sandbox/.openclaw/exec-approvals.json 2>/dev/null || chown 998:998 /sandbox/.openclaw /sandbox/.openclaw/exec-approvals.json`,
|
||||
`chmod 0755 /sandbox/.openclaw && chmod 0600 /sandbox/.openclaw/exec-approvals.json`,
|
||||
].join(" && ")
|
||||
const result = await runSandboxShell(sandboxName, script)
|
||||
if (result.code !== 0) throw new Error(result.stderr || "failed to repair OpenClaw mutable paths")
|
||||
return {
|
||||
sandboxName,
|
||||
path: "/sandbox/.openclaw",
|
||||
target: "/sandbox/.openclaw-data",
|
||||
mutableDirs,
|
||||
mutableFiles,
|
||||
note: "Reconciled the OpenClaw directory layout for NemoClaw: mutable state paths, AGENTS.md, session locks, update-check state, plugin runtime deps, and exec approvals are writable where the bundled OpenClaw expects them.",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ OPENSHELL_VERSION="${OPENSHELL_VERSION:-v0.0.116}"
|
||||
OPENSHELL_INSTALL_URL="${OPENSHELL_INSTALL_URL:-https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh}"
|
||||
NEMOCLAW_INSTALL_REF="${NEMOCLAW_INSTALL_REF:-${NEMOCLAW_INSTALL_TAG:-main}}"
|
||||
NEMOCLAW_SOURCE_URL="${NEMOCLAW_SOURCE_URL:-https://github.com/NVIDIA/NemoClaw.git}"
|
||||
OPENCLAW_VERSION="${OPENCLAW_VERSION:-2026.7.1}"
|
||||
OPENCLAW_VERSION="${OPENCLAW_VERSION:-2026.9.1}"
|
||||
NEMOCLAW_BASE_IMAGE="${NEMOCLAW_BASE_IMAGE:-ghcr.io/nvidia/nemoclaw/sandbox-base:latest}"
|
||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-1}"
|
||||
NEMOCLAW_NON_INTERACTIVE="${NEMOCLAW_NON_INTERACTIVE:-1}"
|
||||
|
||||
@@ -28,6 +28,13 @@ const OPENSHELL_BIN = firstExisting([
|
||||
"/usr/local/bin/openshell",
|
||||
"/opt/homebrew/bin/openshell",
|
||||
], "openshell")
|
||||
const NEMOCLAW_BIN = firstExisting([
|
||||
process.env.NEMOCLAW_BIN,
|
||||
path.join(os.homedir(), ".local/bin/nemoclaw"),
|
||||
path.join(os.homedir(), ".nemoclaw/source/bin/nemoclaw.js"),
|
||||
"/usr/local/bin/nemoclaw",
|
||||
"/opt/homebrew/bin/nemoclaw",
|
||||
], "nemoclaw")
|
||||
|
||||
function cleanText(value, fallback = "") {
|
||||
return String(value ?? fallback).trim()
|
||||
@@ -102,12 +109,17 @@ async function waitForPort(port, timeoutMs = 8000) {
|
||||
}
|
||||
|
||||
async function ensureRemoteDashboard(sandboxName) {
|
||||
const command = [
|
||||
`curl -fsS --max-time 2 http://127.0.0.1:${REMOTE_DASHBOARD_PORT}/ >/dev/null 2>&1`,
|
||||
"||",
|
||||
`(nohup /usr/local/bin/openclaw gateway run --allow-unconfigured --bind loopback --port ${REMOTE_DASHBOARD_PORT} >/tmp/gateway.log 2>&1 &)`,
|
||||
].join(" ")
|
||||
await execSandboxSsh(sandboxName, command, 15000).catch(() => null)
|
||||
try {
|
||||
await execSandboxSsh(sandboxName, `curl -fsS --max-time 2 http://127.0.0.1:${REMOTE_DASHBOARD_PORT}/ >/dev/null`, 5000)
|
||||
return true
|
||||
} catch {
|
||||
await execFileAsync(NEMOCLAW_BIN, ["sandbox", "gateway", "restart", sandboxName], {
|
||||
timeout: 90000,
|
||||
maxBuffer: 8 * 1024 * 1024,
|
||||
env: process.env,
|
||||
})
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
async function ensureDashboardTunnel(sandboxName, port) {
|
||||
|
||||
@@ -140,6 +140,8 @@ assert.match(interSandboxChatOpenClawDispatchSource, /WebSocket/, 'Inter-Sandbox
|
||||
assert.match(interSandboxChatOpenClawDispatchSource, /openclaw\.json/, 'Inter-Sandbox Chat OpenClaw dispatch must read the sandbox gateway token from OpenClaw config')
|
||||
assert.match(interSandboxChatOpenClawDispatchSource, /ssh-proxy/, 'Inter-Sandbox Chat OpenClaw dispatch must route through the OpenShell sandbox SSH proxy')
|
||||
assert.match(interSandboxChatOpenClawDispatchSource, /OPENCLAW_SANDBOX_DASHBOARD_PORT_BASE/, 'Inter-Sandbox Chat OpenClaw dispatch must share controller sandbox dashboard port mapping')
|
||||
assert.match(interSandboxChatOpenClawDispatchSource, /NEMOCLAW_BIN[\s\S]*\["sandbox", "gateway", "restart", sandboxName\]/, 'Inter-Sandbox Chat dashboard recovery must use NemoClaw native agent lifecycle')
|
||||
assert.doesNotMatch(interSandboxChatOpenClawDispatchSource, /\/usr\/local\/bin\/openclaw gateway run/, 'Inter-Sandbox Chat must not manually launch OpenClaw in a managed sandbox')
|
||||
assert.match(serverSource, /inter-sandbox-chat-sidecar\.mjs/, 'OpenShell controller must start the Inter-Sandbox Chat sidecar with the server')
|
||||
assert.match(serverSource, /INTER_SANDBOX_CHAT_SIDECAR_AUTOSTART/, 'OpenShell controller must let operators disable the chat sidecar autostart')
|
||||
assert.match(brokerProtocolSource, /tools\/list/, 'MCP broker protocol adapter must expose an MCP tools/list JSON-RPC method')
|
||||
@@ -187,7 +189,8 @@ assert.match(brokerUrlSource, /FALLBACK_SANDBOX_PROXY_ORIGIN/, 'Sandbox MCP brok
|
||||
assert.match(sandboxOpenClawMcpConfigSource, /mcp\.servers = servers/, 'Sandbox MCP sync must write mcp.servers into OpenClaw config')
|
||||
assert.match(sandboxOpenClawMcpConfigSource, /streamable-http/, 'OpenClaw MCP broker config must use streamable HTTP transport')
|
||||
assert.match(sandboxOpenClawMcpConfigSource, /Authorization: `Bearer \$\{token\}`/, 'OpenClaw MCP broker config must pass the sandbox broker token as bearer auth')
|
||||
assert.match(sandboxOpenClawMcpConfigSource, /restartOpenClawGatewayIfRunning/, 'OpenClaw gateway must restart after MCP config changes')
|
||||
assert.match(sandboxOpenClawMcpConfigSource, /restartSandboxGatewayWithNemoClaw/, 'MCP config changes must restart through NemoClaw native agent lifecycle')
|
||||
assert.doesNotMatch(sandboxOpenClawMcpConfigSource, /\/proc\/[[]0-9[]][*]|openclaw gateway run/, 'MCP config changes must not kill or launch OpenClaw processes outside NemoClaw lifecycle ownership')
|
||||
assert.match(sandboxPermissionsSource, /method: "initialize"[\s\S]*method: "POST"/, 'MCP broker network sync must probe the actual streamable HTTP POST initialize path')
|
||||
assert.match(sandboxPermissionsSource, /"--input-type=module"/, 'MCP broker network sync probe must support top-level await')
|
||||
assert.match(sandboxPermissionsSource, /await fetch\(/, 'MCP broker network sync probe must wait for the policy-generating request')
|
||||
|
||||
@@ -57,7 +57,7 @@ assert.match(installSource, /set_env "OPENSHELL_CONTROL_VENV"/, 'installer must
|
||||
assert.match(versionedInstallSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.116\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
||||
assert.match(versionedInstallSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default')
|
||||
assert.match(versionedInstallSource, /NEMOCLAW_SOURCE_URL="\$\{NEMOCLAW_SOURCE_URL:-https:\/\/github\.com\/NVIDIA\/NemoClaw\.git\}"/, 'versioned installer must use the NemoClaw source repository URL')
|
||||
assert.match(versionedInstallSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.7\.1\}"/, 'versioned installer must default to NemoClaw main\'s current OpenClaw build target')
|
||||
assert.match(versionedInstallSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.9\.1\}"/, 'versioned installer must default to NemoClaw main\'s current OpenClaw build target')
|
||||
assert.match(versionedInstallSource, /https:\/\/raw\.githubusercontent\.com\/NVIDIA\/OpenShell\/main\/install\.sh/, 'versioned installer must use the OpenShell installer URL')
|
||||
assert.match(versionedInstallSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw from the selected git ref')
|
||||
assert.match(versionedInstallSource, /Requested NemoClaw install ref/, 'versioned installer must fail clearly when the selected NemoClaw ref is unavailable')
|
||||
|
||||
@@ -59,6 +59,8 @@ assert.match(telemetrySource, /authorities: authorities\.map\(/, 'inventory rout
|
||||
assert.match(openshellHostSource, /const OPENSHELL_GATEWAY = process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'OpenShell host commands must not force the legacy openshell gateway when NemoClaw has selected the nemoclaw gateway')
|
||||
assert.match(openshellHostSource, /ssh-proxy\$\{gatewayOption\}/, 'sandbox SSH proxy commands must make the explicit gateway option conditional')
|
||||
assert.doesNotMatch(openshellHostSource, /ssh-proxy --gateway-name nemoclaw/, 'sandbox SSH proxy commands must not force the legacy unqualified NemoClaw gateway')
|
||||
assert.match(openshellHostSource, /restartSandboxGatewayWithNemoClaw\(sandboxName\)/, 'sandbox dashboard recovery must use NemoClaw native agent lifecycle')
|
||||
assert.doesNotMatch(openshellHostSource, /\/usr\/local\/bin\/openclaw gateway run/, 'sandbox dashboard recovery must not manually launch OpenClaw')
|
||||
assert.match(sandboxHealthSource, /stripAnsi/, 'sandbox health must strip OpenShell ANSI styling before parsing fields such as Phase')
|
||||
assert.match(openshellHostSource, /const canMintBootstrapFromCli = instance\.id === defaultInstance\.id/, 'bootstrap minting should only use CLI for the default OpenClaw instance')
|
||||
assert.match(openshellHostSource, /readSandboxOpenClawDashboardToken/, 'sandbox dashboard bootstrap must fall back to the sandbox OpenClaw token when CLI output is bare')
|
||||
|
||||
@@ -126,34 +126,13 @@ assert.match(createRouteSource, /NEMOCLAW_PROVIDER_KEY = env\.COMPATIBLE_API_KEY
|
||||
assert.match(createRouteSource, /Hosted NVIDIA Build onboarding requires an nvapi-\*/, 'blueprint create must reject non-nvapi keys for the hosted NVIDIA build provider')
|
||||
assert.match(versionedInstallerSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.116\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
||||
assert.match(versionedInstallerSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default while preserving the legacy tag override')
|
||||
assert.match(versionedInstallerSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.7\.1\}"/, 'versioned installer must pin the current NemoClaw-compatible OpenClaw base image version')
|
||||
assert.match(versionedInstallerSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.9\.1\}"/, 'versioned installer must pin the current NemoClaw-compatible OpenClaw base image version')
|
||||
assert.match(versionedInstallerSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw by git ref so branch heads and tags both work')
|
||||
assert.match(versionedInstallerSource, /docker build[\s\S]*Dockerfile\.base[\s\S]*--build-arg "OPENCLAW_VERSION=\$OPENCLAW_VERSION"[\s\S]*"\$source_dir"/, 'versioned installer must rebuild the stock NemoClaw base image with the pinned OpenClaw version')
|
||||
assert.doesNotMatch(createRouteSource, /repairOpenClawRuntimePolicy|runtimePolicyRepair/, 'sandbox create must not mutate OpenShell filesystem policy for OpenClaw')
|
||||
assert.doesNotMatch(createRouteSource, /stabilizeOpenClawGatewayConfig|gatewayConfigRepair|repairOpenClawWorkspacePermissions|workspaceRepair/, 'sandbox create must not patch OpenClaw internals after the Monday rollback')
|
||||
assert.match(createRouteSource, /repairOpenClawExecApprovalsFile/, 'sandbox create may apply the narrow exec approvals symlink compatibility repair')
|
||||
assert.match(createRouteSource, /execApprovalsRepair/, 'sandbox create response must report the narrow exec approvals compatibility repair')
|
||||
assert.match(createRouteSource, /created && isOpenClawAgent \? await repairOpenClawExecApprovalsFile/, 'Hermes create must skip OpenClaw-only exec approvals repair')
|
||||
assert.doesNotMatch(createRouteSource, /stabilizeOpenClawGatewayConfig|gatewayConfigRepair|repairOpenClawWorkspacePermissions|workspaceRepair|repairOpenClawExecApprovalsFile|execApprovalsRepair/, 'sandbox create must not patch OpenClaw internals owned by current NemoClaw images')
|
||||
assert.match(createRouteSource, /created && isOpenClawAgent \? await approveOpenClawDeviceRequests/, 'Hermes create must skip OpenClaw-only device approval')
|
||||
assert.doesNotMatch(sandboxPrivilegedFilesSource, /openshell-openclaw-policy-|"policy", "set"|withoutReadOnlyOpenClaw/, 'OpenClaw repair must not mutate OpenShell filesystem policy')
|
||||
assert.match(sandboxPrivilegedFilesSource, /plugins\.entries\.bonjour/, 'gateway config stabilization must disable the crashing Bonjour plugin')
|
||||
assert.match(sandboxPrivilegedFilesSource, /sha256sum openclaw\.json > \.config-hash/, 'gateway config stabilization must refresh OpenClaw config hash')
|
||||
assert.match(sandboxPrivilegedFilesSource, /openclaw gateway run/, 'gateway config stabilization must restart the OpenClaw gateway')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"workspace"/, 'workspace repair must target the OpenClaw workspace directory')
|
||||
assert.match(sandboxPrivilegedFilesSource, /\/sandbox\/\.openclaw-data\/\$dir/, 'workspace repair must use the policy-writable OpenClaw data tree')
|
||||
assert.match(sandboxPrivilegedFilesSource, /ln -sfn/, 'workspace repair must link the OpenClaw workspace path into writable storage')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"flows"/, 'workspace repair must include the stock NemoClaw flows symlink')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"plugin-runtime-deps"/, 'workspace repair must include the OpenClaw plugin runtime dependency directory')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"update-check\.json"/, 'workspace repair must include the stock NemoClaw update-check symlink')
|
||||
assert.match(sandboxPrivilegedFilesSource, /exec-approvals\.json/, 'workspace repair must include exec approval state handling')
|
||||
assert.match(sandboxPrivilegedFilesSource, /const mutableFiles = \[\s*"update-check\.json",\s*\]/, 'workspace repair must not leave exec approvals in the symlinked mutable files list for newer OpenClaw')
|
||||
assert.match(sandboxPrivilegedFilesSource, /chmod 0600 \/sandbox\/\.openclaw\/exec-approvals\.json/, 'workspace repair must make exec approvals a real writable file for newer OpenClaw')
|
||||
assert.match(sandboxPrivilegedFilesSource, /chown -R sandbox:sandbox \/sandbox\/\.openclaw-data/, 'workspace repair must restore stock NemoClaw ownership for OpenClaw data')
|
||||
assert.match(sandboxPrivilegedFilesSource, /AGENTS\.md/, 'workspace repair note must document the AGENTS.md permission failure it prevents')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"agents"/, 'workspace repair must target the OpenClaw agent directory so sessions are writable through .openclaw-data')
|
||||
assert.match(sandboxPrivilegedFilesSource, /"agents"[\s\S]*"workspace"[\s\S]*"memory"/, 'workspace repair must cover NemoClaw expected OpenClaw mutable symlink directories')
|
||||
assert.match(sandboxPrivilegedFilesSource, /sessions\.json\.lock|session lock/, 'workspace repair note must document the sessions.json.lock permission failure it prevents')
|
||||
assert.match(sandboxPrivilegedFilesSource, /bundled OpenClaw expects/, 'workspace repair note must document the dashboard reconciles to the bundled OpenClaw expectations')
|
||||
assert.doesNotMatch(sandboxPrivilegedFilesSource, /exec-approvals\.json|openclaw gateway run|plugins\.entries\.bonjour|\.openclaw-data/, 'privileged file helper must not recreate retired OpenClaw state or bypass NemoClaw lifecycle ownership')
|
||||
|
||||
assert.match(hookSource, /type RefreshOptions = \{\s*force\?: boolean\s*\}/, 'inventory refresh must accept a force option')
|
||||
assert.match(hookSource, /!refreshOptions\?\.force && inFlightRef\.current/, 'forced inventory refresh must bypass existing in-flight reads')
|
||||
@@ -304,6 +283,9 @@ assert.match(sandboxInferenceApplyLibSource, /OPENSHELL_GATEWAY: process\.env\.O
|
||||
assert.doesNotMatch(sandboxInferenceApplyLibSource, /docker[\s\S]*kubectl|OPENSHELL_CLUSTER_CONTAINER/, 'live apply must not depend on obsolete cluster containers or in-container kubectl')
|
||||
assert.doesNotMatch(sandboxInferenceApplyLibSource, /chmod 444|chown root:root/, 'live apply must leave OpenClaw config writable by the sandbox owner for subsequent updates')
|
||||
assert.match(sandboxInferenceApplyLibSource, /\["inference", "set", "--no-verify", "--provider", primary\.provider, "--model", primary\.model\]/, 'live apply must point OpenShell inference at the primary route')
|
||||
assert.match(sandboxInferenceApplyLibSource, /restartSandboxGatewayWithNemoClaw\(sandboxName\)/, 'live apply must restart through NemoClaw native agent lifecycle after config and route updates')
|
||||
assert.match(sandboxInferenceApplyLibSource, /gatewayRestart: "nemoclaw-native-gateway"/, 'live apply must report its verified native restart mode')
|
||||
assert.doesNotMatch(sandboxInferenceApplyLibSource, /\/proc\/[[]0-9[]][*]|openclaw gateway run/, 'live apply must not kill or launch OpenClaw processes outside NemoClaw lifecycle ownership')
|
||||
assert.match(sandboxInferenceApplyLibSource, /resolveInferenceModelIdentity/, 'live apply must normalize provider/model identities for OpenClaw inference routes')
|
||||
assert.match(sandboxInferenceApplyLibSource, /providerKey: "nvidia"[\s\S]*modelRef: route\.model/, 'live apply must preserve nvidia/... model refs without wrapping them as inference/...')
|
||||
assert.doesNotMatch(sandboxRestartRouteSource, /delete", "pod"|kubectl delete/, 'restart route must not delete the backing sandbox pod')
|
||||
|
||||
Reference in New Issue
Block a user