Repository navigation
fix(status): recommend start for crashed-sandbox recovery (#7222)
#7225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7ada26c
fix(status): recommend `start` for crashed-sandbox recovery (#7222)
yanyunl1991 66ca650
Merge remote-tracking branch 'origin/main' into codex/review-7225
ericksoa ed44af5
fix(sandbox): preserve paused-container recovery
ericksoa 8f80b3d
Merge branch 'main' into fix/7222-crashed-sandbox-recovery-hint-start
cjagwani 9a69741
Merge branch 'main' into fix/7222-crashed-sandbox-recovery-hint-start
ericksoa 80f35ee
fix(status): retain rebuild fallback without container
ericksoa 118073e
fix(status): detect exited sandbox containers
ericksoa 26ee70d
test(status): exercise public recovery renderer
ericksoa 5a8b2f6
fix(status): prefer live sandbox containers
cjagwani a3ab5fd
fix(status): require labeled recovery containers
cjagwani a33c278
Merge branch 'main' into fix/7222-crashed-sandbox-recovery-hint-start
ericksoa 9ac77e6
fix(status): skip Docker probe for non-Docker sandboxes
cjagwani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { afterEach, describe, expect, it, vi } from "vitest"; | ||
|
|
||
| import { printNonReadySandboxPhaseGuidance } from "./status-lookup-rendering"; | ||
|
|
||
| function captureConsoleLog(): { lines: () => string; restore: () => void } { | ||
| const out: string[] = []; | ||
| const spy = vi.spyOn(console, "log").mockImplementation((...args: unknown[]) => { | ||
| out.push(args.map((a) => String(a)).join(" ")); | ||
| }); | ||
| return { lines: () => out.join("\n"), restore: () => spy.mockRestore() }; | ||
| } | ||
|
|
||
| describe("printNonReadySandboxPhaseGuidance (#7222)", () => { | ||
| afterEach(() => vi.restoreAllMocks()); | ||
|
|
||
| it("steers a crashed sandbox to `start` (workspace-preserving), not `rebuild --yes`", () => { | ||
| const cap = captureConsoleLog(); | ||
| // Error phase, container present but not paused → the crashed-container path. | ||
| printNonReadySandboxPhaseGuidance({ | ||
| sandboxName: "beta", | ||
| phase: "Error", | ||
| dockerRuntime: { | ||
| health: "none", | ||
| paused: false, | ||
| containerName: "openshell-beta-abc", | ||
| }, | ||
| }); | ||
| const text = cap.lines(); | ||
| cap.restore(); | ||
|
|
||
| // The recovery hint now leads with `start`, which recovers without data loss. | ||
| expect(text).toContain("nemoclaw beta start"); | ||
| expect(text).toContain("workspace state preserved"); | ||
| // `rebuild --yes` is only mentioned as the recreate alternative, and must no | ||
| // longer be the promised recovery command (its pre-rebuild backup aborts on a | ||
| // stopped container — the reported bug). | ||
| expect(text).not.toContain("Run `nemoclaw beta rebuild --yes` to recreate"); | ||
| expect(text).not.toContain("workspace state will be preserved"); | ||
| // The `rebuild --yes` mention explains why `start` must come first. | ||
| expect(text).toContain("cannot snapshot a stopped container"); | ||
| }); | ||
|
|
||
| it("keeps the unpause hint for a paused container and never suggests start/rebuild (#4495)", () => { | ||
| const cap = captureConsoleLog(); | ||
| printNonReadySandboxPhaseGuidance({ | ||
| sandboxName: "beta", | ||
| phase: "Error", | ||
| dockerRuntime: { | ||
| health: "none", | ||
| paused: true, | ||
| containerName: "openshell-beta-abc", | ||
| }, | ||
| }); | ||
| const text = cap.lines(); | ||
| cap.restore(); | ||
|
|
||
| expect(text).toContain("docker unpause openshell-beta-abc"); | ||
| expect(text).not.toContain("rebuild --yes"); | ||
| expect(text).not.toContain("beta start"); | ||
| }); | ||
|
|
||
| it("prints no guidance for a Ready sandbox", () => { | ||
| const cap = captureConsoleLog(); | ||
| printNonReadySandboxPhaseGuidance({ sandboxName: "beta", phase: "Ready", dockerRuntime: null }); | ||
| const text = cap.lines(); | ||
| cap.restore(); | ||
| expect(text).toBe(""); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.