Skip to content

fix: Enable cross-machine routing for users (not just agents)#212

Merged
khaliqgant merged 1 commit into
mainfrom
fix/cross-machine-user-routing
Jan 18, 2026
Merged

fix: Enable cross-machine routing for users (not just agents)#212
khaliqgant merged 1 commit into
mainfrom
fix/cross-machine-user-routing

Conversation

@khaliqgant

Copy link
Copy Markdown
Member

Summary

  • Enables cross-machine message routing for users (humans connected via cloud dashboard)
  • Previously only agents could be routed across machines; users would fail with "Target not found"

Problem

When agent "Lead" on a local machine sends a message TO "khaliqgant" (a user connected via cloud dashboard):

  1. Router checks agents.get('khaliqgant') → NOT FOUND
  2. Router checks users.get('khaliqgant') → NOT FOUND (user is on cloud daemon)
  3. Router checks isRemoteAgent('khaliqgant') → NOT FOUND (only tracks agents)
  4. Message dropped: Target "khaliqgant" not found

Meanwhile, messages TO _DashboardUI worked because it's registered as an agent.

Solution

  • Added isRemoteUser() to CrossMachineHandler interface
  • Added remoteUsers tracking in daemon server
  • Added remote-users-updated event handling from cloud sync
  • Router now checks isRemoteUser() when local lookup fails

Files Changed

  • src/daemon/router.ts - Added interface method and router lookup
  • src/daemon/server.ts - Added remoteUsers tracking and isRemoteUser method
  • src/daemon/cloud-sync.ts - Added remoteUsers and event emission

Test plan

  • Send DM from local agent to cloud-connected user
  • Verify message routes via cloud to user's dashboard
  • Confirm backward compatibility with agent routing

Note

This fix complements PR #209 (DM channel formatting). They fix different layers:

🤖 Generated with Claude Code

Previously, the daemon router could only route messages to remote agents
via cloud sync. Messages to remote users (humans connected via cloud
dashboard) would fail with "Target not found" because:

1. Cloud sync only tracked remote agents, not users
2. Router only checked isRemoteAgent(), not users

This fix adds:
- isRemoteUser() method to CrossMachineHandler interface
- remoteUsers tracking in daemon server
- remote-users-updated event handling from cloud sync
- Router now checks isRemoteUser() when local lookup fails

This enables messages from local agents (e.g., Lead) to reach users
(e.g., khaliqgant) connected via cloud dashboard on different machines.

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

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

Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

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

View your contributor analytics →


📊 7 files reviewed • 7 high risk • 3 need attention

🚨 High Risk:

  • src/daemon/cloud-sync.ts — Critical for user security and data integrity during data transmission and error handling.
  • src/daemon/router.ts — Critical changes to message routing mechanisms which could lead to message mishandling for users and agents.
  • src/daemon/server.ts — Changes to service initialization for cloud synchronization could result in runtime errors if type safety is not maintained.

⚠️ Needs Attention:

  • src/daemon/cloud-sync.ts — Missing error handling for cloud synchronization failures could lead to unprocessed data.
  • src/daemon/server.ts — Comments on complex functionalities are inadequate, which may reduce understandability for future contributors.

🚀 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 merged commit dc8fa2e into main Jan 18, 2026
8 checks passed
@khaliqgant khaliqgant deleted the fix/cross-machine-user-routing branch January 18, 2026 01:40
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