Skip to content

Fix: Handle direct_message events in dashboard presence handler#196

Merged
khaliqgant merged 1 commit intomainfrom
fix/github-username-routing
Jan 16, 2026
Merged

Fix: Handle direct_message events in dashboard presence handler#196
khaliqgant merged 1 commit intomainfrom
fix/github-username-routing

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Jan 15, 2026

Summary

  • Fix message routing bug where messages sent to GitHub username (e.g., khaliqgant) were not received in dashboard UI
  • Messages sent to _DashboardUI worked because they were fetched from storage, but real-time direct messages were silently discarded

Root Cause

handlePresenceEvent in App.tsx only handled channel_message events and ignored direct_message events:

```typescript
// Before: Only handled channel_message
const handlePresenceEvent = useCallback((event: any) => {
if (event?.type === 'channel_message') {
// ... process channel message
}
// direct_message events were silently ignored!
}, [...]);
```

When UserBridge forwarded DMs via WebSocket as { type: 'direct_message', from: 'Agent', body: '...' }, they were discarded.

Fix

Added handling for direct_message events that:

  1. Creates a consistent DM channel ID (dm:user1:user2 with sorted participants)
  2. Appends the message to the channel messages state
  3. Handles unread state like channel messages

Changes

This PR contains only the direct_message event handling fix in App.tsx. No relay-pty or Rust changes included.

Based on main, which already has the _DashboardUI display fixes from PR #193.

Test plan

  • Send message from agent to GitHub username - verify it appears in dashboard
  • Verify existing _DashboardUI routing still works
  • Verify channel messages still work correctly

🤖 Generated with Claude Code

@my-senior-dev-pr-review
Copy link
Copy Markdown

my-senior-dev-pr-review Bot commented Jan 15, 2026

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/dashboard/react-components/ (10 edits) • ⚡ 56th PR this month

View your contributor analytics →


📊 1 file reviewed • 8 need attention

⚠️ Needs Attention:

  • src/dashboard/react-components/App.tsx — New event handling logic potentially introduces security issues and requires thorough validation.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@khaliqgant khaliqgant force-pushed the fix/github-username-routing branch from 6c11230 to 6520484 Compare January 16, 2026 08:58
Bug: Messages sent to GitHub username (e.g., khaliqgant) were not
received in dashboard UI, while messages to _DashboardUI worked.

Root cause: handlePresenceEvent in App.tsx only handled channel_message
events and silently ignored direct_message events. When UserBridge
forwarded DMs via WebSocket, they were discarded.

Fix: Add direct_message handling in handlePresenceEvent to:
- Create a consistent DM channel ID (dm:user1:user2, sorted)
- Append the message to the channel
- Handle unread state like channel messages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant force-pushed the fix/github-username-routing branch from 6520484 to aa5ea1e Compare January 16, 2026 09:07
@khaliqgant khaliqgant merged commit aa4a6a4 into main Jan 16, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/github-username-routing branch January 16, 2026 09:11
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.

1 participant