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

Fix OpenClaw Slowdown in Long Sessions: contextInjection continuation-skip for llama.cpp Cache
A real-world fix for OpenClaw sessions that get slower over time: set contextInjection to continuation-skip to preserve llama.cpp prompt cache, cutting prompt eval from 130s to 1.3s.

Connecting CludeCode to Webapps for Automated Interaction
Explore how CludeCode can be used to automatically interact with web applications by leveraging AI tools like browsers and scraping utilities.

The Hitchhiker's Guide to Agentic AI — Full Overview
A comprehensive Reddit post covering how LLMs work, RL for LLMs, reasoning, evaluation, agentic memory (RAG), and multi-agent systems, with a link to the full paper.

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.