refactor: centralize agent timeout defaults

This commit is contained in:
Peter Steinberger
2026-01-06 02:48:44 +00:00
parent d83ca74c18
commit 20a361a3cf
9 changed files with 90 additions and 27 deletions

View File

@@ -40,6 +40,27 @@ describe("gateway server chat", () => {
await server.close();
});
test("chat.send defaults to agent timeout config", async () => {
testState.agentConfig = { timeoutSeconds: 123 };
const { server, ws } = await startServerWithClient();
await connectOk(ws);
const res = await rpcReq(ws, "chat.send", {
sessionKey: "main",
message: "hello",
idempotencyKey: "idem-timeout-1",
});
expect(res.ok).toBe(true);
const call = vi.mocked(agentCommand).mock.calls.at(-1)?.[0] as
| { timeout?: string }
| undefined;
expect(call?.timeout).toBe("123");
ws.close();
await server.close();
});
test("chat.send blocked by send policy", async () => {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-gw-"));
testState.sessionStorePath = path.join(dir, "sessions.json");