Repository navigation
fix(onboard): fail fast when Docker is unreachable during gateway start #4128
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
6 commits
Select commit
Hold shift + click to select a range
1d338f9
fix(onboard): short-circuit gateway start when Docker daemon is unrea…
chengjiew cccedd2
fix(onboard): keep gateway failure handling out of onboard entrypoint
chengjiew 6282137
fix(onboard): classify ANSI-stripped gateway start output
chengjiew 15d629c
Merge branch 'main' into fix/2347-onboard-docker-hang-v2
cv 34008e2
Merge branch 'main' into fix/2347-onboard-docker-hang-v2
cv 20fee19
test(onboard): cover docker-unreachable gateway start
cv 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
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,24 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { describe, expect, it, vi } from "vitest"; | ||
|
|
||
| import { reportLegacyGatewayStartResultFailure } from "./gateway-start-failure"; | ||
|
|
||
| describe("reportLegacyGatewayStartResultFailure", () => { | ||
| it("classifies Docker-unreachable output after stripping ANSI sequences (#2347)", () => { | ||
| const log = vi.fn(); | ||
| const output = [ | ||
| "\x1b[31mError: Failed to create Docker client.\x1b[0m", | ||
| "\x1b[33mSocket not found: /var/run/docker.sock\x1b[0m", | ||
| ].join("\n"); | ||
|
|
||
| expect(reportLegacyGatewayStartResultFailure(output, log)).toEqual({ | ||
| kind: "docker_unreachable", | ||
| }); | ||
| expect(log).toHaveBeenCalledWith( | ||
| expect.stringContaining("Gateway start returned before healthy"), | ||
| ); | ||
| expect(log.mock.calls[0][0]).not.toContain("\x1b"); | ||
| }); | ||
| }); |
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,40 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { compactText } from "../core/url-utils"; | ||
| import { redact } from "../security/redact"; | ||
| import { classifyGatewayStartFailure } from "../validation"; | ||
|
|
||
| const ANSI_RE = /\x1B(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\)|[@-_])/g; | ||
|
|
||
| export function reportLegacyGatewayStartResultFailure( | ||
| output: string, | ||
| log: (message: string) => void, | ||
| ) { | ||
| const cleanedOutput = String(output || "").replace(ANSI_RE, ""); | ||
| const lines = redact(cleanedOutput) | ||
| .split("\n") | ||
| .map((l) => compactText(l)) | ||
| .filter(Boolean) | ||
| .map((l) => ` ${l}`); | ||
| if (lines.length > 0) { | ||
| log(` Gateway start returned before healthy:\n${lines.join("\n")}`); | ||
| } | ||
| return classifyGatewayStartFailure(cleanedOutput); | ||
| } | ||
|
|
||
| export function printDockerDaemonRecovery( | ||
| printError: (message?: string) => void, | ||
| platform: NodeJS.Platform = process.platform, | ||
| ): void { | ||
| printError(" Docker daemon is not running — cannot start the gateway."); | ||
| printError(""); | ||
| printError(" Start Docker, then rerun `nemoclaw onboard`:"); | ||
| if (platform === "darwin") { | ||
| printError(" colima start # or start Docker Desktop"); | ||
| } else if (platform === "linux") { | ||
| printError(" sudo systemctl start docker"); | ||
| } else { | ||
| printError(" Start the Docker daemon."); | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.