Skip to content

The agent that grows with you

fix(honcho): include the workspace in identity_signature

Erosikad96a6d9ab9d8
diff --git a/plugins/memory/honcho/__init__.py b/plugins/memory/honcho/__init__.py
index d1758f732d6..cb9d66c1883 100644
--- a/plugins/memory/honcho/__init__.py
+++ b/plugins/memory/honcho/__init__.py
@@ -575,6 +575,7 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):
cfg = HonchoClientConfig.from_global_config(config_path=path)
aliases = cfg.user_peer_aliases if isinstance(cfg.user_peer_aliases, dict) else {}
values = {
+ "workspace": cfg.workspace_id,
"user_identity": cfg.peer_name,
"agent_identity": cfg.ai_peer,
"pin_user_identity": bool(cfg.pin_peer_name),
diff --git a/tests/honcho_plugin/test_identity_signature.py b/tests/honcho_plugin/test_identity_signature.py
index 4fff940b826..1f8b6cda80f 100644
--- a/tests/honcho_plugin/test_identity_signature.py
+++ b/tests/honcho_plugin/test_identity_signature.py
@@ -21,12 +21,13 @@ def honcho_json(tmp_path, monkeypatch):
def test_signature_uses_neutral_keys(honcho_json):
- honcho_json(peerName="eri", aiPeer="hermes", pinUserPeer=True, runtimePeerPrefix="tg_",
+ honcho_json(workspace="team", peerName="eri", aiPeer="hermes", pinUserPeer=True, runtimePeerPrefix="tg_",
userPeerAliases={"222": "bob", "111": "alice"}, sessionPeerPrefix=True)
sig = HonchoMemoryProvider().identity_signature()
assert sig == {
+ "workspace": "team",
"user_identity": "eri",
"agent_identity": "hermes",
"pin_user_identity": True,
@@ -58,6 +59,19 @@ def test_signature_tracks_edits_to_the_file(honcho_json):
assert provider.identity_signature()["pin_user_identity"] is False
+def test_signature_changes_with_the_workspace(honcho_json):
+ """A cached gateway agent is bound to one workspace, so a workspace switch must miss the cache."""
+ provider = HonchoMemoryProvider()
+ honcho_json(peerName="eri", workspace="team")
+ before = provider.identity_signature()
+
+ honcho_json(peerName="eri", workspace="personal")
+ after = provider.identity_signature()
+
+ assert before != after
+ assert (before["workspace"], after["workspace"]) == ("team", "personal")
+
+
def test_signature_is_memoized_on_an_unchanged_file(honcho_json, monkeypatch):
honcho_json(peerName="eri")
provider = HonchoMemoryProvider()