openclaw - 💡(How to fix) Fix [Bug]: Web chat live response unconditionally truncated at ~4,000 chars

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Long assistant responses in the WebChat/Control UI are truncated at approximately 4,000 characters during live streaming. The model generates the full response, but the reply/chunking layer slices it before it reaches the frontend. There is no configuration option to override this limit for webchat — the code explicitly bypasses provider-specific config resolution for webchat, always falling back to a hardcoded DEFAULT_CHUNK_LIMIT = 4e3.

Root Cause

Long assistant responses in the WebChat/Control UI are truncated at approximately 4,000 characters during live streaming. The model generates the full response, but the reply/chunking layer slices it before it reaches the frontend. There is no configuration option to override this limit for webchat — the code explicitly bypasses provider-specific config resolution for webchat, always falling back to a hardcoded DEFAULT_CHUNK_LIMIT = 4e3.

Fix Action

Fix / Workaround

The full response should render in WebChat, or if a limit is necessary, it should be configurable via textChunkLimit (like other channels) or a webchat-specific override. At minimum, there should be an option to fetch and display the remainder. What I'm doing now is asking OC to create an HTML file copy of the response that I then view in my web browser - not a pleasant workaround.

Code Example



---

const DEFAULT_CHUNK_LIMIT = 4e3;
const DEFAULT_CHUNK_MODE = "length";

function resolveTextChunkLimit(cfg, provider, accountId, opts) {
    const fallback = ...opts?.fallbackLimit... : DEFAULT_CHUNK_LIMIT; // 4000
    const providerOverride = (() => {
        if (!provider || provider === "webchat") return; // ← hardcoded bypass
        return resolveChunkLimitForProvider((cfg?.channels)?.[provider] ?? cfg?.[provider], accountId);
    })();
    if (typeof providerOverride === "number" && providerOverride > 0) return providerOverride;
    return fallback; // always 4000 for webchat
}

function resolveChunkMode(cfg, provider, accountId) {
    if (!provider || provider === "webchat") return DEFAULT_CHUNK_MODE; // same bypass
    return resolveChunkModeForProvider(...) ?? DEFAULT_CHUNK_MODE;
}

---

// In resolveTextChunkLimit (~line 42):
if (!provider || provider === "webchat") return;
// → Remove `|| provider === "webchat"` so webchat goes through config lookup

// In resolveChunkMode (~line 59):
if (!provider || provider === "webchat") return DEFAULT_CHUNK_MODE;
// → Same treatment, or set a higher default for webchat
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Long assistant responses in the WebChat/Control UI are truncated at approximately 4,000 characters during live streaming. The model generates the full response, but the reply/chunking layer slices it before it reaches the frontend. There is no configuration option to override this limit for webchat — the code explicitly bypasses provider-specific config resolution for webchat, always falling back to a hardcoded DEFAULT_CHUNK_LIMIT = 4e3.

Steps to reproduce

  1. Send a prompt that produces a long assistant response (>4000 characters), e.g., "Tell me about your web surfing activity from last night"
  2. Observe in the Control UI: the response streams fully, then stops at ~4000 characters with ...(truncated)... appended

The rest of the response is silently lost — no indication that more content exists

Expected behavior

The full response should render in WebChat, or if a limit is necessary, it should be configurable via textChunkLimit (like other channels) or a webchat-specific override. At minimum, there should be an option to fetch and display the remainder. What I'm doing now is asking OC to create an HTML file copy of the response that I then view in my web browser - not a pleasant workaround.

Actual behavior

Response is truncated at ~4000 characters with no effective configuration option to increase the limit.

OpenClaw version

2026.5.12

Operating system

Ubuntu 24.04

Install method

npm global

Model

Qwen3.6-35B-A3B

Provider / routing chain

openclaw -> llama.cpp openai-completions API

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Inability to see response text past 4K characters in web chat.

Additional information

The truncation occurs in the reply/chunking layer (chunk-CGVwhsnj.js), not in the model output or the frontend:

const DEFAULT_CHUNK_LIMIT = 4e3;
const DEFAULT_CHUNK_MODE = "length";

function resolveTextChunkLimit(cfg, provider, accountId, opts) {
    const fallback = ...opts?.fallbackLimit... : DEFAULT_CHUNK_LIMIT; // 4000
    const providerOverride = (() => {
        if (!provider || provider === "webchat") return; // ← hardcoded bypass
        return resolveChunkLimitForProvider((cfg?.channels)?.[provider] ?? cfg?.[provider], accountId);
    })();
    if (typeof providerOverride === "number" && providerOverride > 0) return providerOverride;
    return fallback; // always 4000 for webchat
}

function resolveChunkMode(cfg, provider, accountId) {
    if (!provider || provider === "webchat") return DEFAULT_CHUNK_MODE; // same bypass
    return resolveChunkModeForProvider(...) ?? DEFAULT_CHUNK_MODE;
}

Two functions (resolveTextChunkLimit and resolveChunkMode) explicitly check provider === "webchat" and return early, bypassing any config lookup. This means:

Setting channels.webchat.textChunkLimit in config has no effect The fallbackLimit parameter passed by callers (always 4e3 across all channel implementations) is the effective cap No configuration path exists to change this for webchat.

Why Other Channels Work Every other channel passes its own fallbackLimit value:

Telegram: 4e3 (Telegram API limit, appropriate) Discord: DISCORD_TEXT_CHUNK_LIMIT (configurable per account) Signal: 4e3 (Signal API limit, appropriate) Slack: SLACK_TEXT_LIMIT (Slack API limit, appropriate) Mattermost: account.textChunkLimit ?? 4e3 (respects config) Webchat has no upstream API constraint — it's a local browser UI. The 4000-char default is arbitrary and too low for the use case.

Proposed fix:

Remove the webchat bypass in both functions so webchat falls through to config resolution like other channels:

// In resolveTextChunkLimit (~line 42):
if (!provider || provider === "webchat") return;
// → Remove `|| provider === "webchat"` so webchat goes through config lookup

// In resolveChunkMode (~line 59):
if (!provider || provider === "webchat") return DEFAULT_CHUNK_MODE;
// → Same treatment, or set a higher default for webchat

Then either:

  1. Let the existing channels.webchat.textChunkLimit config work (minimal change), or
  2. Increase the fallback default for webchat specifically (e.g., 16000+) since there's no upstream API constraint

Related Issues #83151 — Closed, but about chat history view truncation (separate code path: chat-display-projection.ts and Control UI frontend request) PR #53243 — Open, attempting to fix chat.history caps; not relevant to live response chunking

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The full response should render in WebChat, or if a limit is necessary, it should be configurable via textChunkLimit (like other channels) or a webchat-specific override. At minimum, there should be an option to fetch and display the remainder. What I'm doing now is asking OC to create an HTML file copy of the response that I then view in my web browser - not a pleasant workaround.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Web chat live response unconditionally truncated at ~4,000 chars