From 73f2998d48bef52edd3c811288cbdb0844508980 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 3 Mar 2026 18:40:30 -0800 Subject: [PATCH] fix: update setup wizard logic to handle terminal availability Modified the setup wizard to ensure it only skips execution when no terminal is available, improving compatibility with piped installations. Additionally, updated environment variable checks to use bool() for accurate provider configuration detection, addressing potential issues with empty values in .env files. --- hermes_cli/setup.py | 7 +++++-- scripts/install.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index 0bc9acc0..89551f7b 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -395,11 +395,14 @@ def run_setup_wizard(args): # a template, so it always exists after install. We need an actual # inference provider to consider it "existing" (otherwise quick mode # would skip provider selection, leaving hermes non-functional). + # NOTE: Use bool() not `is not None` — the .env template has empty + # values (e.g. OPENROUTER_API_KEY=) that load_dotenv sets to "", which + # passes `is not None` but isn't a real configured provider. from hermes_cli.auth import get_active_provider active_provider = get_active_provider() is_existing = ( - get_env_value("OPENROUTER_API_KEY") is not None - or get_env_value("OPENAI_BASE_URL") is not None + bool(get_env_value("OPENROUTER_API_KEY")) + or bool(get_env_value("OPENAI_BASE_URL")) or active_provider is not None ) diff --git a/scripts/install.sh b/scripts/install.sh index 0e2cf92a..69b5f43f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -848,8 +848,11 @@ run_setup_wizard() { return 0 fi - if [ "$IS_INTERACTIVE" = false ]; then - log_info "Setup wizard skipped (non-interactive). Run 'hermes setup' after install." + # The setup wizard reads from /dev/tty, so it works even when the + # install script itself is piped (curl | bash). Only skip if no + # terminal is available at all (e.g. Docker build, CI). + if ! [ -e /dev/tty ]; then + log_info "Setup wizard skipped (no terminal available). Run 'hermes setup' after install." return 0 fi