From dd6efee9008df1fb1f0465e074554a8d333a875f Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Sun, 23 Nov 2025 19:34:14 +0000 Subject: [PATCH] disable SSE body timeouts and ignore workspace-stopped disconnects --- packages/server/src/workspaces/instance-events.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/workspaces/instance-events.ts b/packages/server/src/workspaces/instance-events.ts index a24858dc..efe73853 100644 --- a/packages/server/src/workspaces/instance-events.ts +++ b/packages/server/src/workspaces/instance-events.ts @@ -1,10 +1,12 @@ -import { fetch } from "undici" +import { Agent, fetch } from "undici" +import { Agent as UndiciAgent } from "undici" import { EventBus } from "../events/bus" import { Logger } from "../logger" import { WorkspaceManager } from "./manager" import { InstanceStreamEvent, InstanceStreamStatus } from "../api-types" const INSTANCE_HOST = "127.0.0.1" +const STREAM_AGENT = new UndiciAgent({ bodyTimeout: 0, headersTimeout: 0 }) const RECONNECT_DELAY_MS = 1000 interface InstanceEventBridgeOptions { @@ -97,6 +99,7 @@ export class InstanceEventBridge { const response = await fetch(url, { headers: { Accept: "text/event-stream" }, signal, + dispatcher: STREAM_AGENT, }) if (!response.ok || !response.body) {