openclaw - 💡(How to fix) Fix [Bug]: WebChat 4K truncation fix half-applied — bypass removed but default unchanged, no config override

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…

Issue #66333 (PR #66333) fixed the hardcoded || provider === "webchat" bypass in resolveTextChunkLimit and resolveChunkMode, allowing webchat to fall through to config resolution. However, the fix is incomplete.

Root Cause

In chunk-BfxgrXB-.js:

// Line 25: default is still 4096
const DEFAULT_CHUNK_LIMIT = 4e3;

// Lines 37-44: bypass removed (good), but falls through to DEFAULT_CHUNK_LIMIT
function resolveTextChunkLimit(cfg, provider, accountId, opts) {
    const fallback = typeof opts?.fallbackLimit === "number" && opts.fallbackLimit > 0
        ? opts.fallbackLimit
        : DEFAULT_CHUNK_LIMIT;  // ← always 4096 for webchat
    const providerOverride = (() => {
        if (!provider) return;
        return resolveChunkLimitForProvider(
            (cfg?.channels)?.[provider] ?? cfg?.[provider],
            accountId
        );
    })();
    if (typeof providerOverride === "number" && providerOverride > 0) return providerOverride;
    return fallback;
}

The bypass (|| provider === "webchat") was removed, so webchat now reaches this function. But since there's no config key that maps to webchat, providerOverride is always undefined, and fallback defaults to 4096.

Fix Action

Fix / Workaround

Affects all users using the Control UI / WebChat Long responses (>4K chars) silently lose content with no indicator Workaround: ask the agent to write output to a file and view it externally

Code Example



---

// Line 25: default is still 4096
const DEFAULT_CHUNK_LIMIT = 4e3;

// Lines 37-44: bypass removed (good), but falls through to DEFAULT_CHUNK_LIMIT
function resolveTextChunkLimit(cfg, provider, accountId, opts) {
    const fallback = typeof opts?.fallbackLimit === "number" && opts.fallbackLimit > 0
        ? opts.fallbackLimit
        : DEFAULT_CHUNK_LIMIT;  // ← always 4096 for webchat
    const providerOverride = (() => {
        if (!provider) return;
        return resolveChunkLimitForProvider(
            (cfg?.channels)?.[provider] ?? cfg?.[provider],
            accountId
        );
    })();
    if (typeof providerOverride === "number" && providerOverride > 0) return providerOverride;
    return fallback;
}

---

// In resolveTextChunkLimit:
if (provider === "webchat") {
    // No upstream API limit for local webchat UI
    return opts?.fallbackLimit ?? 100000;
}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Issue #66333 (PR #66333) fixed the hardcoded || provider === "webchat" bypass in resolveTextChunkLimit and resolveChunkMode, allowing webchat to fall through to config resolution. However, the fix is incomplete.

Steps to reproduce

  1. In webchat, have a conversation that results in a response > 4000 characters.
  2. The response will unconditionally be cut off at 4000 characters, ending with "...(truncated)..."

Expected behavior

A 4000-character default I guess is OK, but it should at least be configurable, e.g. with a key under gateway.webchat. Better would be to remove the limitation for webchat altogether - see option A under proposed fixes.

Actual behavior

All responses in webchat are (still) hard-limited to a 4000-character payload.

OpenClaw version

2026.5.20

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

Affects all users using the Control UI / WebChat Long responses (>4K chars) silently lose content with no indicator Workaround: ask the agent to write output to a file and view it externally

Additional information

Expounding on the summary, with proposed fix options [AI-generated]:

Issue #66333 (PR #66333) fixed the hardcoded || provider === "webchat" bypass in resolveTextChunkLimit and resolveChunkMode, allowing webchat to fall through to config resolution. However, the fix is incomplete:

  1. DEFAULT_CHUNK_LIMIT remains hardcoded at 4e3 (4096)
  2. There is no textChunkLimit config key under gateway.webchat — only chatHistoryMaxChars exists
  3. The root-level webchat.textChunkLimit is not a recognized config key
  4. The channels.webchat.textChunkLimit path doesn't work because webchat is not a channel — it's a gateway subsystem

Result: webchat responses are still silently truncated at ~4000 chars with no way to override it via config.

Root Cause

In chunk-BfxgrXB-.js:

// Line 25: default is still 4096
const DEFAULT_CHUNK_LIMIT = 4e3;

// Lines 37-44: bypass removed (good), but falls through to DEFAULT_CHUNK_LIMIT
function resolveTextChunkLimit(cfg, provider, accountId, opts) {
    const fallback = typeof opts?.fallbackLimit === "number" && opts.fallbackLimit > 0
        ? opts.fallbackLimit
        : DEFAULT_CHUNK_LIMIT;  // ← always 4096 for webchat
    const providerOverride = (() => {
        if (!provider) return;
        return resolveChunkLimitForProvider(
            (cfg?.channels)?.[provider] ?? cfg?.[provider],
            accountId
        );
    })();
    if (typeof providerOverride === "number" && providerOverride > 0) return providerOverride;
    return fallback;
}

The bypass (|| provider === "webchat") was removed, so webchat now reaches this function. But since there's no config key that maps to webchat, providerOverride is always undefined, and fallback defaults to 4096.

What's Missing

A config key that actually applies to webchat. The closest existing key is gateway.webchat.chatHistoryMaxChars, but that only controls what the frontend fetches for historical messages — not the live streaming chunking layer.

Proposed Fix

Option A (minimal): Remove the default entirely for webchat — set it to effectively unlimited since there's no upstream API constraint:

// In resolveTextChunkLimit:
if (provider === "webchat") {
    // No upstream API limit for local webchat UI
    return opts?.fallbackLimit ?? 100000;
}

Option B (config-driven): Add a gateway.webchat.textChunkLimit config key and wire it into the chunking resolution, similar to how chatHistoryMaxChars works but for the streaming layer.

Option C (env var): Follow the existing PI_BASH_MAX_OUTPUT_CHARS pattern and add a WEBCHAT_TEXT_CHUNK_LIMIT environment variable.

Related

  • #83658 — Original bug report
  • #66333 — Partial fix (bypass removed, but default unchanged)
  • #85243 — WebChat truncation despite settings
  • #83151 — Chat history view truncation (separate code path)

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

A 4000-character default I guess is OK, but it should at least be configurable, e.g. with a key under gateway.webchat. Better would be to remove the limitation for webchat altogether - see option A under proposed fixes.

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]: WebChat 4K truncation fix half-applied — bypass removed but default unchanged, no config override