From 81e36bf859ea28765d58397429e55f0ac7189460 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 2 Mar 2026 06:38:02 -0800 Subject: [PATCH] debug: add data_received event logging to diagnose data channel --- packages/services/voice-agent/src/agent.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/services/voice-agent/src/agent.py b/packages/services/voice-agent/src/agent.py index 2536c39..ac05d92 100644 --- a/packages/services/voice-agent/src/agent.py +++ b/packages/services/voice-agent/src/agent.py @@ -343,8 +343,18 @@ async def entrypoint(ctx: JobContext) -> None: type(exc).__name__, exc, exc_info=True, ) + # Debug: log ALL data_received events to verify the event fires + def _debug_data_received(dp): + logger.info( + "DEBUG data_received: type=%s topic=%s data_len=%d", + type(dp).__name__, + getattr(dp, 'topic', 'NO_TOPIC_ATTR'), + len(getattr(dp, 'data', b'')), + ) + # Use ensure_future because ctx.room.on() uses a sync event emitter # (same pattern as the "disconnected" handler above) + ctx.room.on("data_received", _debug_data_received) ctx.room.on("data_received", lambda dp: asyncio.ensure_future(_on_data_received(dp))) except Exception as exc: