fix(honcho): resolve peers host keys via profile_host_key (underscore form) (#76414) - #76455
fix(honcho): resolve peers host keys via profile_host_key (underscore form) (#76414)#76455spfcraze wants to merge 1 commit into
Conversation
Duplicate of #64405: both make the same profile_host_key() replacement in the peers display path. This PR adds useful focused tests, which can be contributed to the earlier open implementation. |
|
Good catch — confirmed: #64405 by @loveruncaged is the identical fix (same What's unique here is the regression coverage: |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for adding focused regression coverage; current main still has the canonical host-key mismatch at plugins/memory/honcho/cli.py:1113.
Problems
- Changing only line 1113 to
profile_host_key(p.name)leaves line 1114'shosts.get(h, {})lookup in place. That bypasses_host_block()(plugins/memory/honcho/client.py:46-53), which intentionally falls back to legacy dot-form host keys. The README promises those keys remain readable (plugins/memory/honcho/README.md:279), so this would regress legacyhermes.workdisplay rows. - The new tests cover canonical underscore keys but not the legacy compatibility path.
Suggested changes
- Resolve the canonical key with
profile_host_key(p.name), then obtain the block through_host_block(cfg, h). - Add a legacy dot-form fixture and assert that the peers/status overview preserves its configured identity.
This is an automated hermes-sweeper review.
| @@ -1110,7 +1110,7 @@ def _all_profile_host_configs() -> list[tuple[str, str, dict]]: | |||
| for p in profiles: | |||
| if p.name == "default": | |||
| continue | |||
| h = f"{HOST}.{p.name}" | |||
| h = profile_host_key(p.name) | |||
There was a problem hiding this comment.
Using the canonical key is correct, but pair it with _host_block(cfg, h) on the next line rather than hosts.get(h, {}). _host_block() preserves the documented fallback for legacy hermes.<profile> blocks; otherwise this fixes canonical rows while hiding legacy rows in the peers and status-all displays.
… form) (NousResearch#76414) _all_profile_host_configs() built per-profile host keys inline as f"{HOST}.{profile}" ("hermes.work") while profile_host_key() — used by honcho status/enable/sync and the runtime memory plugin — produces the underscore form ("hermes_work"). The lookup always missed, so 'hermes honcho peers' showed "(not set)" / leaked the raw malformed key into the AI-peer column for every non-default profile. Profile names needing sanitization (dots/spaces) were doubly broken. Verified live: with hosts["hermes_work"] populated, cmd_peers showed 'work ... hermes.work' before the fix and 'work ... hermes' after. Tests: host keys match the writer form, sanitized profile names resolve, peers output shows populated identities with no key leak, and clean fallback for profiles without a block.
|
Fixed in 52173c2 (amended, force-pushed). The block lookup now goes through New legacy fixture as suggested: a honcho.json keyed Worth noting for the duplicate discussion above: #64405 has the identical gap — it is the same one-line change with the same bare |
d9aed4f to
52173c2
Compare
What does this PR do?
showed "(not set)" (or the raw malformed key) for every non-default profile. _all_profile_host_configs() built the lookup key inline as f"{HOST}.{profile}" ("hermes.work") while profile_host_key() — used by honcho status/enable/sync and the runtime plugin — produces "hermes_work". The lookup always missed. Use profile_host_key() (already imported) so the CLI reads what the rest of the system writes. Fixes #76414 — root cause as diagnosed by @sashalab in the issue.
Related Issue
#76414
Changes Made
fix/honcho-peers-host-key— 2 file(s) changed vs base:plugins/memory/honcho/cli.pytests/plugins/memory/test_honcho_cli_peers.pyplugins/memory/honcho/cli.py: one line — the inline f"{HOST}.{p.name}" becomes profile_host_key(p.name), which is already imported and also sanitizes profile names (dots/spaces were doubly broken). tests/plugins/memory/test_honcho_cli_peers.py (new, 4 tests): host keys match the writer form, sanitized names resolve, peers output shows populated identities with no key leak, clean fallback for block-less profiles.
How to Test
Live repro on current main (real honcho.json with hosts["hermes_work"] populated, patched list_profiles, RAN): before — 'work alice hermes.work' (the raw malformed key in the AI-peer column; '(not set)' when no top-level peerName masks it). After — 'work alice hermes'.
Validation completed (recorded by prp):
tests/plugins/memory/test_honcho_cli_peers.py.tests/plugins/memory/: branch 232 passed / 0 failed vs baseline 228 passed / 0 failed — zero branch-only failures.Logs
Sabotage verification output: