The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-mode): a named bot relays a connection-qualified target through its own folder
Teknium35ea64a2fc45
diff --git a/tests/tools/test_bot_mode_dm.py b/tests/tools/test_bot_mode_dm.pyindex ad92635d015..7525091d5a2 100644--- a/tests/tools/test_bot_mode_dm.py+++ b/tests/tools/test_bot_mode_dm.py@@ -403,6 +403,24 @@ def test_relay_ack_is_queued_with_the_envelope_id(tmp_path, monkeypatch):assert result["delivery_id"] == envelope["id"]+def test_named_bot_relays_a_qualified_target_through_its_own_folder(tmp_path, monkeypatch):+ """A named bot messaging its same-named remote counterpart is offered 'researcher@box' (the bare+ form is reserved locally); that DM must queue in the sender's own relay folder, never the default's."""+ _capture_spawn(monkeypatch)+ home = _managed_home(tmp_path, teammates=("researcher",))+ sender_home = home / "profiles" / "researcher"+ row = {"profile": "researcher", "handle": "researcher", "connection_id": "box", "connection_label": "box"}+ for folder in (home, sender_home):+ bot_relay.write_remote_roster(folder, [row])+ result = json.loads(bot_mode_dm.message_agent_tool(+ target="researcher@box", message="ping", agent=_FakeAgent(sender_home)))++ assert result["status"] == "queued", result+ assert bot_relay.claim_pending_envelopes(home) == []+ (envelope,) = bot_relay.claim_pending_envelopes(sender_home)+ assert envelope["from_profile"] == "researcher" and envelope["target_connection"] == "box"++def _rename(home: Path, folder: str, *, display_name: str = "", title: str = "") -> None:lines = ["description: teammate for tests", "ui_meta:", " hermes-bots:", " shape: cloud"]if title:diff --git a/tools/bot_mode_dm.py b/tools/bot_mode_dm.pyindex 93f76750e6d..3d5e0e643ad 100644--- a/tools/bot_mode_dm.py+++ b/tools/bot_mode_dm.py@@ -273,7 +273,8 @@ def message_agent_tool(target: str = "", message: str = "", task_id: Optional[st# hands out for a colliding row, and stamps on replies. Resolved locally first, a local bot whose friendly# name slugs to 'hermes-mini' captured it. An '@' name no connection answers to still resolves locally.if "@" in raw_target.strip().lstrip("@"):- relayed = _try_relay_delivery(root, raw_target, content, me, **delivery)+ # The sender's own relay folder, as below: the default's would relay a named bot's DM as the default.+ relayed = _try_relay_delivery(Path(home), raw_target, content, me, **delivery)if relayed is not None:return relayed# Local teammate — folder id, or a friendly name / Desktop @-slug ('Scribe', 'Dr. Foo').