Log evicted WebSocket close errors instead of silently swallowing#800
Log evicted WebSocket close errors instead of silently swallowing#800
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideLogs exceptions raised when closing evicted WebSocket connections instead of silently swallowing them, to aid debugging of stale connection cleanup. Sequence diagram for WebSocket eviction with error loggingsequenceDiagram
participant PluginHub
participant WebSocket
participant Logger
PluginHub->>PluginHub: _evict_connection(session_id, reason)
PluginHub->>WebSocket: close(code=1001)
alt close succeeds
WebSocket-->>PluginHub: closed
else close raises exception
WebSocket-->>PluginHub: Exception close_ex
PluginHub->>Logger: debug("Error closing evicted WebSocket for session %s: %s", session_id, close_ex)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
✨ 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.
Hey - I've left some high level feedback:
- Consider logging the exception with
exc_info=True(e.g.,logger.debug("Error closing evicted WebSocket for session %s", session_id, exc_info=True)) so you retain the full traceback rather than just the stringified exception.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider logging the exception with `exc_info=True` (e.g., `logger.debug("Error closing evicted WebSocket for session %s", session_id, exc_info=True)`) so you retain the full traceback rather than just the stringified exception.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Follow-up to #798 — addresses CodeRabbit review suggestion to log the swallowed exception in _evict_connection when closing a stale WebSocket, matching the pattern used in _ping_loop.
Generated with Claude Code
Summary by Sourcery
Enhancements:
Summary by CodeRabbit