Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion plugins/platforms/buzz/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,21 @@ def __init__(self, config, **kwargs):
_rm_cfg = _rm_raw
self.require_mention = str(_rm_cfg).strip().lower() not in ("false", "0", "no", "off")

# Whether a reply is threaded onto the message that triggered it.
# Buzz renders a threaded reply as a collapsed "Thread" pane, so with
# this on every answer lands in a sidebar instead of in the channel.
# The gateway anchors every reply to the incoming message
# (gateway/run.py: initial_reply_to_id=ctx.event_message_id, with no
# platform condition), so suppressing it has to happen here. Defaults
# to True (behavior unchanged). Env (BUZZ_REPLY_IN_THREAD) overrides
# config.yaml, mirroring require_mention above.
_rit_raw = os.getenv("BUZZ_REPLY_IN_THREAD")
if _rit_raw is None:
_rit_cfg = extra.get("reply_in_thread", True)
else:
_rit_cfg = _rit_raw
self.reply_in_thread = str(_rit_cfg).strip().lower() not in ("false", "0", "no", "off")

# 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
Expand Down Expand Up @@ -586,6 +601,8 @@ async def send(
return SendResult(success=False, error="Empty message")
args = ["messages", "send", "--channel", str(chat_id), "--content", "-"]
reply_target = reply_to or (metadata or {}).get("thread_id")
if not self.reply_in_thread:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add adapter tests for the false setting, the true default, and BUZZ_REPLY_IN_THREAD precedence. tests/gateway/test_buzz_adapter.py already has config-precedence and recorded-CLI-argument patterns that can assert omission or retention of --reply-to on this exact egress path.

reply_target = None
if reply_target:
args += ["--reply-to", str(reply_target)]
code, out, err = await self._run_cli(args, input_text=content)
Expand Down Expand Up @@ -657,7 +674,7 @@ async def send_image(
"--file", str(local),
"--content", "-",
]
if reply_to:
if reply_to and self.reply_in_thread:
args += ["--reply-to", str(reply_to)]
code, out, err = await self._run_cli(args, input_text=caption or "")
if code != 0:
Expand Down