From 3b026b9dd524cd33d80336513a87ad233f8b6f04 Mon Sep 17 00:00:00 2001 From: Yanyun Liao Date: Thu, 16 Jul 2026 17:26:32 +0800 Subject: [PATCH 1/4] fix(install): don't infer non-interactive from notice acceptance for --station-deepseek (#7008, #7009) #7008: NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 (and --yes-i-accept-third-party-software) inferred non-interactive mode, which then made --station-deepseek reject its own required interactive DGX Station express prompt, so the documented curl-pipe install aborted immediately. The two signals are orthogonal -- one accepts a licence, the other opts into an interactive express flow. Skip the inference when --station-deepseek is set so the express prompt is reached; the inference is preserved for every other install (its #4414/#2671 partial-install protection is unchanged). #7009: the conflict error printed the same message regardless of what put the run in non-interactive mode. main() exports NON_INTERACTIVE into NEMOCLAW_NON_INTERACTIVE, so the origin cannot be recovered at error time -- record it during flag parsing and name it in the message ("the --non-interactive flag" or "NEMOCLAW_NON_INTERACTIVE=1"). Verified on a DGX-Station-mocked aarch64 host: the reported command now proceeds past the express preflight without inferring non-interactive; explicit --non-interactive and NEMOCLAW_NON_INTERACTIVE=1 still conflict and now name their trigger; notice acceptance without --station-deepseek still implies non-interactive. Signed-off-by: Yanyun Liao --- scripts/install.sh | 32 +++++++++++++-- test/install-express-prompt.test.ts | 62 +++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 6 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 591cc4cad69..9e6e63d9f86 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2885,7 +2885,13 @@ validate_station_deepseek_override() { error "--station-deepseek cannot be combined with NEMOCLAW_NO_EXPRESS=1. Remove one override." fi if [ "${NON_INTERACTIVE:-}" = "1" ]; then - error "--station-deepseek selects the DGX Station express prompt and cannot be combined with --non-interactive." + # #7009: name what actually put the run in non-interactive mode so the user + # can act on it. NON_INTERACTIVE_SOURCE is recorded in main() where the + # origin is still known (main exports NON_INTERACTIVE into + # NEMOCLAW_NON_INTERACTIVE, erasing the distinction here). Fall back to the + # flag wording for direct callers (tests) that set NON_INTERACTIVE without + # going through main's flag parsing. + error "--station-deepseek selects the DGX Station express prompt and cannot be combined with non-interactive mode (triggered by: ${NON_INTERACTIVE_SOURCE:-the --non-interactive flag})." fi if [ -n "${NEMOCLAW_PROVIDER:-}" ]; then error "--station-deepseek conflicts with NEMOCLAW_PROVIDER=${NEMOCLAW_PROVIDER}. Remove the provider override to use Station express install." @@ -3099,12 +3105,20 @@ main() { # Parse flags NON_INTERACTIVE="" + # #7009: record what put the run in non-interactive mode so conflict errors + # (e.g. validate_station_deepseek_override) can name the trigger. main() + # exports NON_INTERACTIVE into NEMOCLAW_NON_INTERACTIVE below, so the origin + # cannot be recovered from the env at error time — track it here instead. + NON_INTERACTIVE_SOURCE="" ACCEPT_THIRD_PARTY_SOFTWARE="" FRESH="" STATION_DEEPSEEK="" for arg in "$@"; do case "$arg" in - --non-interactive) NON_INTERACTIVE=1 ;; + --non-interactive) + NON_INTERACTIVE=1 + NON_INTERACTIVE_SOURCE="the --non-interactive flag" + ;; --yes-i-accept-third-party-software) ACCEPT_THIRD_PARTY_SOFTWARE=1 ;; --fresh) FRESH=1 ;; --station-deepseek) STATION_DEEPSEEK=1 ;; @@ -3126,6 +3140,9 @@ main() { done # Also honor env var NON_INTERACTIVE="${NON_INTERACTIVE:-${NEMOCLAW_NON_INTERACTIVE:-}}" + if [ "${NON_INTERACTIVE:-}" = "1" ] && [ -z "${NON_INTERACTIVE_SOURCE:-}" ]; then + NON_INTERACTIVE_SOURCE="NEMOCLAW_NON_INTERACTIVE=1" + fi ACCEPT_THIRD_PARTY_SOFTWARE="${ACCEPT_THIRD_PARTY_SOFTWARE:-${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-}}" FRESH="${FRESH:-${NEMOCLAW_FRESH:-}}" @@ -3135,8 +3152,17 @@ main() { # (run_onboard has the same gate). Without this, ACCEPT_THIRD_PARTY_SOFTWARE=1 # alone clears the preflight below but the install can still partial-fail at # run_onboard with the same TTY error, leaving phases 1/2 on disk anyway. - if [ "${ACCEPT_THIRD_PARTY_SOFTWARE:-}" = "1" ] && [ "${NON_INTERACTIVE:-}" != "1" ]; then + # + # #7008: `--station-deepseek` is the exception — it explicitly selects the + # interactive DGX Station express prompt, so accepting the notice must NOT + # imply non-interactive there. The two signals are orthogonal: one accepts a + # licence, the other opts into an interactive express flow. Inferring + # non-interactive from the notice would make the express flow reject its own + # required flag (validate_station_deepseek_override). + if [ "${ACCEPT_THIRD_PARTY_SOFTWARE:-}" = "1" ] && [ "${NON_INTERACTIVE:-}" != "1" ] && + [ "${STATION_DEEPSEEK:-}" != "1" ]; then NON_INTERACTIVE=1 + NON_INTERACTIVE_SOURCE="NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 (implies --non-interactive)" fi export NEMOCLAW_NON_INTERACTIVE="${NON_INTERACTIVE}" diff --git a/test/install-express-prompt.test.ts b/test/install-express-prompt.test.ts index 65ba31f39fd..899af34def6 100644 --- a/test/install-express-prompt.test.ts +++ b/test/install-express-prompt.test.ts @@ -296,12 +296,20 @@ detect_express_platform message: /--station-deepseek requires a detected DGX Station \(detected: DGX Spark\)/, }, { - name: "a conflicting non-interactive flag", + name: "a conflicting non-interactive flag (names the flag as the trigger)", args: ["--station-deepseek", "--non-interactive"], platform: "DGX Station", env: {}, message: - /--station-deepseek selects the DGX Station express prompt and cannot be combined with --non-interactive/, + /--station-deepseek selects the DGX Station express prompt and cannot be combined with non-interactive mode \(triggered by: the --non-interactive flag\)/, + }, + { + name: "a conflicting NEMOCLAW_NON_INTERACTIVE env var (names the env var as the trigger)", + args: ["--station-deepseek"], + platform: "DGX Station", + env: { NEMOCLAW_NON_INTERACTIVE: "1" }, + message: + /--station-deepseek selects the DGX Station express prompt and cannot be combined with non-interactive mode \(triggered by: NEMOCLAW_NON_INTERACTIVE=1\)/, }, { name: "a conflicting Station model", @@ -356,9 +364,57 @@ main "$@" fs.rmSync(tmp, { recursive: true, force: true }); }); + it("proceeds past the express preflight for --station-deepseek with NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 (#7008)", () => { + // #7008: accepting the third-party-software notice must NOT imply + // --non-interactive when --station-deepseek explicitly selects the + // interactive DGX Station express prompt. The two signals are orthogonal. + const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-station-accept3p-")); + const result = spawnSync( + "bash", + [ + "--noprofile", + "--norc", + "-c", + ` +source "$INSTALLER_UNDER_TEST" >/dev/null +detect_express_platform() { printf "%s" "$EXPRESS_PLATFORM"; } +print_banner() { :; } +# Stop main cleanly right after preflight_explicit_express_flags passes, echoing +# NON_INTERACTIVE so the test can confirm the notice env var did not infer it. +preflight_usage_notice_prompt() { printf "PROCEEDED NON_INTERACTIVE=%s\\n" "\${NON_INTERACTIVE:-}"; exit 0; } +main "$@" +`, + "_", + "--station-deepseek", + ], + { + cwd: tmp, + encoding: "utf-8", + env: { + HOME: tmp, + PATH: TEST_SYSTEM_PATH, + INSTALLER_UNDER_TEST: INSTALLER_PAYLOAD, + EXPRESS_PLATFORM: "DGX Station", + NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1", + }, + }, + ); + const output = `${result.stdout}${result.stderr}`; + expect(result.status, output).toBe(0); + expect(output).toMatch(/PROCEEDED NON_INTERACTIVE=/); + // The notice acceptance must not have flipped the run non-interactive. + expect(output).not.toMatch(/PROCEEDED NON_INTERACTIVE=1/); + expect(output).not.toMatch(/cannot be combined with non-interactive mode/); + fs.rmSync(tmp, { recursive: true, force: true }); + }); + it.each([ ["NEMOCLAW_NO_EXPRESS", "1", /cannot be combined with NEMOCLAW_NO_EXPRESS=1/], - ["NON_INTERACTIVE", "1", /cannot be combined with --non-interactive/], + [ + "NON_INTERACTIVE", + "1", + /cannot be combined with non-interactive mode \(triggered by: the --non-interactive flag\)/, + ], ["NEMOCLAW_PROVIDER", "install-vllm", /conflicts with NEMOCLAW_PROVIDER=install-vllm/], ])("rejects %s when the Station demo override would otherwise be ignored", (name, value, message) => { const result = runExpressPromptWithTty("\n", "pipe", "DGX Station", { From 6acdd47cccaf2b73ed882d465f94112b70c6271b Mon Sep 17 00:00:00 2001 From: Yanyun Liao Date: Thu, 16 Jul 2026 17:39:39 +0800 Subject: [PATCH 2/4] style(install): shfmt the #7008 multi-line condition shfmt (-i 2 -ci -bn) puts the binary operator at the start of the continuation line. No behavior change. Signed-off-by: Yanyun Liao --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 9e6e63d9f86..54b135e3bfc 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3159,8 +3159,8 @@ main() { # licence, the other opts into an interactive express flow. Inferring # non-interactive from the notice would make the express flow reject its own # required flag (validate_station_deepseek_override). - if [ "${ACCEPT_THIRD_PARTY_SOFTWARE:-}" = "1" ] && [ "${NON_INTERACTIVE:-}" != "1" ] && - [ "${STATION_DEEPSEEK:-}" != "1" ]; then + if [ "${ACCEPT_THIRD_PARTY_SOFTWARE:-}" = "1" ] && [ "${NON_INTERACTIVE:-}" != "1" ] \ + && [ "${STATION_DEEPSEEK:-}" != "1" ]; then NON_INTERACTIVE=1 NON_INTERACTIVE_SOURCE="NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 (implies --non-interactive)" fi From 214b3efc38d6efee99af5892d08c6f5f6cbc71c8 Mon Sep 17 00:00:00 2001 From: Yanyun Liao Date: Thu, 16 Jul 2026 19:05:17 +0800 Subject: [PATCH 3/4] refactor(install): tidy the #7008/#7009 non-interactive handling - Drop the now-dead NON_INTERACTIVE_SOURCE assignment in the notice-acceptance block: with the #7008 guard it only runs for non-station installs, and its only reader (validate_station_deepseek_override) is station-only, so the value is never read. - Append the "(triggered by: ...)" clause only when the origin is known, so direct callers that set NON_INTERACTIVE without going through flag parsing get a clean message instead of a guessed attribution. No behavior change for real installs: in main(), NON_INTERACTIVE always has a recorded source when it is set. Signed-off-by: Yanyun Liao --- scripts/install.sh | 13 ++++++++----- test/install-express-prompt.test.ts | 8 +++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 54b135e3bfc..61b8a57dd3a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2888,10 +2888,14 @@ validate_station_deepseek_override() { # #7009: name what actually put the run in non-interactive mode so the user # can act on it. NON_INTERACTIVE_SOURCE is recorded in main() where the # origin is still known (main exports NON_INTERACTIVE into - # NEMOCLAW_NON_INTERACTIVE, erasing the distinction here). Fall back to the - # flag wording for direct callers (tests) that set NON_INTERACTIVE without - # going through main's flag parsing. - error "--station-deepseek selects the DGX Station express prompt and cannot be combined with non-interactive mode (triggered by: ${NON_INTERACTIVE_SOURCE:-the --non-interactive flag})." + # NEMOCLAW_NON_INTERACTIVE, erasing the distinction here). Append the clause + # only when the origin is known, so direct callers that set NON_INTERACTIVE + # without going through main's flag parsing still get a clean message. + local trigger_note="" + if [ -n "${NON_INTERACTIVE_SOURCE:-}" ]; then + trigger_note=" (triggered by: ${NON_INTERACTIVE_SOURCE})" + fi + error "--station-deepseek selects the DGX Station express prompt and cannot be combined with non-interactive mode${trigger_note}." fi if [ -n "${NEMOCLAW_PROVIDER:-}" ]; then error "--station-deepseek conflicts with NEMOCLAW_PROVIDER=${NEMOCLAW_PROVIDER}. Remove the provider override to use Station express install." @@ -3162,7 +3166,6 @@ main() { if [ "${ACCEPT_THIRD_PARTY_SOFTWARE:-}" = "1" ] && [ "${NON_INTERACTIVE:-}" != "1" ] \ && [ "${STATION_DEEPSEEK:-}" != "1" ]; then NON_INTERACTIVE=1 - NON_INTERACTIVE_SOURCE="NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 (implies --non-interactive)" fi export NEMOCLAW_NON_INTERACTIVE="${NON_INTERACTIVE}" diff --git a/test/install-express-prompt.test.ts b/test/install-express-prompt.test.ts index 899af34def6..d7d7d64741d 100644 --- a/test/install-express-prompt.test.ts +++ b/test/install-express-prompt.test.ts @@ -410,11 +410,9 @@ main "$@" it.each([ ["NEMOCLAW_NO_EXPRESS", "1", /cannot be combined with NEMOCLAW_NO_EXPRESS=1/], - [ - "NON_INTERACTIVE", - "1", - /cannot be combined with non-interactive mode \(triggered by: the --non-interactive flag\)/, - ], + // Set directly (bypasses main's flag parsing), so the origin is unknown and + // the "(triggered by: …)" clause is omitted. + ["NON_INTERACTIVE", "1", /cannot be combined with non-interactive mode\./], ["NEMOCLAW_PROVIDER", "install-vllm", /conflicts with NEMOCLAW_PROVIDER=install-vllm/], ])("rejects %s when the Station demo override would otherwise be ignored", (name, value, message) => { const result = runExpressPromptWithTty("\n", "pipe", "DGX Station", { From aa2709645a5290ab7adfebe92a1960408db1878c Mon Sep 17 00:00:00 2001 From: Yanyun Liao Date: Thu, 16 Jul 2026 19:37:16 +0800 Subject: [PATCH 4/4] fix(install): require an interactive terminal for --station-deepseek (#7014) --station-deepseek selects the interactive DGX Station express prompt. With no TTY, maybe_offer_express_install logged "Skipping express prompt (no TTY)" and continued, silently ignoring the flag and installing a different configuration. This surfaces once #7008 stops notice acceptance from forcing non-interactive, which lets accept-notice + --station-deepseek reach the express step. Add a TTY-availability check to validate_station_deepseek_override so the flag fails fast at preflight (before Docker / build deps) with a clear message, mirroring the existing --non-interactive rejection. Checked last so a genuine provider/model conflict is still reported first. A curl|bash pipe with /dev/tty available (the normal interactive case) still proceeds. Verified on a DGX-Station-mocked aarch64 host: no-TTY --station-deepseek now errors before any host mutation; --non-interactive and conflicting-model errors still take precedence; a real pty proceeds. Stacked on #7010 (#7008/#7009), which this builds on. Signed-off-by: Yanyun Liao --- scripts/install.sh | 23 +++++++++++++ test/install-express-prompt.test.ts | 52 +++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 61b8a57dd3a..5599c689b30 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2873,6 +2873,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/null; then + exec 3<&- + return 0 + fi + return 1 +} + validate_station_deepseek_override() { local platform="$1" if [ "${STATION_DEEPSEEK:-}" != "1" ]; then @@ -2909,6 +2921,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() { diff --git a/test/install-express-prompt.test.ts b/test/install-express-prompt.test.ts index d7d7d64741d..e356ea448a5 100644 --- a/test/install-express-prompt.test.ts +++ b/test/install-express-prompt.test.ts @@ -379,9 +379,10 @@ main "$@" source "$INSTALLER_UNDER_TEST" >/dev/null detect_express_platform() { printf "%s" "$EXPRESS_PLATFORM"; } print_banner() { :; } -# Stop main cleanly right after preflight_explicit_express_flags passes, echoing +# Stop main right after flag parsing — before validate (which requires a TTY for +# --station-deepseek, #7014) and before the notice prompt — echoing # NON_INTERACTIVE so the test can confirm the notice env var did not infer it. -preflight_usage_notice_prompt() { printf "PROCEEDED NON_INTERACTIVE=%s\\n" "\${NON_INTERACTIVE:-}"; exit 0; } +preflight_explicit_express_flags() { printf "PROCEEDED NON_INTERACTIVE=%s\\n" "\${NON_INTERACTIVE:-}"; exit 0; } main "$@" `, "_", @@ -408,6 +409,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([ ["NEMOCLAW_NO_EXPRESS", "1", /cannot be combined with NEMOCLAW_NO_EXPRESS=1/], // Set directly (bypasses main's flag parsing), so the origin is unknown and