From e2cc24e3311da5575f9e0df256e14e62ff39dab2 Mon Sep 17 00:00:00 2001 From: oxngon <98992931+oxngon@users.noreply.github.com> Date: Sun, 7 Jun 2026 05:05:10 -0700 Subject: [PATCH] fix: respect Honcho env var fallback in doctor and honcho status hermes doctor and hermes honcho status warned 'Honcho config not found' whenever ~/.honcho/config.json was absent, even though HONCHO_API_KEY in .env resolves a working config via HonchoClientConfig.from_global_config() -> from_env(). Both now check hcfg.api_key/base_url before warning. Co-authored-by: oxngon <98992931+oxngon@users.noreply.github.com> --- hermes_cli/doctor.py | 10 +++++++++- plugins/memory/honcho/cli.py | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.py index a279306a94f..619d00df8ab 100644 --- a/hermes_cli/doctor.py +++ b/hermes_cli/doctor.py @@ -2040,7 +2040,15 @@ def run_doctor(args): _honcho_cfg_path = resolve_config_path() if not _honcho_cfg_path.exists(): - check_warn("Honcho config not found", "run: hermes memory setup") + # Config file missing — but env var fallback may have resolved it. + # Only warn if the config didn't actually resolve from env vars. + if hcfg.api_key or hcfg.base_url: + check_ok( + "Honcho configured via environment variables", + f"config file {_honcho_cfg_path} not found, using HONCHO_API_KEY env var", + ) + else: + check_warn("Honcho config not found", "run: hermes memory setup") elif not hcfg.enabled: check_info(f"Honcho disabled (set enabled: true in {_honcho_cfg_path} to activate)") elif not (hcfg.api_key or hcfg.base_url): diff --git a/plugins/memory/honcho/cli.py b/plugins/memory/honcho/cli.py index ce2af8a08b2..16f81ef88e9 100644 --- a/plugins/memory/honcho/cli.py +++ b/plugins/memory/honcho/cli.py @@ -878,9 +878,21 @@ def cmd_status(args) -> None: write_path = _local_config_path() if not cfg: - print(f" No Honcho config found at {active_path}") - print(" Run 'hermes honcho setup' to configure.\n") - return + # Config file missing — try env var fallback before giving up. + try: + from plugins.memory.honcho.client import HonchoClientConfig + _env_cfg = HonchoClientConfig.from_global_config(host=_host_key()) + if _env_cfg.api_key or _env_cfg.base_url: + # Env var fallback worked — use that config instead. + cfg = {"apiKey": _env_cfg.api_key, "enabled": _env_cfg.enabled} + else: + print(f" No Honcho config found at {active_path}") + print(" Run 'hermes honcho setup' to configure.\n") + return + except Exception: + print(f" No Honcho config found at {active_path}") + print(" Run 'hermes honcho setup' to configure.\n") + return try: from plugins.memory.honcho.client import HonchoClientConfig, get_honcho_client