Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Agent guides CI: pass optional installer flags only while the installer takes them (#11878)

Daniel Han0b99d88371d8
diff --git a/.github/scripts/agent-guides-install.sh b/.github/scripts/agent-guides-install.sh
index ba50deadd90..6ba4d5b2303 100755
--- a/.github/scripts/agent-guides-install.sh
+++ b/.github/scripts/agent-guides-install.sh
@@ -36,18 +36,50 @@ npm_retry() {
return 1
}
+# An installer option written as ?--flag is one we pass only to save time, and it
+# is kept only while the downloaded installer still parses it as a case label: a
+# line that opens with it, alone or among |-joined alternatives, so a comment or
+# help text that still names a removed option does not count.
+# These installers track the vendor's main branch and treat any unknown option as
+# fatal, so a vendor dropping a nicety turned every PR red: hermes removed
+# --no-skills on 2026-09-24. Everything else is required and passed as written.
+installer_args() {
+ local script="$1"; shift
+ local arg flag
+ for arg in "$@"; do
+ if [[ "$arg" == \?* ]]; then
+ flag="${arg#\?}"
+ if grep -qE -- "^[[:space:]]*\(?([^[:space:]#|()]+\|)*${flag}(\|[^[:space:]|()]+)*\)" "$script"; then
+ printf '%s\n' "$flag"
+ else
+ echo "[install] the installer no longer takes $flag; installing without it" | tee -a "$LOG" >&2
+ fi
+ else
+ printf '%s\n' "$arg"
+ fi
+ done
+}
+
# curl|bash installers, retried at the curl layer. We download to a temp file
# first and only execute on a fully successful fetch, so a truncated download
# (network hiccup mid-stream) can never run a half-written installer.
curl_bash() {
local url="$1"; shift
local i tmp
+ local arg
+ local -a args
tmp="$(mktemp)"
for i in 1 2 3; do
- if curl -fsSL --retry 3 --retry-delay 5 "$url" -o "$tmp" 2>>"$LOG" \
- && bash "$tmp" "$@" >> "$LOG" 2>&1; then
- rm -f "$tmp"
- return 0
+ if curl -fsSL --retry 3 --retry-delay 5 "$url" -o "$tmp" 2>>"$LOG"; then
+ args=()
+ # A read loop: the bash 3.2 macOS ships has no builtin that reads lines into an array.
+ while IFS= read -r arg; do
+ args+=("$arg")
+ done < <(installer_args "$tmp" "$@")
+ if bash "$tmp" ${args[@]+"${args[@]}"} >> "$LOG" 2>&1; then
+ rm -f "$tmp"
+ return 0
+ fi
fi
echo "[install] curl|bash $url attempt $i failed; backing off $((i * 10))s" | tee -a "$LOG"
sleep "$((i * 10))"
@@ -95,7 +127,7 @@ case "$AGENT" in
# start.py install_hint:
# curl -fsSL .../NousResearch/hermes-agent/main/scripts/install.sh | bash
curl_bash "https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh" \
- --non-interactive --skip-setup --skip-browser --no-skills \
+ --non-interactive '?--skip-setup' '?--skip-browser' '?--no-skills' \
|| install_fail "hermes installer failed"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
;;
diff --git a/tests/studio/test_agent_guides_install_flags.py b/tests/studio/test_agent_guides_install_flags.py
new file mode 100644
index 00000000000..8129bc10f53
--- /dev/null
+++ b/tests/studio/test_agent_guides_install_flags.py
@@ -0,0 +1,164 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+"""
+agent-guides-install.sh must not go red because a vendor dropped an option we
+only passed to save time.
+
+The curl|bash installers track the vendor's main branch and exit on any option
+they do not know. On 2026-09-24 hermes-agent rewrote its argument parser without
+--no-skills, and every PR's `connection (hermes, stable)` job failed three times
+over with `unknown option: --no-skills` before the agent was ever launched.
+
+These run the script's own curl_bash against a local installer shaped like the
+vendor's, so they need bash and curl but no network.
+"""
+
+from __future__ import annotations
+
+import re
+import shlex
+import shutil
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+
+REPO_ROOT = Path(__file__).resolve().parents[2]
+SCRIPT = REPO_ROOT / ".github" / "scripts" / "agent-guides-install.sh"
+HERMES_URL = "https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh"
+
+pytestmark = pytest.mark.skipif(
+ sys.platform == "win32" or not shutil.which("bash") or not shutil.which("curl"),
+ reason = "runs the installer helpers under bash with a file:// installer",
+)
+
+
+def _source() -> str:
+ return SCRIPT.read_text(encoding = "utf-8")
+
+
+def _function(name: str) -> str:
+ match = re.search(rf"^{name}\(\) \{{\n.*?^\}}\n", _source(), re.M | re.S)
+ assert match, f"{name} is gone from {SCRIPT.name}"
+ return match.group(0)
+
+
+def _hermes_args() -> list[str]:
+ """The options the hermes recipe passes, exactly as the script writes them."""
+ match = re.search(
+ rf'curl_bash "{re.escape(HERMES_URL)}" \\\n(.*?)\\\n',
+ _source(),
+ re.S,
+ )
+ assert match, "the hermes recipe no longer calls curl_bash on the vendor installer"
+ return shlex.split(match.group(1))
+
+
+def _installer(
+ tmp_path: Path,
+ known: list[str],
+ preamble: str = "",
+) -> Path:
+ """A vendor installer: records its arguments, and exits on any it does not parse."""
+ record = tmp_path / "argv"
+ labels = "|".join(known)
+ script = tmp_path / "install.sh"
+ # Recorded before parsing, so a rejected run still shows what it was given.
+ script.write_text(
+ preamble + f"printf '%s\\n' \"$@\" > {shlex.quote(str(record))}\n"
+ "while [ $# -gt 0 ]; do\n"
+ ' case "$1" in\n'
+ f" {labels}) shift ;;\n"
+ ' *) echo "unknown option: $1" >&2; exit 1 ;;\n'
+ " esac\n"
+ "done\n",
+ encoding = "utf-8",
+ )
+ return script
+
+
+def _curl_bash(tmp_path: Path, installer: Path, args: list[str]) -> subprocess.CompletedProcess:
+ helpers = tmp_path / "helpers.sh"
+ # sleep is the retry backoff: three rejected attempts would otherwise cost a minute.
+ helpers.write_text(
+ "sleep() { :; }\n" + _function("installer_args") + _function("curl_bash"),
+ encoding = "utf-8",
+ )
+ command = (
+ "set -uo pipefail\n"
+ f"LOG={shlex.quote(str(tmp_path / 'install.log'))}\n"
+ f". {shlex.quote(str(helpers))}\n"
+ f"curl_bash {shlex.quote(installer.as_uri())} {' '.join(shlex.quote(a) for a in args)}\n"
+ )
+ return subprocess.run(["bash", "-c", command], capture_output = True, text = True, timeout = 60)
+
+
+def _received(tmp_path: Path) -> list[str]:
+ return (tmp_path / "argv").read_text(encoding = "utf-8").split()
+
+
+def test_the_hermes_recipe_installs_once_the_vendor_drops_no_skills(tmp_path: Path) -> None:
+ # The parser hermes-agent shipped on 2026-09-24.
+ installer = _installer(
+ tmp_path,
+ ["--non-interactive", "--skip-setup", "--skip-browser|--no-playwright|-SkipBrowser"],
+ )
+ result = _curl_bash(tmp_path, installer, _hermes_args())
+ assert result.returncode == 0, (tmp_path / "install.log").read_text(encoding = "utf-8")
+ assert _received(tmp_path) == ["--non-interactive", "--skip-setup", "--skip-browser"]
+ assert "no longer takes --no-skills" in (tmp_path / "install.log").read_text(encoding = "utf-8")
+
+
+def test_an_optional_flag_the_installer_still_parses_is_passed(tmp_path: Path) -> None:
+ installer = _installer(tmp_path, ["--non-interactive", "--no-skills"])
+ result = _curl_bash(tmp_path, installer, ["--non-interactive", "?--no-skills"])
+ assert result.returncode == 0
+ assert _received(tmp_path) == ["--non-interactive", "--no-skills"]
+
+
+def test_a_flag_is_not_kept_for_a_longer_one_that_starts_with_it(tmp_path: Path) -> None:
+ installer = _installer(tmp_path, ["--non-interactive", "--skip-setup"])
+ result = _curl_bash(tmp_path, installer, ["--non-interactive", "?--skip"])
+ assert result.returncode == 0
+ assert _received(tmp_path) == ["--non-interactive"]
+
+
+def test_a_required_flag_the_installer_dropped_still_fails(tmp_path: Path) -> None:
+ """Only the ?-marked niceties are forgiven: losing one we depend on is real drift."""
+ installer = _installer(tmp_path, ["--skip-setup"])
+ result = _curl_bash(tmp_path, installer, ["--non-interactive", "?--skip-setup"])
+ assert result.returncode != 0
+ assert _received(tmp_path) == ["--non-interactive", "--skip-setup"]
+
+
+def test_a_removed_flag_still_named_outside_the_parser_is_not_kept(tmp_path: Path) -> None:
+ """A comment, help text or migration note naming the old option is not a case label."""
+ preamble = (
+ "# removed --no-skills) in favour of always syncing skills\n"
+ 'usage() { echo " --no-skills) gone: skills always sync"; }\n'
+ "NOTE='--no-skills|--quiet) were retired'\n"
+ )
+ installer = _installer(tmp_path, ["--non-interactive"], preamble)
+ result = _curl_bash(tmp_path, installer, ["--non-interactive", "?--no-skills"])
+ assert result.returncode == 0, (tmp_path / "install.log").read_text(encoding = "utf-8")
+ assert _received(tmp_path) == ["--non-interactive"]
+
+
+def test_a_flag_among_alternatives_is_kept(tmp_path: Path) -> None:
+ installer = _installer(
+ tmp_path, ["--non-interactive", "--no-playwright|--skip-browser|-SkipBrowser"]
+ )
+ result = _curl_bash(tmp_path, installer, ["--non-interactive", "?--skip-browser"])
+ assert result.returncode == 0
+ assert _received(tmp_path) == ["--non-interactive", "--skip-browser"]
+
+
+def test_the_helpers_run_on_the_bash_macos_ships() -> None:
+ """bash 3.2 has neither mapfile nor readarray."""
+ for name in ("installer_args", "curl_bash"):
+ assert not re.search(r"\b(mapfile|readarray)\b", _function(name)), name
+
+
+def test_hermes_still_passes_non_interactive_as_required() -> None:
+ assert "--non-interactive" in _hermes_args()