Skip to content

Keep a stream alive while the model thinks - #202

Closed
0xadvait wants to merge 1 commit into
OpenGradient:mainfrom
0xadvait:keep-alive-while-thinking
Closed

0xadvait wants to merge 1 commit into
OpenGradient:mainfrom
0xadvait:keep-alive-while-thinking

Conversation

@0xadvait

Copy link
Copy Markdown
Contributor

A model that is thinking, or writing a tool call that's buffered, streams nothing. chat-api's OHTTP relay drops a stream that sends nothing for 210 s (read=210.0 in src/core/llms.py). So long agent steps die there: the client gets "chunked OHTTP response ended before its header", and the reply is still billed. We see this from ghost, at exactly 210 s.

After 15 s with nothing sent, the stream now sends an SSE comment (: keep-alive). Every reader here skips lines that don't start with data:: the SDK, opengradient-ohttp, chat-app's OHTTP parser, x402's stream parsing and _parse_final_sse_json. It isn't part of the signed output, so nothing else changes.

It changes the enclave image, so it goes live with the next redeploy.

A thinking model, or a buffered tool call, streams nothing, and chat-api's
relay drops a stream that sends nothing for 210 s. After 15 s with nothing
sent, the stream now sends an SSE comment, which every client skips.
@0xadvait 0xadvait closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant