The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-mode): message_agent no longer promises a reply notification a non-push sender cannot receive
teknium18f44cd896814
diff --git a/tests/tools/test_bot_mode_dm.py b/tests/tools/test_bot_mode_dm.pyindex f927faba522..6c3873a2c68 100644--- a/tests/tools/test_bot_mode_dm.py+++ b/tests/tools/test_bot_mode_dm.py@@ -1170,3 +1170,22 @@ def test_relay_waiter_that_cannot_start_reports_queued_not_failed(tmp_path, monkassert "Do NOT resend" in result["detail"]assert "approval" in result["notification_error"]assert list((bot_relay.relay_root(root) / bot_relay.OUTBOX_DIR).glob("*.json")), "envelope still queued"+++def test_ack_names_poll_return_path_when_session_cannot_receive_completions(tmp_path, monkeypatch):+ """#101142: on a non-push sender surface (api_server) terminal_tool refuses the+ ``notify_on_complete`` promise, so the reply can never be injected later. The ack must not+ promise a completion notification; it names the surface-supported return path instead."""+ import tools.terminal_tool as terminal_tool_module++ monkeypatch.setattr(terminal_tool_module, "terminal_tool", lambda command, **kw: json.dumps({+ "output": "Background process started", "session_id": "proc_np1", "notify_on_complete": False,+ "notify_unsupported": "poll"}))+ 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"] == "queued"+ assert result["reply_delivery"] == "poll"+ assert "completion notification carries" not in result["detail"]+ assert "process(action='wait', session_id='proc_np1')" in result["detail"]diff --git a/tools/bot_mode_dm.py b/tools/bot_mode_dm.pyindex 8f88da09ed5..18029a86720 100644--- a/tools/bot_mode_dm.py+++ b/tools/bot_mode_dm.py@@ -650,15 +650,27 @@ def _spawn_delivery(command: str, label: str, *, dm_file: Optional[str] = None,return _err(f"Delivery to {label} failed to start: no process id returned")# From here the background runner owns the file (removed after the consumer finishes).transferred = True+ if parsed.get("notify_on_complete") is False:+ # terminal_tool refused the completion promise: this session (api_server, one-shot+ # runner) cannot receive an async completion, so the recipient's reply would never+ # be injected here (#101142). Say so and name the return path the surface supports.+ detail = (f"Message handed to a background delivery process for {label}, but THIS session "+ "cannot receive completion notifications, so the reply will NOT arrive on its own. "+ f"Before ending your turn, retrieve the outcome with process(action='wait', "+ f"session_id='{proc_id}') — its output is the reply (relay it, attributed to that "+ "agent) or the delivery failure (report it; the message was NOT delivered).")+ else:+ detail = (f"Message queued for {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).")return json.dumps({"status": "queued","delivery_id": delivery_id or (_dm_delivery_id(dm_file) if dm_file else ""),"to": label,- "detail": (f"Message queued for {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)."),+ "reply_delivery": "poll" if parsed.get("notify_on_complete") is False else "notification",+ "detail": detail,"process_id": proc_id,"queued_at": int(time.time()),})