Fix LM Studio "Client disconnected" with OpenClaw: Increase the Stalled Embedded-Run Watchdog
If you're running OpenClaw with local models via LM Studio and seeing Client disconnected. Stopping generation..., the model probably isn't broken — OpenClaw's internal watchdog is killing the request before the first token arrives. Here's the exact fix.
The root cause
OpenClaw has a diagnostic watchdog that aborts "stalled" embedded runs. The threshold lives in a compiled JS file (diagnostic-DhwkYT4X.js) under .openclaw\npm\projects\openclaw-diagnostics-prometheus-5bcae34c2e\node_modules\@openclaw\diagnostics-prometheus\node_modules\openclaw\dist. Two constants control it:
const MIN_STALLED_EMBEDDED_RUN_ABORT_MS = 5000000; // ~83 minutes const STALLED_EMBEDDED_RUN_ABORT_WARN_MULTIPLIER = 15;
Changing these values and restarting the gateway stopped the disconnects for a user running Qwen, Gemma, and DeepSeek models on a 32 GB RAM HP All-in-One (Windows 10, OpenClaw 2026.7.1-2, LM Studio 1.0.7 build 2).
Why standard timeouts don't help
The usual suspects — agents.defaults.timeoutSeconds, models.providers.lmstudio.timeoutSeconds, etc. — had no effect. The watchdog fires before the provider timeout. Also note that openclaw doctor can reset your config, so manual config changes may get reverted.
Applying the fix
Edit the constants in that dist file (or the source if you have it), then restart the gateway:
openclaw gateway restart
Restarting Windows may also be required for a clean test.
The author observed disconnects at ~6.5 minutes on heavy first requests, consistent with the watchdog's logic (5000000 ms × 15 = 75,000 ms = 75 s? — actually the math in the post is a bit off, but the point stands: the threshold was too low for long local prompt processing).
This is a niche but deeply annoying issue for anyone running OpenClaw with local models. If you've hit it, this is the fix.
📖 Read the full source: r/openclaw
👀 See Also

Guide to Setting Up OpenClaw on a Hostinger VPS
A step-by-step guide for deploying OpenClaw on a Hostinger VPS, connecting AI APIs from OpenAI and Entropics, and integrating with Telegram for 24/7 operation.

Fixing OpenClaw Agent Autonomy Issues: Skill Files, Tool Selection, and Cron Setup
A developer shares solutions for OpenClaw agents that stop working autonomously after initial setup. Key fixes include using external skill files instead of chat instructions, replacing browser tools with API-based tools or Puppeteer scripts, and properly configuring cron jobs.

Claude Code v2.1.36: Fast Mode Now Available for Opus 4.6
Anthropic releases Claude Code v2.1.36 with Fast Mode support for the latest Opus 4.6 model, enabling significantly faster code generation and analysis.

Run OpenClaw with a Local LLM on macOS – Guide for 16–24GB RAM
A practical guide to setting up a quantized Qwen 3.5 model with OpenClaw on macOS (16–24GB RAM), including a test skill for verification.