-
Notifications
You must be signed in to change notification settings - Fork 114
Investigate connection start listening bug #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate connection start listening bug #605
Conversation
Co-authored-by: matt.sloan <matt.sloan@deepgram.com>
|
Cursor Agent can help with this pull request. Just |
WalkthroughTwo new documentation files are added to the repository: BUG_ANALYSIS_SUMMARY.md and BUG_REPORT.md. These files document a blocking behavior issue in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
BUG_ANALYSIS_SUMMARY.md (1)
1-118: Substantive overlap with BUG_REPORT.md — Both files document the same issue with similar code examples, affected files, and solutions. The distinction between the two files is unclear:
- BUG_REPORT.md is more formal and comprehensive, with explicit "Root Cause" and "Affected Files" sections.
- BUG_ANALYSIS_SUMMARY.md is more conversational (with emoji formatting) and includes the useful "Why Tests Pass" section.
Consider whether both files serve distinct purposes (e.g., bug report for issue tracking vs. analysis for developer documentation) or if they should be consolidated into a single document to avoid duplication and maintenance burden.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
BUG_ANALYSIS_SUMMARY.md(1 hunks)BUG_REPORT.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
BUG_ANALYSIS_SUMMARY.md
[grammar] ~3-~3: There might be a mistake here.
Context: ...ing()Blocking Issue ## 🐛 The Problem You're experiencing a bug whereconnect...
(QB_NEW_EN)
[grammar] ~7-~7: There might be a mistake here.
Context: ...orly documented. ## 🔍 What's Happening The start_listening() method contains ...
(QB_NEW_EN)
[grammar] ~30-~30: There might be a mistake here.
Context: ...tion closes. ## 📚 Documentation Issues ### Misleading Examples The documentation s...
(QB_NEW_EN)
[grammar] ~68-~68: There might be a mistake here.
Context: ...a(audio_bytes) ``` ## 🔧 Why Tests Pass Tests work because they use **mock webso...
(QB_NEW_EN)
[grammar] ~104-~104: There might be a mistake here.
Context: ... behavior explicit ## 📁 Affected Files - src/deepgram/listen/v1/socket_client.py - src/deepgram/listen/v2/socket_client.py - src/deepgram/speak/v1/socket_client.py - src/deepgram/agent/v1/socket_client.py - websockets-reference.md - README.md ## 🎯 Next Steps 1. ✅ Bug identified and d...
(QB_NEW_EN)
[grammar] ~113-~113: There might be a mistake here.
Context: ...ence.md-README.md` ## 🎯 Next Steps 1. ✅ Bug identified and documented 2. ⏭️ Fi...
(QB_NEW_EN)
🔇 Additional comments (8)
BUG_REPORT.md (5)
1-6: Clear problem statement and summary — The issue is well-defined:start_listening()blocks indefinitely and prevents subsequent code execution, which is not clearly documented. This accurately captures the core user-facing problem.
96-142: Recommendations are actionable and well-reasoned — Three options are presented with clear trade-offs: Option 1 (documentation fix, low-risk), Option 2 (non-blocking helper, better UX, non-breaking), and Option 3 (rename method, most explicit but breaking). However, the PR objectives mention "suggested fixes" but it's unclear which recommendation this PR proposes to implement. Clarify which option(s) this PR addresses or if it is purely documentation of the issue.
144-157: Related files correctly document working implementations — The list of example files shows that both sync (with threading) and async (with asyncio.create_task) implementations already exist in the codebase and use correct patterns. However, the statement "But the documentation doesn't reflect this requirement!" highlights a critical gap. Verify that the main documentation files (websockets-reference.md, README.md) indeed lack these correct patterns before finalizing this report.
7-41: Verification confirmed: File paths, line numbers, and code snippets are accurate.All referenced files exist with correct line numbers. The code at the specified ranges matches the review snippets exactly, confirming the blocking for-loop pattern in both synchronous and asynchronous
start_listening()implementations acrosssrc/deepgram/listen/v1/socket_client.pyand other socket client modules. The root cause analysis is sound and well-illustrated.
50-67: Documentation examples are accurate — The examples showing blocking behavior afterstart_listening()are confirmed present in bothwebsockets-reference.mdandREADME.md. The files contain code patterns where sequential calls appear afterstart_listening(), which aligns with the blocking behavior documented in BUG_REPORT.md. These documentation inconsistencies correctly identify misleading examples that could confuse developers.BUG_ANALYSIS_SUMMARY.md (3)
1-28: Problem explanation and "What's Happening" sections are clear — The infinite loop pattern is well-explained with a concrete code example. The before/after illustration of code that never executes is effective for user understanding. Verify that the characterization of the blocking behavior is accurate and complete (e.g., confirm the loop truly never returns until connection closes).
113-118: Next Steps checklist indicates preliminary stage — The checklist marks "Bug identified and documented" as complete (✅) and lists "Fix documentation," "Add helper methods," and "Add warnings" as pending (⏭️). This confirms the PR is the initial documentation of the issue. Clarify in the PR description or commit message whether this PR intends to:
- Track the issue only (no code changes), or
- Also include implementations of one or more recommendations, or
- Link to related issues/PRs that implement the fixes.
68-70: Unable to verify the websocket mock claim from the codebase.Despite searching for test implementations of
start_listening(), socket clients, websocket mocking patterns, and finite message fixtures, no supporting test code was found. Socket implementations exist (src/deepgram/listen/v1/socket_client.py,v2, etc.), but corresponding test implementations that demonstrate mock websockets with finite message returns could not be located.The claim that "Tests work because they use mock websockets that return a finite set of messages and then stop" requires manual verification by checking:
- Which tests actually cover the socket/listening functionality
- How those tests mock websocket behavior
- Whether mocked websockets are configured to return finite message sequences
jpvajda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattsloan-dg I'm not quite clear why this is. PR. it seems to be a bug you are reporting?
|
@jpvajda We can close this PR. It was auto generated by a Cursor Agent when I asked it about our Python 5.0.0 SDK - https://cursor.com/agents?selectedBcId=bc-18dd782c-0431-438f-afbc-6e6885e9f040 |
Add bug reports for the
connection.start_listening()method's blocking behavior and misleading documentation.The
start_listening()method blocks indefinitely, preventing subsequent code from executing, which is not clear from its name or the current documentation examples. These reports clarify the expected blocking behavior, provide correct usage patterns (threading/async tasks), and suggest documentation updates or API changes to improve user experience.Summary by CodeRabbit
start_listening()method.