Skip to content

The agent that grows with you

fix(bot-mode): message_agent ack says it is a dispatch hand-off, not a delivery receipt

teknium1ef49567128bf
diff --git a/tests/tools/test_bot_mode_dm.py b/tests/tools/test_bot_mode_dm.py
index bec852b6897..a2883bbdaa3 100644
--- a/tests/tools/test_bot_mode_dm.py
+++ b/tests/tools/test_bot_mode_dm.py
@@ -312,6 +312,23 @@ def test_local_delivery_command_and_ack(tmp_path, monkeypatch):
assert '$(and this is not shell)' in content
+def test_cli_runner_ack_is_a_dispatch_ack_that_names_the_completion_notification(tmp_path, monkeypatch):
+ """``status: sent`` is returned before the background runner has delivered anything; the
+ detail (and the schema text the model reads) must say the completion notification carries
+ the outcome, so a runner that dies at exec is never read as a delivered message."""
+ _capture_spawn(monkeypatch)
+ home = _managed_home(tmp_path, teammates=("researcher",))
+ result = json.loads(bot_mode_dm.message_agent_tool(
+ target="researcher", message="hi", agent=_FakeAgent(home, title="Bot Chat")))
+
+ assert result["status"] == "sent"
+ assert "not a delivery receipt" in result["detail"]
+ assert "completion notification" in result["detail"]
+ assert "delivery failure" in result["detail"]
+ description = bot_mode_dm.message_agent_tool_schema()["function"]["description"]
+ assert "dispatch acknowledgement" in description and "not a delivery receipt" in description
+
+
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.py
index e274064409c..5b92d8cfbe6 100644
--- a/tools/bot_mode_dm.py
+++ b/tools/bot_mode_dm.py
@@ -69,10 +69,11 @@ def message_agent_tool_schema() -> dict:
"asynchronous, like texting: it validates the target against the live "
"roster, delivers your message into that agent's own Bot Chat with your "
"attribution automatically prefixed, and returns immediately with a "
- "delivery acknowledgement. It does NOT return their reply and you must "
- "not wait or poll for one — send it, finish your turn, and the reply "
- "arrives later as a background-process completion notification that "
- "wakes you. COMPOSE the message yourself: write what YOU want to say to "
+ "dispatch acknowledgement (the hand-off to a background delivery process, "
+ "not a delivery receipt). It does NOT return their reply and you must "
+ "not wait or poll for one — send it, finish your turn, and that process's "
+ "completion notification wakes you with the outcome: their reply, or the "
+ "delivery failure. COMPOSE the message yourself: write what YOU want to say to "
"that agent (lead with the point; include the concrete ask or result). "
"Never paste the user's words verbatim — paraphrase the actionable "
"substance, and keep private 1:1 chat content private. Message one "
@@ -646,9 +647,11 @@ def _spawn_delivery(command: str, label: str, *, dm_file: Optional[str] = None,
return json.dumps({
"status": "sent",
"to": label,
- "detail": (f"Message dispatched to {label}. This is asynchronous — do NOT wait "
- "or poll. Finish your turn now; when the delivery completes, its "
- "notification carries the reply — relay it then, attributed to that agent."),
+ "detail": (f"Message dispatched to {label}: this acknowledges the hand-off to a "
+ "background delivery process, not a delivery receipt — do NOT wait or poll. "
+ "Finish your turn now; that process's completion notification carries the "
+ "delivery outcome — the reply (relay it then, attributed to that agent) or "
+ "the delivery failure (report it; the message was NOT delivered)."),
"process_id": proc_id,
"sent_at": int(time.time()),
})
diff --git a/website/docs/user-guide/bot-mode.md b/website/docs/user-guide/bot-mode.md
index ac6b8d2ef40..5af735f1870 100644
--- a/website/docs/user-guide/bot-mode.md
+++ b/website/docs/user-guide/bot-mode.md
@@ -152,7 +152,7 @@ Bots message each other with attribution, and you can hand work off from any cha
- **@mentions** — type `@researcher have a look at this` in any chat and the composer's `@` autocomplete helps you pick the right Bot; on send, the mention is resolved against the live roster and the active Bot is told exactly who you mean (profile, friendly name, and device for cross-connection Bots). The Bot then composes its own message and sends it with `message_agent` — your text is never forwarded verbatim, and the reply comes back attributed to that agent. An email address or an unknown `@` passes through untouched. Bots on other connected machines are reachable the same way: the Desktop relays the message over that connection's own socket (see *Bots across machines* below).
- **Renamed Bots keep their tags in sync** — give a Bot a friendly name (the pencil in its chat header, or `hermes profile rename`) and it becomes taggable by that name: a Bot titled *Research Buddy* answers to `@research-buddy` (and `@researchbuddy`), in regular chats and in group rooms alike. The composer's `@` autocomplete offers the renamed tag and also matches when you type the old profile name, which keeps resolving too. This includes the primary Bot: rename it *Maia* and group-turn prompts introduce it as `@maia`, its inter-agent messages sign as `Message from 🤖 Maia (@hermes)`, and teammates can `message_agent(target="maia")` it — `@hermes` stays a working alias.
-- **Direct messages** — every Bot Chat carries the `message_agent` tool: a Bot messages a teammate by calling `message_agent(target="researcher", message="…")`. The target is the teammate's profile name, its friendly name (`hermes profile rename` or the Bot Mode title — `Scribe`, `Dr. Foo`) or the `@`-tag the Desktop inserts for it (`@scribe`, `@dr-foo`, `@drfoo`); `@hermes` always means the primary Bot. A profile name is matched first, so it can never be hijacked by another Bot's friendly name, and a friendly name shared by two Bots is refused with the roster instead of guessing. The tool validates the target against the live roster, prefixes the sender's `Message from 🤖 <friendly name> (@<handle>):` attribution automatically, and delivers into the teammate's canonical Bot Chat. Delivery is **fire-and-forget**: the sender gets an acknowledgement, finishes its turn, and the reply arrives later as a background completion notification. The message travels as a real parameter (nothing shell-interpreted — quotes, `$(...)`, and backticks arrive verbatim), and the Bot composes its own message rather than forwarding your words. The teammate roster — names **and roles** from each profile's title/description — is part of every Bot Chat's system prompt, so Bots know who does what before choosing a recipient. The tool exists **only** in canonical Bot Chat sessions on Bot-Mode-managed installs; regular chats, group-room member sessions, and CLI sessions never see it.
+- **Direct messages** — every Bot Chat carries the `message_agent` tool: a Bot messages a teammate by calling `message_agent(target="researcher", message="…")`. The target is the teammate's profile name, its friendly name (`hermes profile rename` or the Bot Mode title — `Scribe`, `Dr. Foo`) or the `@`-tag the Desktop inserts for it (`@scribe`, `@dr-foo`, `@drfoo`); `@hermes` always means the primary Bot. A profile name is matched first, so it can never be hijacked by another Bot's friendly name, and a friendly name shared by two Bots is refused with the roster instead of guessing. The tool validates the target against the live roster, prefixes the sender's `Message from 🤖 <friendly name> (@<handle>):` attribution automatically, and delivers into the teammate's canonical Bot Chat. Delivery is **fire-and-forget**: the sender gets a *dispatch* acknowledgement (`status: sent` means the message was handed to a background delivery process, not that it was delivered), finishes its turn, and that process's completion notification carries the outcome — the reply, or the delivery failure. The message travels as a real parameter (nothing shell-interpreted — quotes, `$(...)`, and backticks arrive verbatim), and the Bot composes its own message rather than forwarding your words. The teammate roster — names **and roles** from each profile's title/description — is part of every Bot Chat's system prompt, so Bots know who does what before choosing a recipient. The tool exists **only** in canonical Bot Chat sessions on Bot-Mode-managed installs; regular chats, group-room member sessions, and CLI sessions never see it.
Local messages also reach a Bot Chat that stays open in Desktop or the TUI. The receiving backend keeps ownership: it reads durable ingress on its existing notification poller, admits immediately when idle, or waits until the running turn and already queued human prompts finish. A `queued` acknowledgement confirms durable admission, **not** a completed reply. The target profile retains the delivery ID and receipt under `runtime/bot_live_delivery/`; `settled` confirms completion. A crashed or cancelled imported turn is not automatically replayed, and pending work pinned to a departed owner remains inspectable rather than being silently rerun. Do not resend a delivery whose outcome is unknown. Older backends without live-delivery capability retain the existing ownership refusal; restart that backend after upgrading.