Skip to content

fix(honcho): resolve peers host keys via profile_host_key (underscore form) (#76414) - #76455

Open
spfcraze wants to merge 1 commit into
NousResearch:mainfrom
spfcraze:fix/honcho-peers-host-key
Open

fix(honcho): resolve peers host keys via profile_host_key (underscore form) (#76414)#76455
spfcraze wants to merge 1 commit into
NousResearch:mainfrom
spfcraze:fix/honcho-peers-host-key

Conversation

@spfcraze

@spfcraze spfcraze commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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.py
    • tests/plugins/memory/test_honcho_cli_peers.py

plugins/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):

  1. Sabotage check: pre-fix code fails the regression tests (4 failed), with the fix all pass (4 passed, 0 failed) — target tests/plugins/memory/test_honcho_cli_peers.py.
  2. Suite tests/plugins/memory/: branch 232 passed / 0 failed vs baseline 228 passed / 0 failed — zero branch-only failures.
  3. Duplicate check: 76 potential matches reviewed — none covers this change.
  4. The full repo-wide suite was not run for this change; GitHub CI owns full-suite validation.

Logs

Sabotage verification output:

# base leg (pre-fix code + branch tests):
#   tests: 0 passed, 4 failed
# head leg (with fix):
#   tests: 4 passed, 0 failed

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers area/profiles Multi-profile isolation, HERMES_HOME scoping duplicate This issue or pull request already exists labels Aug 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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.

@spfcraze

spfcraze commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Good catch — confirmed: #64405 by @loveruncaged is the identical fix (same profile_host_key(p.name) replacement at the same site), opened 2026-07-14, 2.5 weeks before this one. Deferring to it.

What's unique here is the regression coverage: tests/plugins/memory/test_honcho_cli_peers.py (4 tests — host keys match the writer form, sanitized profile names resolve, peers output shows populated identities with no key leak, clean fallback for block-less profiles). #64405 touches only cli.py with no tests, so the test file is offered for absorption into #64405, or I can re-propose it as a follow-up once that lands — maintainer's call. Closing keywords aside, happy for this to be closed as duplicate.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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's hosts.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 legacy hermes.work display 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@spfcraze

spfcraze commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 52173c2 (amended, force-pushed). The block lookup now goes through _host_block(cfg, h) instead of a bare hosts.get(h, {}) — the canonical profile_host_key(p.name) resolves first, and legacy dot-form keys (hermes.work) fall back exactly as _host_block() is designed to do, so the README's back-compat promise holds.

New legacy fixture as suggested: a honcho.json keyed hermes.work keeps its configured identity in the peers display — 5/5 tests in tests/plugins/memory/test_honcho_cli_peers.py. Re-verified: all six gates green (sabotage base 3 fail / head 5 pass; fullcheck on tests/plugins/memory/ at 232 passed vs 228 baseline, zero branch-only failures).

Worth noting for the duplicate discussion above: #64405 has the identical gap — it is the same one-line change with the same bare hosts.get. The _host_block swap is a one-line absorb if that PR lands instead of this one.

@spfcraze
spfcraze force-pushed the fix/honcho-peers-host-key branch from d9aed4f to 52173c2 Compare August 1, 2026 23:45
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users area/memory Memory subsystem: store, providers, sync, background reviews labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/memory Memory subsystem: store, providers, sync, background reviews area/profiles Multi-profile isolation, HERMES_HOME scoping comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

honcho: hermes honcho peers shows "(not set)" for non-default profiles — host key built with "." instead of "_"

3 participants