Stabilize OpenClaw gateway during sandbox create

This commit is contained in:
mmckeen-nv
2026-04-30 09:55:24 -07:00
parent acf4c05aeb
commit ae7a7c3a26
4 changed files with 97 additions and 4 deletions
+19 -1
View File
@@ -17,6 +17,7 @@ const sandboxInferenceStorePath = path.join(root, 'app/lib/sandboxInferenceStore
const sandboxRestartRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/restart/route.ts')
const gatewayRepairRoutePath = path.join(root, 'app/api/openshell/gateway/repair/route.ts')
const sandboxPrivilegedFilesPath = path.join(root, 'app/lib/sandboxPrivilegedFiles.ts')
const versionedInstallerPath = path.join(root, 'install_versioned_nemoclaw_openshell.sh')
const hookPath = path.join(root, 'app/hooks/useSandboxInventory.ts')
const pagePath = path.join(root, 'app/page.tsx')
const configPanelPath = path.join(root, 'app/components/ConfigurationPanel.tsx')
@@ -39,6 +40,7 @@ const sandboxInferenceStoreSource = await readFile(sandboxInferenceStorePath, 'u
const sandboxRestartRouteSource = await readFile(sandboxRestartRoutePath, 'utf8')
const gatewayRepairRouteSource = await readFile(gatewayRepairRoutePath, 'utf8')
const sandboxPrivilegedFilesSource = await readFile(sandboxPrivilegedFilesPath, 'utf8')
const versionedInstallerSource = await readFile(versionedInstallerPath, 'utf8')
const hookSource = await readFile(hookPath, 'utf8')
const pageSource = await readFile(pagePath, 'utf8')
const configPanelSource = await readFile(configPanelPath, 'utf8')
@@ -64,16 +66,32 @@ assert.match(createRouteSource, /NEMOCLAW_EXPERIMENTAL = "1"/, 'blueprint create
assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "vllm"/, 'blueprint create must support the vLLM onboarding provider')
assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "nim-local"/, 'blueprint create must support the NVIDIA NIM onboarding provider')
assert.match(createRouteSource, /NEMOCLAW_PROVIDER_KEY = apiKey/, 'blueprint create must pass NVIDIA API keys through provider env without changing NemoClaw')
assert.match(versionedInstallerSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.4\.24\}"/, 'versioned installer must pin the dashboard-compatible NemoClaw OpenClaw version')
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.match(createRouteSource, /stabilizeOpenClawGatewayConfig/, 'sandbox create must stabilize OpenClaw gateway config after readiness')
assert.match(createRouteSource, /gatewayConfigRepair/, 'sandbox create response must report OpenClaw gateway config stabilization status')
assert.match(createRouteSource, /repairOpenClawWorkspacePermissions/, 'sandbox create must repair OpenClaw workspace permissions after readiness')
assert.match(createRouteSource, /workspaceRepair/, 'sandbox create response must report OpenClaw workspace permission repair status')
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, /chown -R sandbox:sandbox \/sandbox\/\.openclaw-data/, 'workspace repair must make the writable OpenClaw data tree owned by the sandbox user')
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.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')