Skip to content

start_process blocks Electron main thread causing Claude Desktop crashes #310

@Voork1144

Description

@Voork1144

Problem

When start_process is called with a large timeout_ms value (e.g., 120000ms for long-running tests), the function blocks the Node.js event loop until either:

  • A prompt pattern is detected
  • The process exits
  • The timeout expires

If the spawned process doesn't output recognizable prompts (like >>>, $, etc.), Desktop Commander blocks for the entire timeout duration. This freezes the Electron IPC channel, causing the Claude Desktop webview to become unresponsive and crash.

Evidence from Claude Desktop logs

2026-01-18 10:15:59 [info] start_process called with timeout_ms=120000
2026-01-18 10:17:49 [info] Main webview is unresponsive, will kill and reload
2026-01-18 10:17:50 [error] Sentry caught: { value: 'Main webview became unresponsive' }
2026-01-18 10:17:59 [info] Desktop Commander finally responds (2 minutes later)

The process spawned was a Python test script that didn't output prompt-like patterns, so Desktop Commander waited the full 2 minutes.

Root Cause

In terminal-manager.js, the executeCommand function's timeout is directly controlled by the user-provided timeoutMs:

// Timeout fallback
setTimeout(() => {
    session.isBlocked = true;
    exitReason = 'timeout';
    resolveOnce({...});
}, timeoutMs);  // <-- Can be arbitrarily large!

Suggested Fix

Cap the initial wait time regardless of user timeout. The user can still poll with read_process_output for long-running processes:

// Timeout fallback - cap initial wait to prevent blocking
const MAX_INITIAL_WAIT_MS = 10000; // 10 seconds max
const effectiveTimeout = Math.min(timeoutMs, MAX_INITIAL_WAIT_MS);
setTimeout(() => {
    session.isBlocked = true;
    exitReason = 'timeout';
    resolveOnce({...});
}, effectiveTimeout);

This way:

  • start_process returns quickly with isBlocked: true
  • Users poll with read_process_output for actual output
  • Claude Desktop webview doesn't freeze

Workaround

Until fixed, users should:

  1. Use small timeouts: start_process(command, timeout_ms=5000)
  2. Poll separately: read_process_output(pid, timeout_ms=30000)

Environment

  • Desktop Commander: 0.2.29
  • Claude Desktop: 1.1.351
  • OS: Windows 11
  • Node.js: Built-in Claude Desktop node

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions