From fa7b76c69dc54b75810b3230f36553a6f153d219 Mon Sep 17 00:00:00 2001 From: Seraphine Robbins Date: Sat, 1 Aug 2026 13:37:44 -0400 Subject: [PATCH 1/2] fix(honcho): drop non-printable base_url values before client init (salvage of #2757 by @teyrebaz33) Rebuilt on latest main (Bartok9 hygiene 2026-08-01). Original: #62757 --- plugins/memory/honcho/client.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/plugins/memory/honcho/client.py b/plugins/memory/honcho/client.py index cc1da55ffaf4..e129dae14c5e 100644 --- a/plugins/memory/honcho/client.py +++ b/plugins/memory/honcho/client.py @@ -32,6 +32,26 @@ logger = logging.getLogger(__name__) + +def _sanitize_url(url: str | None) -> str | None: + """Return url unchanged, or None if it contains non-printable ASCII characters. + + A stray terminal escape sequence (e.g. \x1b from copy-paste) in a URL can + cause upstream SDKs to raise ``Invalid non-printable ASCII character`` at + client construction time. Dropping the bad value keeps Honcho disabled with + a clear warning rather than poisoning startup. + """ + if url is None: + return None + if all(0x20 <= ord(c) < 0x7F for c in url): + return url + logger.warning( + "Honcho base_url contains non-printable characters and will be ignored: %r", + url, + ) + return None + + HOST = "hermes" @@ -470,7 +490,7 @@ def from_env( """Create config from environment variables (fallback).""" resolved_host = host or resolve_active_host() api_key = os.environ.get("HONCHO_API_KEY") - base_url = os.environ.get("HONCHO_BASE_URL", "").strip() or None + base_url = _sanitize_url(os.environ.get("HONCHO_BASE_URL", "").strip() or None) timeout = _resolve_optional_float(os.environ.get("HONCHO_TIMEOUT")) return cls( host=resolved_host, @@ -533,7 +553,7 @@ def from_global_config( or raw.get("environment", "production") ) - base_url = ( + base_url = _sanitize_url( raw.get("baseUrl") or raw.get("base_url") or os.environ.get("HONCHO_BASE_URL", "").strip() @@ -1038,7 +1058,7 @@ def _build() -> "Honcho": honcho_cfg = hermes_cfg.get("honcho", {}) if isinstance(honcho_cfg, dict): if not resolved_base_url: - resolved_base_url = honcho_cfg.get("base_url", "").strip() or None + resolved_base_url = _sanitize_url(honcho_cfg.get("base_url", "").strip() or None) if resolved_timeout is None: resolved_timeout = _resolve_optional_float( honcho_cfg.get("timeout"), From 8a401147ff09fd62a30248d3f0828974bc2dc9f3 Mon Sep 17 00:00:00 2001 From: Bartok9 Date: Sat, 1 Aug 2026 16:54:15 -0400 Subject: [PATCH 2/2] chore(contributors): map seraphine@Seraphines-Mac-Studio.local to Bartok9 Per-PR attribution so check-attribution passes on this branch (Teknium). --- contributors/emails/seraphine@Seraphines-Mac-Studio.local | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 contributors/emails/seraphine@Seraphines-Mac-Studio.local diff --git a/contributors/emails/seraphine@Seraphines-Mac-Studio.local b/contributors/emails/seraphine@Seraphines-Mac-Studio.local new file mode 100644 index 000000000000..55d62986543e --- /dev/null +++ b/contributors/emails/seraphine@Seraphines-Mac-Studio.local @@ -0,0 +1,2 @@ +Bartok9 +# Seraphine Mac Studio local email on Bartok9 PR tips (per-PR attribution; Teknium/Daniel 2026-08-01)