Bugfix: Why does MCP handoff_pending return no handoffs for Testing ...

Documentation for Sessions

🐛 Bugfix: Why does MCP handoff_pending return no handoffs for Testing ...

Date: 2026-02-06
Time: 23:29:35 UTC
Session: editor2-97.16
Agent: testing
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Why does MCP handoff_pending return no handoffs for Testing Director (Cowork/Claude Desktop)?

Task: Fix MCP agent identity and handoff routing for Testing Director


🎯 Decision Made

Chosen:

Replace hardcoded agentType='code' with dynamic detection via getHandoffAgentType() that maps platform → agent type (cursor/claude-code → 'code', claude-desktop → 'browser')

Options Considered:

  1. Dynamic platform-to-agentType mapping
  2. Always query with agentType='any' to match everything
  3. Add agentType parameter to handoff_pending tool input

💭 Reasoning

Three bugs: (1) handoff.ts hardcodes agentType='code' in both handleGetPendingHandoffs and handleWatchHandoffs, so browser-targeted handoffs are never matched for Claude Desktop agents. (2) server.ts resource handler hardcodes agentType=code AND workspace=editor2 instead of using WORKSPACE_ID. (3) session-detector.ts isCursor() checks history.json for any cursor session, causing false positives for Claude Desktop. Fixed all three: dynamic agent type mapping, WORKSPACE_ID constant, removed the unreliable history.json check from isCursor().


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation