Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/cli/terminal-style.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { afterEach, describe, expect, it, vi } from "vitest";

import { B, D, failLine, G, R, RD, warnLine, YW } from "./terminal-style";
import { B, D, failLine, G, labeledWarnLine, R, RD, warnLine, YW } from "./terminal-style";

describe("terminal-style", () => {
it("exports terminal style strings", () => {
Expand Down Expand Up @@ -70,6 +70,7 @@ describe("preflight severity lines (#6004)", () => {
stubStream(process.stderr, true, 24);
stubStream(process.stdout, false, 1);
expect(warnLine("disk low")).toBe(` ${YELLOW("⚠ disk low")}`);
expect(labeledWarnLine("disk low")).toBe(` ${YELLOW("[WARN] disk low")}`);
expect(failLine("docker down")).toBe(` ${RED("✗ docker down")}`);
});
});
Expand All @@ -82,6 +83,7 @@ describe("preflight severity lines (#6004)", () => {
stubStream(process.stdout, true, 24);
stubStream(process.stderr, false, 1);
expect(warnLine("disk low")).toBe(" ⚠ disk low");
expect(labeledWarnLine("disk low")).toBe(" [WARN] disk low");
expect(failLine("docker down")).toBe(" ✗ docker down");
});
});
Expand All @@ -93,6 +95,7 @@ describe("preflight severity lines (#6004)", () => {
stubStream(process.stdout, true, 24);
stubStream(process.stderr, true, 24);
expect(warnLine("a")).toBe(" ⚠ a");
expect(labeledWarnLine("a")).toBe(" [WARN] a");
expect(failLine("b")).toBe(" ✗ b");
});
});
Expand Down
4 changes: 3 additions & 1 deletion src/lib/cli/terminal-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const YW = useColor ? "\x1b[1;33m" : "";
// FORCE_COLOR (#6004). The old output keyed color off stdout, which dropped
// color on `onboard >log` and leaked ANSI into `onboard 2>log`.
function stderrSeverityLine(
marker: "⚠ " | "✗ ",
marker: "⚠ " | "✗ " | "[WARN] ",
format: "yellow" | "red",
message: string,
): string {
Expand All @@ -35,4 +35,6 @@ function stderrSeverityLine(
}

export const warnLine = (message: string): string => stderrSeverityLine("⚠ ", "yellow", message);
export const labeledWarnLine = (message: string): string =>
stderrSeverityLine("[WARN] ", "yellow", message);
export const failLine = (message: string): string => stderrSeverityLine("✗ ", "red", message);
16 changes: 9 additions & 7 deletions src/lib/inference/vllm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ describe("installVllm model resolution", () => {
delete process.env.NEMOCLAW_VLLM_EXTRA_ARGS_JSON;
delete process.env.HF_TOKEN;
delete process.env.HUGGING_FACE_HUB_TOKEN;
process.env.NO_COLOR = "1";
// Fail dockerPrereqsOk so the function returns before any docker work,
// letting tests assert on the resolved model + summary line without
// mocking the full install chain.
Expand Down Expand Up @@ -877,11 +878,11 @@ describe("installVllm model resolution", () => {
expect(mocks.dockerPullWithProgressWatchdog).toHaveBeenCalledTimes(1);
expect(mocks.dockerSpawn).toHaveBeenCalledTimes(1);
const errors = errSpy.mock.calls.map((call: unknown[]) => String(call[0])).join("\n");
expect(errors).toContain("Insufficient storage for the managed vLLM model cache");
expect(errors).toContain("[WARN] Insufficient storage for the managed vLLM model cache");
expect(errors).toContain("nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4");
expect(errors).toContain("Hugging Face cache");
expect(errors).toContain(
"Continuing because managed vLLM storage estimates are advisory in non-interactive setup",
"[INFO] Continuing because managed vLLM storage estimates are advisory in non-interactive setup",
);
});

Expand Down Expand Up @@ -1017,11 +1018,11 @@ describe("installVllm model resolution", () => {
expect(mocks.dockerPullWithProgressWatchdog).toHaveBeenCalledTimes(1);
expect(mocks.dockerSpawn).toHaveBeenCalledTimes(1);
expect(errSpy).toHaveBeenCalledWith(
expect.stringContaining("Insufficient storage for the managed vLLM model cache"),
expect.stringContaining("[WARN] Insufficient storage for the managed vLLM model cache"),
);
expect(errSpy).toHaveBeenCalledWith(
expect.stringContaining(
"Continuing because managed vLLM storage estimates are advisory in non-interactive setup",
"[INFO] Continuing because managed vLLM storage estimates are advisory in non-interactive setup",
),
);
});
Expand Down Expand Up @@ -1154,9 +1155,10 @@ describe("installVllm model resolution", () => {
expect(mocks.dockerPullWithProgressWatchdog).toHaveBeenCalledTimes(1);
expect(mocks.dockerSpawn).toHaveBeenCalledTimes(1);
expect(errSpy).toHaveBeenCalledWith(
expect.stringContaining(
"Continuing because managed vLLM storage estimates are advisory in non-interactive setup",
),
" [WARN] Insufficient Docker storage for the managed vLLM image.",
);
expect(errSpy).toHaveBeenCalledWith(
" [INFO] Continuing because managed vLLM storage estimates are advisory in non-interactive setup.",
);
});

Expand Down
13 changes: 9 additions & 4 deletions src/lib/inference/vllm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
dockerStop,
} from "../adapters/docker";
import { buildValidatedCurlCommandArgs } from "../adapters/http/curl-args";
import { labeledWarnLine } from "../cli/terminal-style";
import { VLLM_PORT } from "../core/ports";
import { shellQuote } from "../core/shell-quote";
import { isAffirmativeAnswer } from "../onboard/prompt-helpers";
Expand Down Expand Up @@ -779,7 +780,9 @@ function printImageStorageWarning(
const insufficient = probe.ok && probe.capacity.availableBytes < requiredBytes;
console.error("");
console.error(
` ${insufficient ? "Insufficient" : "Unable to verify"} Docker storage for the managed vLLM image.`,
labeledWarnLine(
`${insufficient ? "Insufficient" : "Unable to verify"} Docker storage for the managed vLLM image.`,
),
);
console.error("");
console.error(` Image: ${profile.image}`);
Expand Down Expand Up @@ -813,7 +816,9 @@ function printModelStorageWarning(
const insufficient = probe.ok && probe.capacity.availableBytes < requiredBytes;
console.error("");
console.error(
` ${insufficient ? "Insufficient" : "Unable to verify"} storage for the managed vLLM model cache.`,
labeledWarnLine(
`${insufficient ? "Insufficient" : "Unable to verify"} storage for the managed vLLM model cache.`,
),
);
console.error("");
console.error(` Model: ${model.id}`);
Expand Down Expand Up @@ -860,7 +865,7 @@ async function imageStorageAccepted(
}
if (opts.nonInteractive) {
console.error(
" Continuing because managed vLLM storage estimates are advisory in non-interactive setup.",
" [INFO] Continuing because managed vLLM storage estimates are advisory in non-interactive setup.",
);
return true;
}
Expand All @@ -887,7 +892,7 @@ async function modelStorageAccepted(
printModelStorageWarning(model, probe, requiredBytes, cachedBytes, snapshotBytes);
if (probe.ok && opts.nonInteractive) {
console.error(
" Continuing because managed vLLM storage estimates are advisory in non-interactive setup.",
" [INFO] Continuing because managed vLLM storage estimates are advisory in non-interactive setup.",
);
return true;
}
Expand Down