fix(honcho): drop non-printable base_url values before client init (salvage of #2757 by @teyrebaz33) - #62757
fix(honcho): drop non-printable base_url values before client init (salvage of #2757 by @teyrebaz33)#62757Bartok9 wants to merge 2 commits into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for preserving the focused URL-safety fix and crediting the original report. The current main path is still vulnerable: plugins/memory/honcho/client.py:391, :454-459, and :850 accept base URLs without printable-character validation before Honcho(**kwargs) receives the resolved value at :913.
Problems
plugins/memory/honcho/client.py:870in this PR callssanitize_url(...), but the helper added by the PR is named_sanitize_url(...). The surrounding config-load block catchesException(plugins/memory/honcho/client.py:843-857on current main), so the resultingNameErrorsilently drops the entire config.yaml override rather than applying the intended fail-open behavior.- The added tests in
tests/test_honcho_client_config.py:128-156cover JSON config and environment resolution, but not the changed config.yaml override path.
Suggested changes
- Use
_sanitize_url(...)at the config.yaml override call site. - Add a test that reaches the
get_honcho_client()config.yaml override path with a control character, so this spelling and integration path are covered.
Automated hermes-sweeper review.
| @@ -847,7 +867,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) | |||
There was a problem hiding this comment.
_sanitize_url is the helper introduced above; sanitize_url is undefined. Because the surrounding config-loading block catches Exception, this NameError is swallowed and the config.yaml override is silently ignored. Please call _sanitize_url(...) here.
|
Addressed review: `sanitize_url(...)` → `_sanitize_url(...)` at the config.yaml override path so NameError is not swallowed. Verification: `pytest tests/test_honcho_client_config.py tests/test_honcho_client_concurrency.py` → 14 passed. |
|
Rebased onto current Review (
Local: Ready for re-review. Not merging from author side. |
2afcda5 to
22843e7
Compare
…alvage of NousResearch#2757 by @teyrebaz33) Rebuilt on latest main (Bartok9 hygiene 2026-08-01). Original: NousResearch#62757
|
Rebuilt onto latest — Bartok9 public PR hygiene 2026-08-01 |
22843e7 to
fa7b76c
Compare
…tok9 Per-PR attribution so check-attribution passes on this branch (Teknium).
|
Closing as superseded — the fix is already on Evidence (traced, not assumed):
Original upstream intent still tracked via #2757 if that PR has remaining scope beyond base_url sanitization. |
|
Superseded by main commit 41d77ca (same _sanitize_url fix already on origin/main). |
Summary
Salvages the core URL-safety portion of #2757 by @teyrebaz33 onto current main.
What the original PR fixed
A terminal escape sequence accidentally pasted into
honcho.base_url/HONCHO_BASE_URLcaused Honcho SDK construction to raiseInvalid non-printable ASCII characterand poisoned startup.Why it needed salvage
plugins/memory/honcho/honcho disableCLI surface; this salvage keeps the high-value fail-open sanitize only (small, mergeable)Changes from original
_sanitize_urlintoplugins/memory/honcho/client.pyTesting
Full credit to @teyrebaz33 for root cause and original patch.