Skip to content

Bump cli tools - #283

Merged
khaliqgant merged 13 commits into
mainfrom
bump-cli-tools
Jan 23, 2026
Merged

khaliqgant merged 13 commits into
mainfrom
bump-cli-tools

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jan 23, 2026 •

Copy link
Copy Markdown
Member
  • use latest cli tools
  • Update mcp and sdk

Open with Devin

@my-senior-dev-pr-review

my-senior-dev-pr-review Bot commented Jan 23, 2026 •

Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src (497 edits) • ⚡ 137th PR this month

View your contributor analytics →


📊 18 files reviewed • 5 high risk • 4 need attention

🚨 High Risk:

  • packages/daemon/src/router.ts — Core routing logic updated, introducing potential authorization issues with user connections and message handling.
  • packages/dashboard-server/src/user-bridge.ts — Improvements in user management for multi-tab connections could allow session hijacking without proper connection validation.
  • packages/sdk/src/client.ts — Changes in socket connection handling could expose the application to vulnerabilities if not done cautiously.

⚠️ Needs Attention:

  • packages/daemon/src/server.ts — Modifications to server socket management could introduce issues with resource accessibility and session handling.
  • packages/mcp/src/client.ts — Improvements in request handling could affect message integrity.

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional flags.

Open in Devin Review

khaliqgant and others added 6 commits January 23, 2026 22:08
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The daemon writes agents.json, processing-state.json, and
connected-agents.json to the teamDir. If the directory doesn't
exist, these writes fail silently. Added check in start() to
create the teamDir during daemon startup.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The queue monitor checks for stuck messages that haven't been injected.
When the agent is busy, messages sit in the queue until the next monitor
check. With a 30-second interval, this caused up to 30 seconds of latency
for message delivery. Reducing to 5 seconds improves responsiveness.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View issue and 6 additional flags in Devin Review.

Open in Devin Review

}, timeout);

socket.on('connect', () => socket.write(JSON.stringify(req) + '\n'));
socket.on('connect', () => socket.write(encodeFrame(envelope)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 MCP client sends messages without required HELLO handshake

The MCP client sends protocol messages (SEND, SPAWN, RELEASE, STATUS, INBOX, LIST_AGENTS) directly without performing the required HELLO handshake first.

Click to expand

How the bug occurs

The MCP client's request() function at line 81-139 opens a new socket connection and immediately sends the message envelope on connect (line 103):

socket.on('connect', () => socket.write(encodeFrame(envelope)));

However, the daemon's Connection class (packages/daemon/src/connection.ts:293-296) requires the connection to be in ACTIVE state before accepting SEND messages:

private handleSend(envelope: Envelope<SendPayload>): void {
  if (this._state !== 'ACTIVE') {
    this.sendError('BAD_REQUEST', 'Not in ACTIVE state', false);
    return;
  }
  ...
}

The connection only transitions to ACTIVE state after a successful HELLO/WELCOME handshake (connection.ts:283).

Additional issues

The message types STATUS, INBOX, LIST_AGENTS, and SEND_AND_WAIT that the MCP client sends are not handled by the daemon at all - there are no case handlers for these in server.ts:936-1072 or connection.ts:194-217.

Impact

All MCP client operations will fail:

  • send(), spawn(), release() will receive "Not in ACTIVE state" errors
  • getStatus(), getInbox(), listAgents(), sendAndWait() will timeout as these message types are unrecognized

Recommendation: The MCP client needs to either: (1) perform a HELLO handshake before sending other messages, similar to the SDK client in packages/sdk/src/client.ts:627-654, or (2) use a different API (like HTTP) that doesn't require a persistent connection with handshake.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

khaliqgant and others added 3 commits January 23, 2026 22:42
Previously, when a user opened a second browser tab, the daemon would
kick the first connection, causing a reconnect loop where both tabs
fight each other. This caused a connection storm and prevented message
delivery.

Users (unlike agents) should support multiple simultaneous connections.
Now we just update the map to point to the latest connection without
kicking existing ones.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When a user opened a second browser tab, registerUser() would call
unregisterUser() first, disconnecting the old tab's relay client.
This caused the old tab to reconnect, which kicked the new tab,
creating an infinite reconnection loop.

Now we call updateWebSocket() instead of unregistering, allowing
multiple tabs to share the same relay client connection.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

View issues and 6 additional flags in Devin Review.

Open in Devin Review

Comment thread packages/daemon/src/router.ts Resolved
Addresses PR feedback about orphaned user connections:
- Router: Track all user connections per user (Set instead of single)
- Router: Send messages to ALL user connections for multi-tab sync
- UserBridge: Track all WebSockets per user session
- UserBridge: Only unregister when ALL WebSockets are closed

This ensures:
1. Messages reach all browser tabs, not just the latest
2. Users are properly cleaned up only when all tabs close
3. Channel messages are delivered to all user connections

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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