Add warning log for unknown WebSocket message types
Summary
- Adds a catch-all
elseclause in the chat WebSocket handler to log unknown message types - Previously, unknown message types were silently ignored, making integration issues hard to diagnose
Changes
} else {
// Log unknown message types to help diagnose integration issues
console.log('[WARN] Unknown WebSocket message type:', data.type, JSON.stringify(data).slice(0, 200));
}
Context
While debugging an issue where the web UI was stuck on "Thinking..." (#245), we found that unknown message types were being silently dropped. This small change adds observability without being overly verbose (payload truncated to 200 chars).
Test Plan
- [x] Verified existing message types (
claude-command,cursor-command, etc.) still work - [x] Confirmed unknown types now produce a warning log instead of silent failure
Summary by CodeRabbit
-
Bug Fixes
- Enhanced error visibility by adding warning logs for unrecognized WebSocket message types, improving system stability and diagnostics.
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
Adds a fallback branch to the Chat WebSocket message handler that logs a warning when an incoming message has an unrecognized type, including the type and a truncated view of the payload, without changing handling for known message types.
Changes
| Cohort / File(s) | Summary |
|---|---|
WebSocket message handler logging server/index.js |
Adds a fallback warning log for unknown WebSocket chat message types, capturing the unrecognized type and a truncated data payload; no changes to existing known-type handling. |
Estimated code review effort
π― 1 (Trivial) | β±οΈ ~3 minutes
Possibly related issues
- siteboon/claudecodeui#245: Addresses the observed silent-ignore behavior by adding warning-level logging for unknown WebSocket message types.
Poem
A rabbit peeks at an unknown kind,
"Who sent this note with no name?"
A gentle log now helps us find,
The message lost β brought back to frame. π
Pre-merge checks and finishing touches
β Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The pull request title accurately describes the main change: adding a warning log for unknown WebSocket message types, which aligns with the primary objective of improving observability in the chat WebSocket handler. |
| Docstring Coverage | β Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between ac20529c4292b1a9ecd87ad425b7292b5913bdf9 and c836496f14c9e8cce50f2fc9435996f02680cd09.
π Files selected for processing (1)
-
server/index.js(1 hunks)
π§ Files skipped from review as they are similar to previous changes (1)
- server/index.js
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 @coderabbitai help to get the list of available commands and usage tips.
@viper151 Ready for review - addressed CodeRabbit's security feedback by removing payload logging. Now only logs the message type, which is sufficient for debugging while avoiding potential PII exposure.