Repository navigation
Bump cli tools - #283
Bump cli tools#283
Conversation
🤖 My Senior Dev — Analysis Complete👤 For @khaliqgant📁 Expert in View your contributor analytics → 📊 18 files reviewed • 5 high risk • 4 need attention 🚨 High Risk:
🚀 Open Interactive Review →The full interface unlocks features not available in GitHub:
💬 Chat here: 📖 View all 12 personas & slash commandsYou can interact with me by mentioning In PR comments or on any line of code:
Slash commands:
AI Personas (mention to get their perspective):
For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews. |
🤖 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>
| }, timeout); | ||
|
|
||
| socket.on('connect', () => socket.write(JSON.stringify(req) + '\n')); | ||
| socket.on('connect', () => socket.write(encodeFrame(envelope))); |
There was a problem hiding this comment.
🔴 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" errorsgetStatus(),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.
Was this helpful? React with 👍 or 👎 to provide feedback.
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>
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>
Uh oh!
There was an error while loading. Please reload this page.