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
23 changes: 23 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2880,6 +2880,18 @@ normalize_station_vllm_model() {
printf "%s" "${1:-}" | tr '[:upper:]' '[:lower:]' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
}

# True when an interactive terminal is reachable for a prompt: stdin is a TTY,
# or /dev/tty can be opened (the curl|bash case where stdin is the script pipe).
# Mirrors how maybe_offer_express_install decides whether it can prompt.
express_prompt_can_read_tty() {
[ -t 0 ] && return 0
if { exec 3</dev/tty; } 2>/dev/null; then
exec 3<&-
return 0
fi
return 1
}

validate_station_deepseek_override() {
local platform="$1"
if [ "${STATION_DEEPSEEK:-}" != "1" ]; then
Expand Down Expand Up @@ -2916,6 +2928,17 @@ validate_station_deepseek_override() {
error "--station-deepseek conflicts with NEMOCLAW_VLLM_MODEL='${NEMOCLAW_VLLM_MODEL}'. Remove one override or set NEMOCLAW_VLLM_MODEL=${STATION_DEEPSEEK_VLLM_MODEL}."
;;
esac

# #7014: --station-deepseek selects the interactive DGX Station express prompt,
# so it needs a terminal. Without one, maybe_offer_express_install would just
# log "Skipping express prompt (no TTY)" and continue, silently ignoring the
# flag and installing a different configuration. Fail fast here (before Docker
# / build deps) with a clear message instead, mirroring the --non-interactive
# rejection above. Checked last so a genuine config conflict (provider/model)
# is still reported first.
if ! express_prompt_can_read_tty; then
error "--station-deepseek selects the DGX Station express prompt, which needs an interactive terminal. Re-run from a terminal (for a curl|bash pipe, /dev/tty must be available), or omit --station-deepseek and configure the install non-interactively."
fi
}

preflight_explicit_express_flags() {
Expand Down
47 changes: 47 additions & 0 deletions test/install-express-prompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,53 @@ main "$@"
fs.rmSync(tmp, { recursive: true, force: true });
});

it("errors instead of silently skipping --station-deepseek when no interactive terminal is available (#7014)", () => {
// `setsid` runs main in a new session with no controlling terminal, and
// stdin is a pipe — so neither `-t 0` nor /dev/tty is available, making the
// check deterministic regardless of how the test runner was launched.
// Docker / build deps are mocked to prove the error fires before any host
// mutation (the preflight validation path).
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-station-notty-"));
const mutationLog = path.join(tmp, "host-mutations.log");
const result = spawnSync(
"setsid",
[
"bash",
"--noprofile",
"--norc",
"-c",
`
source "$INSTALLER_UNDER_TEST" >/dev/null
detect_express_platform() { printf "%s" "$EXPRESS_PLATFORM"; }
ensure_docker() { printf "ensure_docker\\n" >>"$MUTATION_LOG"; }
ensure_openshell_build_deps() { printf "ensure_openshell_build_deps\\n" >>"$MUTATION_LOG"; }
main "$@"
`,
"_",
"--station-deepseek",
],
{
cwd: tmp,
input: "",
encoding: "utf-8",
env: {
HOME: tmp,
PATH: TEST_SYSTEM_PATH,
INSTALLER_UNDER_TEST: INSTALLER_PAYLOAD,
MUTATION_LOG: mutationLog,
EXPRESS_PLATFORM: "DGX Station",
},
},
);
const output = `${result.stdout}${result.stderr}`;
const mutations = fs.existsSync(mutationLog) ? fs.readFileSync(mutationLog, "utf-8") : "";
expect(result.status, output).not.toBe(0);
expect(output).toMatch(/--station-deepseek.*needs an interactive terminal/);
// Failed at preflight, before Docker / build-dependency mutation.
expect(mutations).toBe("");
fs.rmSync(tmp, { recursive: true, force: true });
});

it.each<{
name: string;
extraEnv: Record<string, string>;
Expand Down
Loading