fix(api-server): keep chat-completions SSE alive during long tool runs - #7901
Closed
helix4u wants to merge 1 commit into
Closed
fix(api-server): keep chat-completions SSE alive during long tool runs#7901helix4u wants to merge 1 commit into
helix4u wants to merge 1 commit into
Conversation
helix4u
marked this pull request as ready for review
April 11, 2026 18:46
Contributor
|
Merged via PR #7910. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks for the SSE keepalive fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This keeps the OpenAI-compatible chat completions SSE stream alive during long quiet stretches of tool work.
Right now that stream can go completely silent while Hermes is still busy in the background. Some OpenAI-compatible frontends treat that idle connection like the run stalled or died, even though the agent is still working. This change brings the chat completions SSE path closer to the existing runs events behavior by sending periodic SSE keepalive comments and disabling proxy buffering on the stream.
Related Issue
No issue linked for this one yet.
Type of Change
Changes Made
How to Test
Checklist
Code
Full suite result on current main: 45 failed, 10471 passed, 33 skipped.
Focused results for this change:
Documentation & Housekeeping
Screenshots / Logs
python -m pytest tests/gateway/test_api_server.py -q
107 passed, 67 warnings in 4.24s
python -m pytest tests/gateway/test_sse_agent_cancel.py -q
6 passed in 1.21s