Skip to content

Commit 424c6d0

Browse files
clawsweeper[bot]luyao618Takhoffman
authored
fix(auto-reply): honor webchat textChunkLimit/chunkMode config overrides [AI-assisted] (#83742)
Summary: - This PR removes the WebChat special-case from auto-reply chunk limit/mode resolution, adds WebChat override regression tests, and records the fix in the changelog. - Reproducibility: yes. from source inspection rather than runtime execution: current main returns the fallbac ... bchat` before reading `cfg.channels`, so a configured `channels.webchat.textChunkLimit` cannot take effect. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(auto-reply): honor webchat textChunkLimit/chunkMode config overri… Validation: - ClawSweeper review passed for head cd9ac01. - Required merge gates passed before the squash merge. Prepared head SHA: cd9ac01 Review: #83742 (comment) Co-authored-by: luyao618 <364939526@qq.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
1 parent 583a60f commit 424c6d0

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Docs: https://docs.openclaw.ai
5454
- Models: show the effective OpenAI/Codex auth profile in `/models` provider headers instead of falling back to the OpenAI env-key label. (#83697) Thanks @yu-xin-c.
5555
- Browser: keep a profile `cdpPort` when its `cdpUrl` omits a port, while still letting explicitly written URL ports win. (#82166) Thanks @Marvae.
5656
- Agents/image generation: allow distinct `image_generate` prompts to start separate session-backed background tasks while same-prompt retries still return the active task status. (#83614) Thanks @Elarwei001.
57+
- Gateway/WebChat: honor configured `channels.webchat.textChunkLimit` and `chunkMode` overrides when chunking WebChat replies. (#83713)
5758
- Control UI: stop the chat reading indicator from sticking after an assistant response finishes. (#83515) Thanks @njuboy11.
5859
- Skills: reject empty or whitespace-only skill names and descriptions during quick validation. (#27061)
5960
- Sessions: skip trailing custom transcript entries when checking tail assistant replies so embedded CLI gap-fill does not duplicate canonical assistant output. (#83635) Thanks @yaoyi1222.

src/auto-reply/chunk.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,26 @@ describe("resolveTextChunkLimit", () => {
330330
options: undefined,
331331
expected: 4000,
332332
},
333+
{
334+
name: "honors webchat textChunkLimit override from config",
335+
cfg: {
336+
channels: {
337+
webchat: { textChunkLimit: 16000 },
338+
},
339+
},
340+
provider: "webchat" as const,
341+
accountId: undefined,
342+
options: undefined,
343+
expected: 16000,
344+
},
345+
{
346+
name: "falls back to default when webchat has no override",
347+
cfg: { channels: {} },
348+
provider: "webchat" as const,
349+
accountId: undefined,
350+
options: undefined,
351+
expected: 4000,
352+
},
333353
] as const)("$name", ({ cfg, provider, accountId, options, expected }) => {
334354
expect(resolveTextChunkLimit(cfg as never, provider, accountId, options)).toBe(expected);
335355
});
@@ -584,6 +604,12 @@ describe("resolveChunkMode", () => {
584604
{ cfg: providerCfg, provider: "discord", accountId: undefined, expected: "length" },
585605
{ cfg: accountCfg, provider: "slack", accountId: "primary", expected: "newline" },
586606
{ cfg: accountCfg, provider: "slack", accountId: "other", expected: "length" },
607+
{
608+
cfg: { channels: { webchat: { chunkMode: "newline" as const } } },
609+
provider: "webchat",
610+
accountId: undefined,
611+
expected: "newline",
612+
},
587613
] as const)(
588614
"resolves default/provider/account/internal chunk mode for $provider $accountId",
589615
({ cfg, provider, accountId, expected }) => {

src/auto-reply/chunk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { resolveChannelStreamingChunkMode } from "../plugin-sdk/channel-streamin
99
import { resolveAccountEntry } from "../routing/account-lookup.js";
1010
import { normalizeAccountId } from "../routing/session-key.js";
1111
import { chunkTextByBreakResolver } from "../shared/text-chunking.js";
12-
import { INTERNAL_MESSAGE_CHANNEL } from "../utils/message-channel.js";
1312

1413
export type TextChunkProvider = ChannelId;
1514

@@ -64,7 +63,7 @@ export function resolveTextChunkLimit(
6463
? opts.fallbackLimit
6564
: DEFAULT_CHUNK_LIMIT;
6665
const providerOverride = (() => {
67-
if (!provider || provider === INTERNAL_MESSAGE_CHANNEL) {
66+
if (!provider) {
6867
return undefined;
6968
}
7069
const channelsConfig = cfg?.channels as Record<string, unknown> | undefined;
@@ -102,7 +101,7 @@ export function resolveChunkMode(
102101
provider?: TextChunkProvider,
103102
accountId?: string | null,
104103
): ChunkMode {
105-
if (!provider || provider === INTERNAL_MESSAGE_CHANNEL) {
104+
if (!provider) {
106105
return DEFAULT_CHUNK_MODE;
107106
}
108107
const channelsConfig = cfg?.channels as Record<string, unknown> | undefined;

0 commit comments

Comments
 (0)