mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 13:41:30 +00:00
gateway: add chat.send block streaming regression coverage
This commit is contained in:
@@ -136,6 +136,42 @@ describe("gateway server chat", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("chat.send does not force-disable block streaming", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const spy = vi.mocked(getReplyFromConfig) as unknown as ReturnType<typeof vi.fn>;
|
||||
await connectOk(ws);
|
||||
|
||||
await createSessionDir();
|
||||
await writeMainSessionStore();
|
||||
testState.agentConfig = { blockStreamingDefault: "on" };
|
||||
try {
|
||||
spy.mockReset();
|
||||
let capturedOpts: Record<string, unknown> | undefined;
|
||||
spy.mockImplementationOnce(async (_ctx, opts) => {
|
||||
capturedOpts = opts as Record<string, unknown> | undefined;
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user