fix: stop forging NemoClaw registry receipts (#43)
Quick-deployed OpenShell clones no longer forge NemoClaw lifecycle, policy-authority, or workload receipts.
This commit is contained in:
@@ -221,6 +221,8 @@ The dashboard shells out to the OpenShell CLI for several operations:
|
|||||||
- `openshell provider create/update/delete/list`
|
- `openshell provider create/update/delete/list`
|
||||||
- `openshell inference set/get/update`
|
- `openshell inference set/get/update`
|
||||||
|
|
||||||
|
The **Quick Deploy New NemoClaw Sandbox** path clones a registered image through OpenShell, but it deliberately does not write the clone into NemoClaw's private `sandboxes.json`. Current NemoClaw entries include lifecycle identity, policy-authority, and workload receipts that must be issued by NemoClaw itself. The clone remains visible and operable through OpenShell Control; use **Fresh NemoClaw Image** when the new sandbox must participate in NemoClaw-managed lifecycle operations.
|
||||||
|
|
||||||
OpenClaw dashboard access is loopback-only inside the host/sandbox context, so the UI uses local proxy routes:
|
OpenClaw dashboard access is loopback-only inside the host/sandbox context, so the UI uses local proxy routes:
|
||||||
|
|
||||||
- `/api/openshell/dashboard/proxy`
|
- `/api/openshell/dashboard/proxy`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { execFile, spawn } from "node:child_process"
|
import { execFile, spawn } from "node:child_process"
|
||||||
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs"
|
import { existsSync, readFileSync } from "node:fs"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import { promisify } from "node:util"
|
import { promisify } from "node:util"
|
||||||
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
||||||
@@ -342,47 +342,12 @@ async function resolveSourcePodImage(sourceSandboxRef: string | null | undefined
|
|||||||
throw new Error("No running NemoClaw sandbox image was found for quick deploy. Create one Fresh NemoClaw Image first, or pass sourceSandboxName explicitly.")
|
throw new Error("No running NemoClaw sandbox image was found for quick deploy. Create one Fresh NemoClaw Image first, or pass sourceSandboxName explicitly.")
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerNemoClawImageRedeploy(sourceName: string, sandboxName: string) {
|
function skippedNemoClawImageRedeployRegistration() {
|
||||||
try {
|
return {
|
||||||
const current = existsSync(NEMOCLAW_REGISTRY_FILE)
|
registered: false as const,
|
||||||
? JSON.parse(readFileSync(NEMOCLAW_REGISTRY_FILE, "utf8"))
|
skipped: true as const,
|
||||||
: {}
|
registryFile: NEMOCLAW_REGISTRY_FILE,
|
||||||
const sandboxes = current && typeof current.sandboxes === "object" && current.sandboxes !== null
|
note: "The quick-deployed sandbox remains an OpenShell-managed clone and was not written into NemoClaw's private registry. Current NemoClaw registry entries carry lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely.",
|
||||||
? current.sandboxes
|
|
||||||
: {}
|
|
||||||
const sourceEntry = sandboxes[sourceName] && typeof sandboxes[sourceName] === "object"
|
|
||||||
? sandboxes[sourceName]
|
|
||||||
: { name: sourceName }
|
|
||||||
|
|
||||||
sandboxes[sandboxName] = {
|
|
||||||
...sourceEntry,
|
|
||||||
name: sandboxName,
|
|
||||||
createdAt: new Date().toISOString(),
|
|
||||||
nimContainer: null,
|
|
||||||
policies: [],
|
|
||||||
imageTag: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
const next = {
|
|
||||||
...current,
|
|
||||||
sandboxes,
|
|
||||||
defaultSandbox: current.defaultSandbox || sandboxName,
|
|
||||||
}
|
|
||||||
mkdirSync(path.dirname(NEMOCLAW_REGISTRY_FILE), { recursive: true })
|
|
||||||
const tempPath = `${NEMOCLAW_REGISTRY_FILE}.tmp.${process.pid}.${Date.now()}`
|
|
||||||
writeFileSync(tempPath, `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 })
|
|
||||||
renameSync(tempPath, NEMOCLAW_REGISTRY_FILE)
|
|
||||||
return {
|
|
||||||
ok: true as const,
|
|
||||||
registryFile: NEMOCLAW_REGISTRY_FILE,
|
|
||||||
note: "Registered the image-redeployed sandbox in the local NemoClaw registry without assigning a host Docker image tag.",
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return {
|
|
||||||
ok: false as const,
|
|
||||||
registryFile: NEMOCLAW_REGISTRY_FILE,
|
|
||||||
error: error instanceof Error ? error.message : "Failed to update the local NemoClaw registry",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1062,7 +1027,7 @@ export async function POST(request: Request) {
|
|||||||
error: "Sandbox readiness polling produced no verification result.",
|
error: "Sandbox readiness polling produced no verification result.",
|
||||||
}
|
}
|
||||||
const created = readiness.verified
|
const created = readiness.verified
|
||||||
const registry = created ? registerNemoClawImageRedeploy(source.name, sandboxName) : null
|
const registry = created ? skippedNemoClawImageRedeployRegistration() : null
|
||||||
const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
|
const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
|
||||||
sandboxName,
|
sandboxName,
|
||||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
path: "/sandbox/.openclaw/exec-approvals.json",
|
||||||
@@ -1128,7 +1093,7 @@ export async function POST(request: Request) {
|
|||||||
createAttempt.timedOut
|
createAttempt.timedOut
|
||||||
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
|
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
|
||||||
: false,
|
: false,
|
||||||
registry && !registry.ok ? `NemoClaw registry update failed: ${registry.error}` : false,
|
registry?.note,
|
||||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
||||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
||||||
deviceApproval?.note,
|
deviceApproval?.note,
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must
|
|||||||
assert.match(createRouteSource, /registryEntry\?\.imageTag\?\.trim\(\)/, 'image redeploy must resolve the source image from NemoClaw registry metadata')
|
assert.match(createRouteSource, /registryEntry\?\.imageTag\?\.trim\(\)/, 'image redeploy must resolve the source image from NemoClaw registry metadata')
|
||||||
assert.doesNotMatch(createRouteSource, /OPENSHELL_CLUSTER_CONTAINER|readPodImage|"kubectl"/, 'image redeploy must not depend on obsolete cluster containers or in-container kubectl')
|
assert.doesNotMatch(createRouteSource, /OPENSHELL_CLUSTER_CONTAINER|readPodImage|"kubectl"/, 'image redeploy must not depend on obsolete cluster containers or in-container kubectl')
|
||||||
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
|
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
|
||||||
assert.match(createRouteSource, /registerNemoClawImageRedeploy/, 'image redeploy must register the new sandbox without a full NemoClaw rebuild')
|
assert.match(createRouteSource, /skippedNemoClawImageRedeployRegistration/, 'image redeploy must report that NemoClaw registry registration was deliberately skipped')
|
||||||
|
assert.match(createRouteSource, /lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely/, 'image redeploy must explain why direct NemoClaw registry writes are unsafe')
|
||||||
|
assert.doesNotMatch(createRouteSource, /function registerNemoClawImageRedeploy|writeFileSync\(tempPath|renameSync\(tempPath/, 'image redeploy must not forge current NemoClaw registry entries by copying source-bound authority receipts')
|
||||||
assert.match(createRouteSource, /readyVerification\?: SandboxVerification/, 'ready-aware create command must carry the authoritative verification result')
|
assert.match(createRouteSource, /readyVerification\?: SandboxVerification/, 'ready-aware create command must carry the authoritative verification result')
|
||||||
assert.match(createRouteSource, /readyVerification: verification/, 'ready-aware create command must return the verification that proved readiness')
|
assert.match(createRouteSource, /readyVerification: verification/, 'ready-aware create command must return the verification that proved readiness')
|
||||||
assert.match(createRouteSource, /createAttempt\.readyVerification\?\.verified[\s\S]*await waitForSandboxReady\(sandboxName, 90000, 2000\)/, 'image redeploy must reuse the ready-command verification instead of always polling readiness twice')
|
assert.match(createRouteSource, /createAttempt\.readyVerification\?\.verified[\s\S]*await waitForSandboxReady\(sandboxName, 90000, 2000\)/, 'image redeploy must reuse the ready-command verification instead of always polling readiness twice')
|
||||||
|
|||||||
Reference in New Issue
Block a user