Skip to content

Fix DM channel routing: don't add '#' prefix to dm: channels#209

Merged
khaliqgant merged 2 commits into
mainfrom
deploy-relay-pty-docker
Jan 18, 2026
Merged

Fix DM channel routing: don't add '#' prefix to dm: channels#209
khaliqgant merged 2 commits into
mainfrom
deploy-relay-pty-docker

Conversation

@khaliqgant

Copy link
Copy Markdown
Member

Summary

  • Fixed bug where DM channels (dm:user1:user2) were incorrectly getting a # prefix added, breaking message routing
  • Fixed in 4 locations: /api/channels/invite, /api/channels/join, /api/channels/subscribe, /api/channels/message

Problem

When sending messages to DM channels, the code was transforming:

  • dm:khaliqgant:Backend#dm:khaliqgant:Backend (BROKEN)

This broke DM channel message routing since DM channels should NOT have a # prefix.

Solution

Added check to preserve dm: prefix channels:

const channelId = channel.startsWith('dm:')
  ? channel
  : (channel.startsWith('#') ? channel : `#${channel}`);

Test plan

  • Send DM from cloud dashboard to an agent
  • Verify message arrives without nested format corruption
  • Test channel invites and joins for DM channels

🤖 Generated with Claude Code

The channel endpoints were incorrectly adding '#' prefix to ALL channels,
including DM channels which use the 'dm:user1:user2' format. This broke
DM channel message routing.

Fixed in 4 locations:
- /api/channels/invite
- /api/channels/join
- /api/channels/subscribe
- /api/channels/message

DM channels now correctly preserve their 'dm:' prefix format.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@my-senior-dev-pr-review

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

Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

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

View your contributor analytics →


📊 3 files reviewed • 5 need attention

⚠️ Needs Attention:

  • src/dashboard-server/server.ts — Modifications involve significant routing logic changes that impact API compatibility.

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

Added tracing to help debug nested message format issue:
- /api/send: Log message routing with preview
- /api/channels/message: Log DM channel handling
- userBridge.sendDirectMessage: Log user session and relay client usage
- buildInjectionString: Detect and warn about nested "Relay message from" in body

Key debug markers:
- [api/send] === MESSAGE TRACE ===
- [channel-msg] === MESSAGE TRACE ===
- [user-bridge] === DM TRACE ===
- [buildInjectionString] === FORMAT TRACE ===

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit add69cc into main Jan 18, 2026
6 checks passed
@khaliqgant khaliqgant deleted the deploy-relay-pty-docker branch January 18, 2026 01:39
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