From 0d7f7396757d2df31bf32e6dcd094f6508ae2bd1 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:14:43 -0700 Subject: [PATCH] fix(setup): use explicit key mapping for returning-user menu dispatch instead of positional index (#3083) Co-authored-by: ygd58 --- hermes_cli/setup.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index ac9cfc38b..6e24426b7 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -3234,12 +3234,17 @@ def run_setup_wizard(args): print_info("Exiting. Run 'hermes setup' again when ready.") return elif 3 <= choice <= 7: - # Individual section - section_idx = choice - 3 - _, label, func = SETUP_SECTIONS[section_idx] - func(config) - save_config(config) - _print_setup_summary(config, hermes_home) + # Individual section — map by key, not by position. + # SETUP_SECTIONS includes TTS but the returning-user menu skips it, + # so positional indexing (choice - 3) would dispatch the wrong section. + _RETURNING_USER_SECTION_KEYS = ["model", "terminal", "gateway", "tools", "agent"] + section_key = _RETURNING_USER_SECTION_KEYS[choice - 3] + section = next((s for s in SETUP_SECTIONS if s[0] == section_key), None) + if section: + _, label, func = section + func(config) + save_config(config) + _print_setup_summary(config, hermes_home) return else: # ── First-Time Setup ──