fix(honcho): use _host_block helper for dot-form legacy host key fallback (fixes #37436) - #37671
Open
Morad37 wants to merge 1 commit into
Open
fix(honcho): use _host_block helper for dot-form legacy host key fallback (fixes #37436)#37671Morad37 wants to merge 1 commit into
Morad37 wants to merge 1 commit into
Conversation
…back (fixes NousResearch#37436) _resolve_or_create_client() used a plain dict.get(config.host) that fails for dot-form profile host keys (e.g. "hermes.profile_a") even though the _host_block() helper defined nearby handles the legacy dot-form → underscore-form fallback correctly. The result: _host_has_key evaluates to False for every authenticating user, so effective_api_key is set to "local" and every Honcho API call returns 401 Invalid JWT — cascade failure into silent data loss for cross-peer queries and message sync. Fixes by calling the existing _host_block() helper instead of reimplementing the direct lookup. Local variable renamed from _host_block → _host_block_local to avoid shadowing the function. Closes NousResearch#37436
5 tasks
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the inconsistent local-auth lookup. The production change matches the existing resolver behavior: current main's _host_block() supports the dot-form fallback at plugins/memory/honcho/client.py:44-51, while the local branch bypasses it at plugins/memory/honcho/client.py:884-887.
Problems
- This PR has no regression test. The existing dot-form test at
tests/honcho_plugin/test_client.py:530-544verifies config loading only; it does not assert that a localhostget_honcho_client()call passes the legacy host's configured key to the SDK. - The equivalent OAuth refresh reads still use direct host lookups at
plugins/memory/honcho/oauth.py:279and:292.get_honcho_client()invokes that refresh atplugins/memory/honcho/client.py:754and:771, so legacy dot-form OAuth grants remain unable to refresh.
Suggested changes
- Add the localhost legacy-host API-key construction regression test.
- Apply the same legacy-key resolution to OAuth reads and preserve the resolved legacy block when persisting a rotated credential.
Automated hermes-sweeper review.
| _raw = config.raw or {} | ||
| _host_block = (_raw.get("hosts") or {}).get(config.host, {}) | ||
| _host_has_key = bool(_host_block.get("apiKey")) | ||
| _host_block_local = _host_block(_raw, config.host) # uses dot-form legacy fallback (#37436) |
Contributor
There was a problem hiding this comment.
Please add a regression test that constructs a localhost client from hosts.hermes.profile_a with active host hermes_profile_a and asserts the SDK receives the configured API key. The current dot-form test covers only from_global_config, not this loopback auth branch.
kshitijk4poor
pushed a commit
that referenced
this pull request
Aug 13, 2026
…orm 401 regression Adds the regression test #37671 shipped without (dot-form legacy host block must keep its explicit apiKey on local base_urls instead of silently degrading to the 'local' placeholder and 401ing every write), its inverse (no host key -> placeholder), and an invariant test pinning the full resolution order the three adopted fixes compose into: host block > endpoint.baseUrl > flat root > HONCHO_BASE_URL > HONCHO_URL.
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.
What does this PR do?
Fixes a silent auth failure in the Honcho runtime client path.
_resolve_or_create_client()reimplemented the host-block lookup as a plaindict.get(config.host)instead of calling the existing_host_block()helper that handles the legacy dot-form-to-underscore-form fallback. Whenconfig.hostishermes_profile_a(underscore — the format returned byprofile_host_key()) but the JSON config stores it ashermes.profile_a(dot — the old format the helper is designed to bridge), the direct lookup misses andeffective_api_keyis set to"local"— every Honcho API call returns 401, silently dropping cross-peer queries and message sync.Changes
plugins/memory/honcho/client.py: 2-line change — replace the bare(_raw.get("hosts") or {}).get(config.host, {})with_host_block(_raw, config.host). Renamed the local from_host_blockto_host_block_localto avoid shadowing the function.How to test
~/.hermes/hermes-agent/venv/bin/python -m pytest tests/honcho_plugin/ -q --timeout=120— 316/316 pass, 17 skipped (unchanged).Notes
~/.hermes/honcho.jsonwith host keys in dot form ("hermes.profile_a") andbaseUrl: "http://localhost:8000"(the_is_localbranch). Before the fix,_host_has_keyis False andeffective_api_key = "local"→ 401 Invalid JWT on every write/read._host_block()tries dot-form first, then falls back to underscore-form, so both formats work.Closes #37436