Uh oh!
There was an error while loading. Please reload this page.
fix(provider): ignore SSE comment heartbeats for chunk timeout - #43607
fix(provider): ignore SSE comment heartbeats for chunk timeout#436071052326311 wants to merge 3 commits into
Conversation
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
1052326311
commented
Aug 20, 2026
Current head |
1052326311
commented
Aug 21, 2026
Follow-up head |
…ray semantics Deviations from the ported upstream hunks, per review: - anomalyco#43881: the empty-stream guard now fails only when the attempt produced no text/reasoning delta and no tool-call event. Providers may stream real content but omit the usage block and finish reason; retrying those would duplicate already-persisted output (up to 6 attempts). Empty-content deltas still count as empty, so the original clean-EOF retry is intact. - anomalyco#38939: listeners are an Array again. The Set container silently deduplicated identical callback registrations and removed every entry on the first unsubscribe; duplicates must deliver independently. - adds the missing multi-byte UTF-8 split regression for anomalyco#43607's streaming TextDecoder
…co#42150anomalyco#42176anomalyco#43881anomalyco#43607) - O(N) text/reasoning delta accumulation instead of O(N^2) string concat (anomalyco#42150) — the lazy chunk buffer joins on read - finish reason 'error' is set when a stream fails mid-flight (anomalyco#42176) - clean-EOF empty provider streams retry like transient errors (anomalyco#43881), narrowed from the upstream patch: only an attempt that produced no text/reasoning delta and no tool call qualifies, so providers that stream content but omit usage/finish are not retried into duplicate output - SSE comment heartbeats no longer reset the chunk timeout (anomalyco#43607); the streaming TextDecoder handles multi-byte characters split across reads (regression covered)
Issue for this PR
Closes#43519
Type of change
What does this PR do?
chunkTimeoutcurrently restarts for every response body read. SSE comment frames such as: keepalivetherefore prevent an otherwise stalled model stream from timing out. This keeps one deadline across reads and resets it only after a complete SSE event containingdata:. It leaves header timeouts and non-SSE responses unchanged.The regression starts the existing loopback OpenAI-compatible test server with one data event followed by comment heartbeats every 20 ms. With a 50 ms
chunkTimeout, the stream must produce the existing typed response-stream error.How did you verify your code works?
b155b15694dbcc6768f11d2f25cc2bdd1f738ab4to headb9234e31edc25d9f1334b27aaf9b4dd9c918484f: one commit and only the provider wrapper plus its existing test file changed.dev.wrapSSEfunction extracted from its Git blob against a loopback SSE server: after one data event and ongoing 20 ms comment heartbeats, its 50 ms deadline raisedSSE read timed out.Provider.getLanguage()andstreamText()in CI.Screenshots / recordings
Not a UI change.
Checklist