diff --git a/app/api/sandbox/create/route.ts b/app/api/sandbox/create/route.ts index 546fa72..f741edf 100644 --- a/app/api/sandbox/create/route.ts +++ b/app/api/sandbox/create/route.ts @@ -528,6 +528,7 @@ async function runCreateCommandUntilReady(file: string, args: string[], env: Nod completed: boolean timedOut: boolean forcedReady: boolean + readyVerification?: SandboxVerification exitCode: number | null signal: NodeJS.Signals | null stdout: string @@ -548,6 +549,7 @@ async function runCreateCommandUntilReady(file: string, args: string[], env: Nod completed: boolean timedOut: boolean forcedReady: boolean + readyVerification?: SandboxVerification exitCode: number | null signal: NodeJS.Signals | null stdout: string @@ -610,6 +612,7 @@ async function runCreateCommandUntilReady(file: string, args: string[], env: Nod completed: false, timedOut: false, forcedReady: true, + readyVerification: verification, exitCode: null, signal: "SIGTERM", stdout: stdout.trim(), @@ -1012,7 +1015,14 @@ export async function POST(request: Request) { "nemoclaw-start", ], env, sandboxName, 120000, 2000) - const readiness = await waitForSandboxReady(sandboxName, 90000, 2000) + const readiness = createAttempt.readyVerification?.verified + ? { + verified: true as const, + verification: createAttempt.readyVerification, + attempts: 0, + elapsedMs: 0, + } + : await waitForSandboxReady(sandboxName, 90000, 2000) const verification = readiness.verification ?? { verified: false, summary: "Sandbox readiness polling produced no verification result.", diff --git a/tests/sandbox-lifecycle-check.mjs b/tests/sandbox-lifecycle-check.mjs index 000be6e..122187e 100644 --- a/tests/sandbox-lifecycle-check.mjs +++ b/tests/sandbox-lifecycle-check.mjs @@ -105,6 +105,9 @@ assert.match(createRouteSource, /resolveSourcePodImage\(sourceSandboxName, sandb assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must pass the resolved image to openshell sandbox create') 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, /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, /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, /const requestedMode = typeof raw\.mode === "string" \? raw\.mode : "vllm"/, 'blueprint create must default to vLLM experimental onboarding when the UI payload is absent') assert.match(createRouteSource, /NEMOCLAW_EXPERIMENTAL = "1"/, 'blueprint create must support NemoClaw experimental provider onboarding') assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "vllm"/, 'blueprint create must support the vLLM onboarding provider')