fix(honcho): plugin drift overhaul -- observation config, chunking, setup wizard, docs, dead code cleanup
Salvaged from PR #5045 by erosika. - Replace memoryMode/peer_memory_modes with granular per-peer observation config - Add message chunking for Honcho API limits (25k chars default) - Add dialectic input guard (10k chars default) - Add dialecticDynamic toggle for reasoning level auto-bump - Rewrite setup wizard with cloud/local deployment picker - Switch peer card/profile/search from session.context() to direct peer APIs - Add server-side observation sync via get_peer_configuration() - Fix base_url/baseUrl config mismatch for self-hosted setups - Fix local auth leak (cloud API keys no longer sent to local instances) - Remove dead code: memoryMode, peer_memory_modes, linkedHosts, suppress flags, SOUL.md aiPeer sync - Add post_setup hook to memory_setup.py for provider-specific setup wizards - Comprehensive README rewrite with full config reference - New optional skill: autonomous-ai-agents/honcho - Expanded memory-providers.md with multi-profile docs - 9 new tests (chunking, dialectic guard, peer lookups), 14 dead tests removed - Fix 2 pre-existing TestResolveConfigPath filesystem isolation failures
This commit is contained in:
@@ -2,13 +2,11 @@
|
||||
|
||||
Covers:
|
||||
- write_frequency parsing (async / turn / session / int)
|
||||
- memory_mode parsing
|
||||
- resolve_session_name with session_title
|
||||
- HonchoSessionManager.save() routing per write_frequency
|
||||
- async writer thread lifecycle and retry
|
||||
- flush_all() drains pending messages
|
||||
- shutdown() joins the thread
|
||||
- memory_mode gating helpers (unit-level)
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -42,10 +40,9 @@ def _make_session(**kwargs) -> HonchoSession:
|
||||
)
|
||||
|
||||
|
||||
def _make_manager(write_frequency="turn", memory_mode="hybrid") -> HonchoSessionManager:
|
||||
def _make_manager(write_frequency="turn") -> HonchoSessionManager:
|
||||
cfg = HonchoClientConfig(
|
||||
write_frequency=write_frequency,
|
||||
memory_mode=memory_mode,
|
||||
api_key="test-key",
|
||||
enabled=True,
|
||||
)
|
||||
@@ -106,77 +103,6 @@ class TestWriteFrequencyParsing:
|
||||
assert cfg.write_frequency == "async"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# memory_mode parsing from config file
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestMemoryModeParsing:
|
||||
def test_hybrid(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({"apiKey": "k", "memoryMode": "hybrid"}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "hybrid"
|
||||
|
||||
def test_honcho_only(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({"apiKey": "k", "memoryMode": "honcho"}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "honcho"
|
||||
|
||||
def test_defaults_to_hybrid(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({"apiKey": "k"}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "hybrid"
|
||||
|
||||
def test_host_block_overrides_root(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({
|
||||
"apiKey": "k",
|
||||
"memoryMode": "hybrid",
|
||||
"hosts": {"hermes": {"memoryMode": "honcho"}},
|
||||
}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "honcho"
|
||||
|
||||
def test_object_form_sets_default_and_overrides(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({
|
||||
"apiKey": "k",
|
||||
"hosts": {"hermes": {"memoryMode": {
|
||||
"default": "hybrid",
|
||||
"hermes": "honcho",
|
||||
}}},
|
||||
}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "hybrid"
|
||||
assert cfg.peer_memory_mode("hermes") == "honcho"
|
||||
assert cfg.peer_memory_mode("unknown") == "hybrid" # falls through to default
|
||||
|
||||
def test_object_form_no_default_falls_back_to_hybrid(self, tmp_path):
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({
|
||||
"apiKey": "k",
|
||||
"hosts": {"hermes": {"memoryMode": {"hermes": "honcho"}}},
|
||||
}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "hybrid"
|
||||
assert cfg.peer_memory_mode("hermes") == "honcho"
|
||||
assert cfg.peer_memory_mode("other") == "hybrid"
|
||||
|
||||
def test_global_string_host_object_override(self, tmp_path):
|
||||
"""Host object form overrides global string."""
|
||||
cfg_file = tmp_path / "config.json"
|
||||
cfg_file.write_text(json.dumps({
|
||||
"apiKey": "k",
|
||||
"memoryMode": "honcho",
|
||||
"hosts": {"hermes": {"memoryMode": {"default": "hybrid", "hermes": "honcho"}}},
|
||||
}))
|
||||
cfg = HonchoClientConfig.from_global_config(config_path=cfg_file)
|
||||
assert cfg.memory_mode == "hybrid" # host default wins over global "honcho"
|
||||
assert cfg.peer_memory_mode("hermes") == "honcho"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# resolve_session_name with session_title
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -519,27 +445,10 @@ class TestNewConfigFieldDefaults:
|
||||
cfg = HonchoClientConfig()
|
||||
assert cfg.write_frequency == "async"
|
||||
|
||||
def test_memory_mode_default(self):
|
||||
cfg = HonchoClientConfig()
|
||||
assert cfg.memory_mode == "hybrid"
|
||||
|
||||
def test_write_frequency_set(self):
|
||||
cfg = HonchoClientConfig(write_frequency="turn")
|
||||
assert cfg.write_frequency == "turn"
|
||||
|
||||
def test_memory_mode_set(self):
|
||||
cfg = HonchoClientConfig(memory_mode="honcho")
|
||||
assert cfg.memory_mode == "honcho"
|
||||
|
||||
def test_peer_memory_mode_falls_back_to_global(self):
|
||||
cfg = HonchoClientConfig(memory_mode="honcho")
|
||||
assert cfg.peer_memory_mode("any-peer") == "honcho"
|
||||
|
||||
def test_peer_memory_mode_override(self):
|
||||
cfg = HonchoClientConfig(memory_mode="hybrid", peer_memory_modes={"hermes": "honcho"})
|
||||
assert cfg.peer_memory_mode("hermes") == "honcho"
|
||||
assert cfg.peer_memory_mode("other") == "hybrid"
|
||||
|
||||
|
||||
class TestPrefetchCacheAccessors:
|
||||
def test_set_and_pop_context_result(self):
|
||||
|
||||
Reference in New Issue
Block a user