From 181077b7859b7a17d2367389e66d9eec1aa997e3 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 16 Mar 2026 17:22:52 -0700 Subject: [PATCH] fix: hide Honcho session line on CLI load when no API key configured (#1582) HonchoClientConfig.from_env() set enabled=True unconditionally, even when HONCHO_API_KEY was not set. When ~/.honcho/config.json didn't exist, from_global_config() fell back to from_env() and returned enabled=True with a null api_key, causing the Honcho session indicator to display on every CLI launch. Fix: from_env() now sets enabled=bool(api_key), matching the auto-enable logic already used in from_global_config(). Also added api_key guard to the CLI display as defense-in-depth. --- cli.py | 2 +- honcho_integration/client.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli.py b/cli.py index 3fa210ffa..1fc466343 100755 --- a/cli.py +++ b/cli.py @@ -5550,7 +5550,7 @@ class HermesCLI: from honcho_integration.client import HonchoClientConfig from agent.display import honcho_session_line, write_tty hcfg = HonchoClientConfig.from_global_config() - if hcfg.enabled: + if hcfg.enabled and hcfg.api_key: sname = hcfg.resolve_session_name(session_id=self.session_id) if sname: write_tty(honcho_session_line(hcfg.workspace_id, sname) + "\n") diff --git a/honcho_integration/client.py b/honcho_integration/client.py index 507fc9d4f..ccc2f6f25 100644 --- a/honcho_integration/client.py +++ b/honcho_integration/client.py @@ -114,11 +114,12 @@ class HonchoClientConfig: @classmethod def from_env(cls, workspace_id: str = "hermes") -> HonchoClientConfig: """Create config from environment variables (fallback).""" + api_key = os.environ.get("HONCHO_API_KEY") return cls( workspace_id=workspace_id, - api_key=os.environ.get("HONCHO_API_KEY"), + api_key=api_key, environment=os.environ.get("HONCHO_ENVIRONMENT", "production"), - enabled=True, + enabled=bool(api_key), ) @classmethod