fix: forward chat send run overrides

This commit is contained in:
Peter Steinberger
2026-05-17 04:30:56 +01:00
parent c608dd4084
commit e0110bd8c9
2 changed files with 34 additions and 0 deletions

View File

@@ -2159,6 +2159,7 @@ export const chatHandlers: GatewayRequestHandlers = {
sessionId?: string;
message: string;
thinking?: string;
fastMode?: boolean;
deliver?: boolean;
originatingChannel?: string;
originatingTo?: string;
@@ -2822,6 +2823,8 @@ export const chatHandlers: GatewayRequestHandlers = {
abortSignal: activeRunAbort.controller.signal,
images: replyOptionImages,
imageOrder: imageOrder.length > 0 ? imageOrder : undefined,
thinkingLevelOverride: p.thinking,
fastModeOverride: p.fastMode,
onAgentRunStart: (runId) => {
agentRunStarted = true;
const connId = typeof client?.connId === "string" ? client.connId : undefined;

View File

@@ -851,6 +851,37 @@ describe("gateway server chat", () => {
});
});
test("chat.send forwards one-shot thinking and fast mode overrides", async () => {
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
const spy = getReplyFromConfig;
await connectOk(ws);
await createSessionDir();
await seedMainSessionEntry();
let capturedOpts: GetReplyOptions | undefined;
mockGetReplyFromConfigOnce(async (_ctx, opts) => {
capturedOpts = opts;
return undefined;
});
const sendRes = await rpcReq(ws, "chat.send", {
sessionKey: "main",
message: "hello",
thinking: "high",
fastMode: true,
idempotencyKey: "idem-thinking-fast",
});
expect(sendRes.ok).toBe(true);
await vi.waitFor(() => {
expect(spy.mock.calls.length).toBeGreaterThan(0);
}, FAST_WAIT_OPTS);
expect(capturedOpts?.thinkingLevelOverride).toBe("high");
expect(capturedOpts?.fastModeOverride).toBe(true);
});
});
test("chat.history hard-caps single oversized nested payloads", async () => {
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
const historyMaxBytes = 64 * 1024;