mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
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.
This commit is contained in:
parent
2158c44efd
commit
181077b785
2 changed files with 4 additions and 3 deletions
2
cli.py
2
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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue