fix(honcho): harden self-hosted setup paths#35170
Merged
kshitijk4poor merged 1 commit intoMay 30, 2026
Merged
Conversation
Self-hosted Honcho setup had four sharp edges: - local/cloud URLs ending in /vN double-prefixed by the SDK (/v3/v3/... 404) - authenticated local servers had no setup prompt for a JWT/bearer token - profile-derived host keys could be dot-containing workspace IDs Honcho rejects - memory-provider config files with API keys written world-readable per umask This keeps existing behavior but makes those paths safer: - strip a trailing /vN version segment from any configured baseUrl before SDK init (the SDK's route builders always prepend their own version prefix); auth-skipping stays loopback-only - add an optional local JWT/bearer prompt in honcho setup, stored under hosts.<host>.apiKey - derive new profile host keys with underscores, still reading legacy hermes.<profile> blocks - write memory-provider config files atomically with 0600 via a shared utils.atomic_json_write(mode=) arg (honcho/hindsight/mem0/supermemory) - skip honcho.json parsing in gateway cache-busting unless Honcho is the active memory provider; memoize by honcho.json mtime when active - bust the gateway agent cache on memory.provider change - add a hermes memory setup <provider> one-liner so fresh installs can configure a named provider without the picker (the per-provider hermes <provider> subcommand only registers once that provider is active) Closes NousResearch#20688, NousResearch#29885, NousResearch#26459, NousResearch#30246, NousResearch#33382, NousResearch#32244. Co-authored-by: BROCCOLO1D
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
Salvage of #33954 (Erosika / Plastic Labs) onto current
main. Authorship preserved (commit authored byErosika <eri@plasticlabs.ai>). The original branch wasCONFLICTING— the only conflict wastests/test_packaging_metadata.py, where the PR'spytest.importorskip("setuptools")is now redundant with #34851 (which declared setuptools in the dev extra), so that one-file change was dropped.Self-hosted Honcho setup had four sharp edges, each tied to an open issue:
/vNdouble-prefix → 404 (Bug: Honcho SDK double-prefixing causes 404 errors for self-hosted instances #20688): strip a trailing/vNversion segment from any configuredbaseUrlbefore SDK init. The SDK's route builders always prepend their own version prefix, so a pasted/v3double-prefixes regardless of host (loopback, LAN, Tailscale, custom domain, cloud). Auth-skipping (thelocalplaceholder) stays loopback-only.hermes honcho setup, stored underhosts.<host>.apiKeysoget_honcho_clienttreats it as an explicit local-auth opt-in (cloud/hybrid switching unaffected).hermes_<profile>), while still reading legacyhermes.<profile>host blocks via_host_block().0600permissions, closing the chmod-after-write TOCTOU window. Implemented as a single shared-helper change —utils.atomic_json_writegains amode=arg — so it lands across honcho/hindsight/mem0/supermemory uniformly.Plus gateway cache-correctness (#33382):
honcho.jsonparsing in gateway cache-busting when Honcho is not the active memory provider; memoize byhoncho.jsonmtime when it is active (removes per-message disk I/O for non-Honcho users)memory.providerchange (the provider value gates whetherhoncho.jsonis parsed, but wasn't itself a cache-busting key)And a fresh-install ergonomics fix:
hermes memory setup <provider>one-liner. The per-providerhermes <provider>subcommand only registers once that provider is active, so on a fresh installhermes honcho setupdoesn't exist yet (argparse rejectsinvalid choice: 'honcho').hermes memory setupis always available and now takes an optional positional routing to the same wizard.Closes #20688.
Closes #29885.
Closes #26459.
Closes #30246.
Closes #33382.
Closes #32244.
Core-file touches (justified)
This is a memory-plugin PR that touches a few core files; each is justified:
utils.py— genericmode=arg on the sharedatomic_json_write(one helper change vs. four per-provider copies).gateway/run.py— thefrom plugins.memory.honcho.client import ...import already exists onmain; this PR doesn't add a new core→plugin dependency, it improves the existing one (gates the read behindprovider == "honcho", memoizes by mtime, addsmemory.providercache key).hermes_cli/main.py/memory_setup.py— generic optional positional onmemory setup, provider-agnostic.hermes_cli/profiles.py— dot→underscore host-key migration with legacy fallback.Test plan
Result: 672 passed, 0 failed. New cache-busting behavior is explicitly tested (skip-when-not-honcho, read-only-when-honcho,
memory.providerbusts signature, mtime memoization).tests/hermes_cli/test_memory_setup_provider_arg.pyadds 4 tests for the new routing.E2E verified with real imports + isolated
HERMES_HOME:0600perms on write and preserved on rewrite;profile_host_keydot-sanitization;_host_blocklegacy dot-form fallback;/vNstripping across loopback/Tailscale/LAN/cloud/no-version/mid-path-version; gateway cache-busting gate.ruff + ty clean on changed files.
Credit
memory.providercache-busting key adopted from fix(gateway): skip inactive honcho cache-bust reads #33535 (co-authored credit on the commit).Supersedes #33954, #20720, #30180, #32244, #33535, and the self-hosted/safe-host-key portion of #26478.