Skip to content

feat(assemblyai): log connection lifecycle, silence, and session correlators#5476

Merged
tinalenguyen merged 3 commits intolivekit:mainfrom
dlange-aai:assemblyai/debug-logging
Apr 18, 2026
Merged

feat(assemblyai): log connection lifecycle, silence, and session correlators#5476
tinalenguyen merged 3 commits intolivekit:mainfrom
dlange-aai:assemblyai/debug-logging

Conversation

@dlange-aai
Copy link
Copy Markdown
Contributor

@dlange-aai dlange-aai commented Apr 17, 2026

Summary

Extends the DEBUG logging added in #5146.

  • WebSocket lifecycledebug before ws_connect (model + base_url; URL intentionally excluded since the query string contains customer prompt / keyterms_prompt) and after with the HTTP status.
  • Unexpected closewarning with session_id, close_code, msg.data, msg.extra logged before the APIStatusError is raised, so the close code is visible even if the exception gets swallowed downstream.
  • Recv silencewarning when no message arrives from AAI for 15s, and re-emitted every 15s while silence continues (with the actual elapsed duration). Makes the "interims keep arriving but no finals" vs "AAI went quiet" distinction explicit.
  • Session correlatorssession=... added to every existing debug/error/exception log in _process_stream_event and recv_task so logs can be cross-referenced with AAI-side logs.
  • Unhandled message typesdebug log for unknown type values, which were previously silently dropped.

No impact at default log levels — all new output is debug except the two warning-level anomaly signals.

Test plan

  • make format lint type-check pass
  • Verify in a running agent session that:
    • connecting to AssemblyAI model=... base_url=... appears once at connect
    • AssemblyAI WebSocket connected status=... appears once
    • Existing interim/preflight/final logs now include session=<id>
    • Closing the WS server-side produces the unexpected-close warning

…ilence detection

Address visibility gaps reported by Portola — audio flows but no transcripts
return with no log signal. Add session_id correlators on existing logs, log
WebSocket connect/close lifecycle, periodic audio byte counters, warnings
after 15s of recv silence, and logging of unhandled message types.

URL is not logged (contains customer prompt/keyterms_prompt).
Previous cadence emitted a single warning at 15s and then went silent even
if the stream stayed stuck. Now warns every 15s with the actual elapsed
silent duration so ongoing stalls remain visible in logs.
Redundant with the recv-silence warning and per-turn speech_duration log
already emitted at end-of-turn. If send_task completes ws.send_bytes,
the bytes reached the socket — logging counts adds no diagnostic value.
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Copy Markdown
Member

@tinalenguyen tinalenguyen left a comment

Choose a reason for hiding this comment

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

lgtm, thank you!!

@tinalenguyen tinalenguyen merged commit afc65df into livekit:main Apr 18, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants