From c816957a430ed8986fd78e1f201387eabe57267e Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 31 Aug 2026 09:47:36 -0700 Subject: [PATCH] fix(buzz): reconcile media pipeline with landed dispatch + threading contracts Post-rebase composition over #99431/#99429/#99427: file-attachment sends route through _run_message_send so the mention-recovery ladder covers media captions; _send_file_attachment/_send_local_file honor the resolved thread-root anchor and reply_to_mode opt-out; send() records event_meta on the verified receipt id (#75826); test fakes gain the auth_tag kwarg and accepted-receipt shape. --- plugins/platforms/buzz/adapter.py | 4 ++-- tests/gateway/test_buzz_adapter.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.py index 816957313e..74abfe29bc 100644 --- a/plugins/platforms/buzz/adapter.py +++ b/plugins/platforms/buzz/adapter.py @@ -1508,7 +1508,7 @@ class BuzzAdapter(BasePlatformAdapter): ) 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 "") + code, out, err = await self._run_message_send(args, caption or "") if code != 0: return SendResult( success=False, @@ -1576,7 +1576,7 @@ class BuzzAdapter(BasePlatformAdapter): ) 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 "") + code, out, err = await self._run_message_send(args, caption or "") if code != 0: return SendResult( success=False, diff --git a/tests/gateway/test_buzz_adapter.py b/tests/gateway/test_buzz_adapter.py index ab81874da4..18587187f0 100644 --- a/tests/gateway/test_buzz_adapter.py +++ b/tests/gateway/test_buzz_adapter.py @@ -367,7 +367,7 @@ class TestMultiplexProfileScope: async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None): calls["relay"] = relay_url - return 0, '{"event_id": "e1"}', "" + return 0, '{"accepted": true, "event_id": "e1"}', "" monkeypatch.setattr(_buzz_mod, "_exec_buzz", fake_exec) monkeypatch.setattr( @@ -546,7 +546,7 @@ class TestMultiplexProfileScope: async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None): calls["args"] = args - return 0, '{"event_id": "e1"}', "" + return 0, '{"accepted": true, "event_id": "e1"}', "" monkeypatch.setattr(_buzz_mod, "_exec_buzz", fake_exec) monkeypatch.setattr( @@ -2224,6 +2224,7 @@ class TestBuzzAdapterSend: args, _stdin = cli.calls[0] assert args[args.index("--reply-to") + 1] == "stable-root" + @pytest.mark.asyncio @pytest.mark.parametrize( ("stdout", "error_fragment"), [ @@ -3031,15 +3032,16 @@ class TestInboundMediaAuthorizationGate: CHANNEL, str(media), caption="caption", - reply_to="root-event", - metadata={"thread_id": "ignored-thread"}, + reply_to="latest-child", + metadata={"thread_id": "stable-root"}, ) assert result.success is True assert result.message_id == "evt-media" args, stdin_text = cli.calls[0] assert args[args.index("--file") + 1] == str(media) - assert args[args.index("--reply-to") + 1] == "root-event" + # Threading contract (#99429): stable thread root beats latest-child. + assert args[args.index("--reply-to") + 1] == "stable-root" assert stdin_text == "caption" @pytest.mark.asyncio @@ -3466,7 +3468,7 @@ class TestStandaloneSend: captured = {} - async def fake_exec(cli_path, args, *, relay_url, private_key, input_text=None, timeout=30.0): + async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=30.0): captured["args"] = args return 0, json.dumps({"accepted": True, "event_id": "evt-media"}), ""