mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1953] [CLOSED] serve: the keep-alive while a prompt is read is a real SSE frame, not a comment #3774
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3774
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1953
Author: @rebuilt
Created: 10/11/2026
Status: ❌ Closed
Base:
main← Head:fix/sse-keepalive-frames📝 Commits (1)
e17b07cserve: the keep-alive while a prompt is read is a real SSE frame, not a comment📊 Changes
3 files changed (+81 additions, -11 deletions)
View changed files
📝
docs/DETAILS.md(+5 -3)📝
serve/server.py(+20 -6)📝
serve/test_server.py(+56 -2)📄 Description
What
The streaming keep-alive (the heartbeat while a long prompt is read, or while a tool argument is held back) is written as an SSE comment (
: keep-alive). A client that resets its stream idle timeout on parsed SSE frames drops comments before that accounting, so a slow prefill times out and the client retries from scratch every time.This changes the two writers whose clients time out this way:
/v1/chat/completions: an emptychat.completion.chunk, reusing the last real chunk'sid/created/model(choices: [{index: 0, delta: {}, finish_reason: null}])./v1/messages: a realevent: ping/data: {"type":"ping"}./v1/responsesalready sends a realresponse.in_progressevent every 15 s, so it is unchanged.Why not the comment
Reported from a live OpenCode session against a local Strata (gfx1201, IQ3_S 128k): 72k–100k-token prompts, 1–4 minute prefills. OpenCode applies its
chunkTimeout(default 300 s) to the parsed frame stream and ignores comments, so it aborted mid-stream with"Timed out waiting for response data"/"Connection lost while reading the response"and retried, each retry re-reading the prompt. The engine log showed the abandoned turn:After the change, ~5.5 h of the same traffic: 0 client timeouts/retries, 301 requests served, 0 stalls, 0 engine faults.
Related
Tests
serve/test_server.py::KeepAliveFrames—test_chat_keepalive_is_a_frame,test_anthropic_keepalive_is_a_ping_event.PromptProgress.test_a_client_that_does_not_ask_gets_a_keep_alive_framenow expects the empty chunk instead of the comment.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.