mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 08:01:23 +00:00
fix: remove hardcoded disableBlockStreaming to honor agent config for TUI (#19693)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 710d449080
Co-authored-by: neipor <191749196+neipor@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
import type { GetReplyOptions } from "../auto-reply/types.js";
|
||||
import { __setMaxChatHistoryMessagesBytesForTest } from "./server-constants.js";
|
||||
import {
|
||||
connectOk,
|
||||
@@ -136,6 +137,42 @@ describe("gateway server chat", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("chat.send does not force-disable block streaming", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const spy = getReplyFromConfig;
|
||||
await connectOk(ws);
|
||||
|
||||
await createSessionDir();
|
||||
await writeMainSessionStore();
|
||||
testState.agentConfig = { blockStreamingDefault: "on" };
|
||||
try {
|
||||
spy.mockReset();
|
||||
let capturedOpts: GetReplyOptions | undefined;
|
||||
spy.mockImplementationOnce(async (_ctx: unknown, opts?: GetReplyOptions) => {
|
||||
capturedOpts = opts;
|
||||
});
|
||||
|
||||
const sendRes = await rpcReq(ws, "chat.send", {
|
||||
sessionKey: "main",
|
||||
message: "hello",
|
||||
idempotencyKey: "idem-block-streaming",
|
||||
});
|
||||
expect(sendRes.ok).toBe(true);
|
||||
|
||||
await vi.waitFor(
|
||||
() => {
|
||||
expect(spy.mock.calls.length).toBeGreaterThan(0);
|
||||
},
|
||||
{ timeout: 2_000, interval: 10 },
|
||||
);
|
||||
|
||||
expect(capturedOpts?.disableBlockStreaming).toBeUndefined();
|
||||
} finally {
|
||||
testState.agentConfig = undefined;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("chat.history hard-caps single oversized nested payloads", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const historyMaxBytes = 64 * 1024;
|
||||
@@ -251,7 +288,7 @@ describe("gateway server chat", () => {
|
||||
|
||||
test("smoke: supports abort and idempotent completion", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const spy = vi.mocked(getReplyFromConfig) as unknown as ReturnType<typeof vi.fn>;
|
||||
const spy = getReplyFromConfig;
|
||||
let aborted = false;
|
||||
await connectOk(ws);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user