fix(honcho): sanitize workspace/peer IDs to strip dots and special characters (#30246) - #30291
Closed
kagura-agent wants to merge 2 commits into
Closed
fix(honcho): sanitize workspace/peer IDs to strip dots and special characters (#30246)#30291kagura-agent wants to merge 2 commits into
kagura-agent wants to merge 2 commits into
Conversation
…aracters (NousResearch#30246) Honcho validates IDs with ^[a-zA-Z0-9_-]+$ but profile-derived identifiers can contain dots (e.g. hermes.asher), causing session registration failures. Add _sanitize_honcho_id() to replace non-alphanumeric characters with hyphens (hermes.asher -> hermes-asher), applied to workspace_id and ai_peer in both from_global_config() and from_env(). Adds 10 regression tests covering sanitization and config integration.
Collaborator
Contributor
Author
|
Thanks @alt-glitch — closing in favor of #26478 which addresses the same root cause. Apologies for the duplicate! |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #30246 — Honcho memory plugin generates invalid workspace/peer IDs for profile names containing dots.
Problem
resolve_active_host()produces host keys likehermes.asherfor non-default profiles. These are used asworkspace_idandai_peerinHonchoClientConfig, but Honcho validates IDs with^[a-zA-Z0-9_-]+$— dots are rejected, causing session registration failures even when the Honcho backend is healthy and reachable.Fix
Add
_sanitize_honcho_id()helper that replaces characters outside[a-zA-Z0-9_-]with hyphens (hermes.asher→hermes-asher). Applied toworkspace_idandai_peerin bothfrom_global_config()andfrom_env().The sanitization pattern matches the existing
_sanitize_id()insession.py(which already handles session/peer IDs at the session level) — this fix closes the gap for workspace and AI peer IDs at the config level.Testing
test_honcho_client_config.py:_sanitize_honcho_id()(dots, colons, valid passthrough, edge cases)from_global_config()andfrom_env()produce sanitized IDs