fix: increase DEFAULT_CHUNK_TIMEOUT from 2min to 5min

Merged
AL
4mo ago
+1-1

Problem

The wrapSSE() function in provider.ts enforces a per-chunk timeout: if no SSE chunk arrives within the window, it aborts the stream with Error("SSE read timed out"). The previous 120s window was too tight for slow LLM providers (e.g. large reasoning models, cold starts) during multi-turn tool-call sessions.

When this fires, the error propagates through AbortSignal.any() in the custom fetch wrapper and surfaces as UnknownError: SSE read timed out on the assistant message — the chat freezes with no retry path.

Change

packages/opencode/src/provider/provider.ts

-const DEFAULT_CHUNK_TIMEOUT = 120_000
+const DEFAULT_CHUNK_TIMEOUT = 300_000

5 minutes gives adequate headroom for slow providers without masking genuine hangs.

Companion PR

AltimateAI/vscode-altimate-mcp-server#343 — adds a retry button for MessageAbortedError in the chat UI, covering the session-restart abort path.

Requested by @saravmajestic via harness


Summary by cubic

Increase SSE per-chunk timeout from 2 minutes to 5 minutes by raising DEFAULT_CHUNK_TIMEOUT to 300_000, giving slow LLM streams more headroom during long tool-call sessions. This reduces false “SSE read timed out” aborts and prevents chat freezes.