The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(buzz): declare the serial receive loop for burst merging
Nolan2a8934ba17f2
diff --git a/plugins/platforms/buzz/adapter.py b/plugins/platforms/buzz/adapter.pyindex 34f97fbd8f4..3cbc40717bf 100644--- a/plugins/platforms/buzz/adapter.py+++ b/plugins/platforms/buzz/adapter.py@@ -513,6 +513,8 @@ _ATTACHMENT_KIND_TYPES = {"image": MessageType.PHOTO, "video": MessageType.VIDEOclass BuzzAdapter(BasePlatformAdapter):"""Buzz adapter (WebSocket push with poll fallback) for the BasePlatformAdapter interface."""+ serial_receive_loop = True # WS listener and poll sweep both await each event batch before reading the next+def __init__(self, config, **kwargs):super().__init__(config=config, platform=Platform("buzz"))extra = getattr(config, "extra", {}) or {}diff --git a/tests/gateway/test_busy_burst_serial_reader.py b/tests/gateway/test_busy_burst_serial_reader.pyindex db7fdc122a5..9320b7f9025 100644--- a/tests/gateway/test_busy_burst_serial_reader.py+++ b/tests/gateway/test_busy_burst_serial_reader.py@@ -275,3 +275,27 @@ async def test_restart_waits_for_a_direct_busy_input_queued_behind_a_slow_capturawait adapter.cancel_background_tasks()await async_wait_until(lambda: not mutation_tasks(authority), timeout=10)runner.session_store.close_all_db_handles()+++async def test_buzz_split_text_merges_through_the_reader(monkeypatch):+ """Buzz was left out of the #140973 serial-reader sweep: both the WS listener and the poll+ sweep await ``_handle_events`` before reading the next batch (#141378)."""+ from collections import OrderedDict++ from plugins.platforms.buzz.adapter import BuzzAdapter++ monkeypatch.setenv('BUZZ_ALLOWED_USERS', 'aa11bb22')+ adapter = BuzzAdapter(PlatformConfig(enabled=True))+ async def _name(pubkey):+ return pubkey[:8]+ adapter._resolve_user_name = _name # the CLI-backed resolver has no place in a unit test+ state = {"chat_type": "dm", "last_ts": 0, "seen": OrderedDict(), "event_meta": OrderedDict()}+ adapter._channel_state['chan'] = state+ source = adapter.build_source(chat_id='chan', chat_type='dm', user_id='aa11bb22')+ owner = await _busy_owner(monkeypatch, adapter, source, busy_text_mode='queue')+ event = lambda i, text: {'id': f'e{i}', 'kind': 9, 'pubkey': 'aa11bb22', 'content': text, 'created_at': i}+ # as both readers do: the next batch only after the previous _handle_events returned+ await adapter._handle_events('chan', state, [event(1, 'first half')])+ await adapter._handle_events('chan', state, [event(2, 'second half')])+ assert await owner.settle(2) == [('first half\nsecond half', 0)]