fix(provider): ignore SSE comment heartbeats for chunk timeout - #43607
1052326311 wants to merge 3 commits into
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Current head |
|
Follow-up head |
…co#42150 anomalyco#42176 anomalyco#43881 anomalyco#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)
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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:. Header timeouts and non-SSE responses are unchanged.The regression uses the existing loopback OpenAI-compatible server: it sends one data event, then comment heartbeats every 20 ms. With a 50 ms timeout, the stream must produce the existing typed response-stream error.
How did you verify your code works?
3a31c4ea801915c0b050df4b3842997ea62b6e938de252f7aed6b8fc4d93a650be397fd385c7c433The upstream
test,typecheck, andnix-evalworkflows require maintainer approval for this fork head.Screenshots / recordings
Not applicable; this is a provider timeout fix.
Checklist