From 5d73a11a97ee2cb2407c29a0e486ee5e30e755a1 Mon Sep 17 00:00:00 2001 From: al9000-max <307694510+al9000-max@users.noreply.github.com> Date: Thu, 13 Aug 2026 22:22:35 +0200 Subject: [PATCH] Buzz adapter: honor reply_to_mode instead of always threading replies The Buzz adapter appended --reply-to unconditionally, so every agent reply threaded onto its parent event id with no way to turn it off. reply_to_mode is already a generic PlatformConfig field, parsed for any platform from gateway.platforms..reply_to_mode, and the Discord and Telegram adapters both honor it. Buzz never read it, so setting it was a silent no-op. Read it in __init__ (BUZZ_REPLY_TO_MODE overrides config.yaml, matching how require_mention and transport already work in this adapter) and skip the --reply-to append when it is "off", at all three send paths: send(), send_image(), and the out-of-process _standalone_send() used for deliver=buzz cron delivery. Default is unchanged ("first"), so existing installs keep threading. --- plugins/platforms/buzz/adapter.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.py index 745d2b61ba..f7c3ab9390 100644 --- a/plugins/platforms/buzz/adapter.py +++ b/plugins/platforms/buzz/adapter.py @@ -540,6 +540,15 @@ class BuzzAdapter(BasePlatformAdapter): _rm_cfg = _rm_raw self.require_mention = str(_rm_cfg).strip().lower() not in ("false", "0", "no", "off") + # Reply anchoring: "first"/"all" thread the reply onto the parent event + # id, "off" posts every reply as a normal top-level channel message. + # Mirrors the Discord/Telegram adapters, which already honor this + # PlatformConfig field; without it Buzz threaded unconditionally. + # Env (BUZZ_REPLY_TO_MODE) overrides config.yaml. + _rtm = (os.getenv("BUZZ_REPLY_TO_MODE") or getattr(config, "reply_to_mode", "first") + or "first") + self._reply_to_mode: str = str(_rtm).strip().lower() + # Inbound transport: "auto" (WebSocket with poll fallback, default), # "websocket" (require WS; fail connect when it can't authenticate), # or "poll" (CLI polling only). Env (BUZZ_TRANSPORT) overrides @@ -783,7 +792,7 @@ class BuzzAdapter(BasePlatformAdapter): return SendResult(success=False, error="Empty message") args = ["messages", "send", "--channel", str(chat_id), "--content", "-"] reply_target = (metadata or {}).get("thread_id") or reply_to - if reply_target: + if reply_target and self._reply_to_mode != "off": args += ["--reply-to", str(reply_target)] code, out, err = await self._run_cli(args, input_text=content) if code != 0: @@ -930,7 +939,7 @@ class BuzzAdapter(BasePlatformAdapter): "--content", "-", ] reply_target = (metadata or {}).get("thread_id") or reply_to - if reply_target: + if reply_target and self._reply_to_mode != "off": args += ["--reply-to", str(reply_target)] code, out, err = await self._run_cli(args, input_text=caption or "") if code != 0: @@ -1734,7 +1743,11 @@ async def _standalone_send( return {"error": "Buzz standalone send: no target channel (set BUZZ_HOME_CHANNEL)"} args = ["messages", "send", "--channel", target, "--content", "-"] - if thread_id: + # Same reply_to_mode gate as the live adapter, so out-of-process cron + # delivery (deliver=buzz) doesn't thread when the operator asked for flat. + _rtm = (os.getenv("BUZZ_REPLY_TO_MODE") + or getattr(pconfig, "reply_to_mode", "first") or "first") + if thread_id and str(_rtm).strip().lower() != "off": args += ["--reply-to", str(thread_id)] for path in media_files or []: args += ["--file", str(path)]