fix(ai): stop streams getting cut off and keep tool steps across messages

This commit is contained in:
LukeGus committed 2026-09-28 21:08:48 -05:00
1 parent c5b2b880b6
commit b4457b6121
17 files changed
+726 -254

No files matched your search

@@ -5,6 +5,7 @@ import type { LookupAddress, LookupOptions } from "dns";
import {
createDnsLookupHook,
isBlockedAddress,
outboundIdleTimeout,
readResponseTextLimited,
safeOutboundFetch,
} from "../../utils/safe-outbound-fetch.js";
@@ -282,6 +283,17 @@ describe("safeOutboundFetch", () => {
}, 10_000);
});
describe("outboundIdleTimeout", () => {
it("keeps undici's 5 minute default as the floor", () => {
expect(outboundIdleTimeout()).toBe(300_000);
expect(outboundIdleTimeout(30_000)).toBe(300_000);
});
it("raises the idle timeout for a longer request timeout", () => {
expect(outboundIdleTimeout(600_000)).toBe(600_000);
});
});
describe("redirect handling", () => {
it.each([undefined, "error", "follow", "manual"] as const)(
"never follows redirects with mode %s",