claudecodeui icon indicating copy to clipboard operation
claudecodeui copied to clipboard

Add warning log for unknown WebSocket message types

Open terrylica opened this issue 1 month ago β€’ 1 comments

Summary

  • Adds a catch-all else clause 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.

terrylica avatar Nov 26 '25 05:11 terrylica

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 26 '25 05:11 coderabbitai[bot]

@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.

tainora avatar Dec 17 '25 01:12 tainora