From edc622189afa06b27b25ed76fb4dfe44c36ed1c3 Mon Sep 17 00:00:00 2001 From: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:11:42 -0700 Subject: [PATCH] fix(onboard): classify deleting handoff divergence Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com> --- ...u-patch-diagnostics-classification.test.ts | 39 +++++++++++++++++++ .../docker-gpu-patch-failure-print.test.ts | 1 + src/lib/onboard/docker-gpu-patch-types.ts | 1 + src/lib/onboard/docker-gpu-patch.ts | 20 ++++++++++ 4 files changed, 61 insertions(+) diff --git a/src/lib/onboard/docker-gpu-patch-diagnostics-classification.test.ts b/src/lib/onboard/docker-gpu-patch-diagnostics-classification.test.ts index d60f60e8e26..2f3207ed495 100644 --- a/src/lib/onboard/docker-gpu-patch-diagnostics-classification.test.ts +++ b/src/lib/onboard/docker-gpu-patch-diagnostics-classification.test.ts @@ -196,6 +196,45 @@ describe("Docker GPU patch diagnostics", () => { expect(result.headline).toContain("Provisioning"); }); + it("assigns OpenShell lifecycle ownership when a healthy container remains in Deleting (#9531)", () => { + const result = classify( + failureSnapshot("Deleting", { + Status: "running", + Running: true, + ExitCode: 0, + Health: { Status: "healthy" }, + }), + ); + + expect(result).toMatchObject({ + kind: "sandbox_deleting_phase", + headline: + "OpenShell kept the sandbox in Deleting after the replacement container became healthy.", + summaryLines: expect.arrayContaining([ + "sandbox_phase=Deleting", + "patched_container_status=running", + "patched_container_running=true", + "patched_container_exit_code=0", + "patched_container_health=healthy", + "lifecycle_authority=openshell", + ]), + hints: [ + "OpenShell owns the sandbox lifecycle phase. NemoClaw does not accept Docker container health as lifecycle success.", + ], + }); + }); + + it.each([ + ["health is not healthy", { ...RUNNING, Health: { Status: "starting" } }], + ["container is not running", { Status: "exited", Running: false, ExitCode: 0 }], + ["container state is incomplete", RUNNING], + ])("does not assign OpenShell lifecycle ownership when %s (#9531)", (_case, state) => { + const result = classify(failureSnapshot("Deleting", state)); + + expect(result.kind).not.toBe("sandbox_deleting_phase"); + expect(result.summaryLines).not.toContain("lifecycle_authority=openshell"); + }); + it("prefers supervisor_unreachable over proof_failure when the sandbox is non-live but non-terminal", () => { const result = classify( failureSnapshot("Provisioning"), diff --git a/src/lib/onboard/docker-gpu-patch-failure-print.test.ts b/src/lib/onboard/docker-gpu-patch-failure-print.test.ts index 765295671fe..1158412667e 100644 --- a/src/lib/onboard/docker-gpu-patch-failure-print.test.ts +++ b/src/lib/onboard/docker-gpu-patch-failure-print.test.ts @@ -146,6 +146,7 @@ describe("Docker GPU patch failure reporting (#7996)", () => { it.each([ "sandbox_error_phase", + "sandbox_deleting_phase", "supervisor_unreachable", "proof_failure", ] as const)("ignores a saved %s verdict after rollback", (kind) => { diff --git a/src/lib/onboard/docker-gpu-patch-types.ts b/src/lib/onboard/docker-gpu-patch-types.ts index fb1940fca7f..02be3c624c7 100644 --- a/src/lib/onboard/docker-gpu-patch-types.ts +++ b/src/lib/onboard/docker-gpu-patch-types.ts @@ -177,6 +177,7 @@ export type DockerGpuPatchSandboxSnapshot = { export type DockerGpuPatchFailureKind = | "patched_container_failed" | "sandbox_error_phase" + | "sandbox_deleting_phase" | "supervisor_unreachable" | "proof_failure" | "unknown"; diff --git a/src/lib/onboard/docker-gpu-patch.ts b/src/lib/onboard/docker-gpu-patch.ts index 15aa535e039..3396d537433 100644 --- a/src/lib/onboard/docker-gpu-patch.ts +++ b/src/lib/onboard/docker-gpu-patch.ts @@ -483,6 +483,15 @@ function patchedContainerLooksFailed(state: DockerContainerState | null): boolea return false; } +function patchedContainerIsHealthyAndRunning(state: DockerContainerState | null): boolean { + return ( + state?.Status?.toLowerCase() === "running" && + state.Running === true && + state.ExitCode === 0 && + state.Health?.Status?.toLowerCase() === "healthy" + ); +} + /** * Turn the snapshot + selected GPU mode into a user-facing classification * that distinguishes "the patched container itself died" from "the sandbox @@ -504,6 +513,9 @@ export function classifyDockerGpuPatchFailure( if (selectedMode) lines.push(`patched_create_option=${selectedMode.label}`); const containerFailed = patchedContainerLooksFailed(snapshot.patchedContainerState); + const healthyContainerInDeletingPhase = + snapshot.sandboxPhase === "Deleting" && + patchedContainerIsHealthyAndRunning(snapshot.patchedContainerState); const sandboxInErrorPhase = isFailurePhase(snapshot.sandboxPhase); const sandboxNotLive = !!snapshot.sandboxPhase && !SANDBOX_LIVE_PHASE_TOKENS.has(snapshot.sandboxPhase); @@ -528,6 +540,14 @@ export function classifyDockerGpuPatchFailure( } else if (sandboxInErrorPhase) { kind = "sandbox_error_phase"; headline = `OpenShell sandbox entered ${snapshot.sandboxPhase} phase before the GPU proof could run.`; + } else if (healthyContainerInDeletingPhase) { + kind = "sandbox_deleting_phase"; + headline = + "OpenShell kept the sandbox in Deleting after the replacement container became healthy."; + lines.push("lifecycle_authority=openshell"); + hints.push( + "OpenShell owns the sandbox lifecycle phase. NemoClaw does not accept Docker container health as lifecycle success.", + ); } else if (sandboxNotLive && (snapshot.patchedContainerState || options.proofError)) { // Cover the non-live-but-non-terminal case (e.g. Provisioning / NotReady) // BEFORE the proof-error branch — a proof failing while the sandbox