Repository navigation
fix: stream LLM tokens for cloud conversations and profile switches - #15021
Merged
Merged
Conversation
2 of 6 tasks
Cloud agent conversations never enabled LLM token streaming. The app-server builds the agent LLM from the user's saved settings (_configure_llm) and from saved profiles (resolve_profile_llm), both of which default stream=False (the SDK LLM default), so no StreamingDeltaEvents were emitted and the UI received whole messages at once. The GUI sets stream=True explicitly on the local start and switch paths; the server-resolved cloud paths had no equivalent. Force stream=True in both resolvers so cloud conversations stream at start and stay streaming after a profile switch (resolve_profile_llm feeds the agent-server's switch_llm).
VascoSch92
force-pushed
the
vasco/cloud-llm-streaming
branch
from
June 29, 2026 13:02
aea5a4f to
bb7e727
Compare
VascoSch92
marked this pull request as ready for review
June 29, 2026 13:03
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
hieptl
requested changes
Jun 29, 2026
hieptl
left a comment
Collaborator
There was a problem hiding this comment.
Hello @VascoSch92,
Would you mind including a short demo video showing how streaming works for cloud conversations? It would be very helpful for reviewing the implementation.
Also, have you had a chance to test this feature when running the SaaS application locally or using a feature deployment?
Thank you very much! 🙏
The cloud-streaming fix makes the agent server emit StreamingDeltaEvents, but the v1 frontend ignored them and only rendered whole messages. Render those token deltas live: - Add the StreamingDeltaEvent type, type guard, and event-union entry. - Merge consecutive deltas into one growing bubble (skipping interleaved ConversationStateUpdateEvent metrics) and reconcile the final MessageEvent / FinishAction into it rather than appending a duplicate (ported from agent-canvas). - Keep merged deltas in the event store so the chat's allEvents lookup resolves them (a delta missing from that list renders empty). - Render the streamed answer as the assistant bubble and the streamed reasoning as a collapsible "Thinking" section, reusing GenericEventMessage (new EVENT$THINKING i18n key). - Fix Messages memo: it only re-rendered on messages.length change, so a streaming bubble growing in place never repainted until the next event changed the length; fall back to the default shallow comparison. Add reducer unit tests for delta merge, mid-stream metrics interleave, final-message reconciliation, and the non-streamed path.
Member
Author
Screen.Recording.2026-06-30.at.11.24.04.mov |
hieptl
reviewed
Jun 30, 2026
Member
Author
|
Hey, to answer your comments: both problems are already fixed in the sdk (OpenHands/software-agent-sdk#3925 and OpenHands/software-agent-sdk#3901) but are not released yet. We can also wait with this PR until the agent-server version is bumped. |
This was referenced Jun 30, 2026
1 task done
Contributor
|
🚀 Released in 1.9.0. |
Contributor
|
🚀 Released in cloud-1.41.0. |
Closed
2 tasks done
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.
HUMAN:
Enable streaming in settings.
AGENT:
Evidence:
uv run pytest tests/unit/app_server/test_app_conversation_router.py tests/unit/app_server/test_live_status_app_conversation_service.py tests/unit/app_server/test_profiles_api.py→ 203 passed, including the two extended happy-path assertions: theswitch_profileendpoint sendsstream: trueto the agent-server'sswitch_llm, and_configure_llmreturnsllm.stream is True.ruff@0.12.5 format --checkandruff checkare clean on the changed files.Why
Cloud agent conversations never enabled LLM token streaming. The app-server resolves the agent LLM from the user's saved settings (
_configure_llm) and from saved profiles (resolve_profile_llm), both of which defaultstream=False(the SDKLLMdefault). Withstream=Falsethe SDK never invokes theon_tokencallback, so noStreamingDeltaEvents are emitted and the UI receives whole messages at once. The GUI setsstream=Trueexplicitly on the local start/switch paths, but the server-resolved cloud paths had no equivalent — so a cloud conversation (and any cloud profile switch) silently lost streaming.Summary
_configure_llm(conversation start) now forcesstream=Trueon the resolved agent LLM.resolve_profile_llm(profile switch endpoint + the agent-server profile-store sync) now forcesstream=True, so a switched-to profile keeps streaming.Issue Number
N/A
How to Test
uv run pytest tests/unit/app_server/test_app_conversation_router.py tests/unit/app_server/test_live_status_app_conversation_service.py(203 pass)./model <name>) and confirm it keeps streaming.Video/Screenshots
Not captured; live token-streaming verification is pending human testing against a deployed app-server.
Type
Notes
agent.condenser.llm) and the ACP path (acp_settings.llm, which streams natively) are built separately and intentionally untouched.To run this PR locally, use the following command:
GUI with Docker: