Repository navigation
Add HTTP stream kind tracking, SSE framing improvements, and finite-stream diagnostics - #233
Merged
MisterVVP merged 2 commits intoSep 1, 2026
Conversation
…le (#235) - Replace the coroutine-wrapped blocking wait with a genuinely wake-driven coroutine state machine while preserving the coroutine-based architecture. - Provide a small internal awaitable/readiness primitive so publication/cancel/shutdown can resume suspended subscription coroutines without polling. - Reduce shared mutable timeout state and remove blocking waits inside the coroutine to enable future async server I/O integration. - Preserve and strengthen `StreamResponseCoroutine` as the coroutine abstraction by adding a promise-side condition variable and completion notification, plus `Next()`/`NextFor()` adapters that wait on coroutine-produced values rather than calling a blocking subscriber wait. (files: `include/a2a/server/stream_response_coroutine.h`, `src/server/task_subscription_service.cpp`) - Introduce a small internal awaitable `SubscriberEventAwaitable` that registers a continuation under the subscriber mutex and is resumed by publication/cancellation/shutdown; `RunSubscription()` now `co_await`s this awaitable instead of calling a blocking `WaitForPublishedEvent()`. (file: `src/server/task_subscription_service.cpp`) - Remove the shared `wait_timeout` mutation from subscriber state and make synchronous `Next()` / `NextFor()` compatibility adapters call the coroutine `Next()`/`NextFor()` which use the promise condition variable for timeout semantics. (files: `include/a2a/server/task_subscription_service.h`, `src/server/task_subscription_service.cpp`) - Add `SignalSubscriber()` to capture and resume continuations outside of subscriber locks, and `WaitForResumes()` plus an `active_resumes` counter so session destruction waits for any in-flight resume to finish (prevents resume-after-destroy and double-resume races). (files: `include/a2a/server/task_subscription_service.h`, `src/server/task_subscription_service.cpp`) - Preserve the queued `std::shared_ptr<const StreamResponse>` fan-out representation and avoid copying semantics changes in the hot path. (file: `include/a2a/server/task_subscription_service.h`) - Keep coroutine readability and lifecycle semantics: `RunSubscription()` still co_yields the initial current-task event and then loops awaiting subscriber events, yielding published updates and returning on terminal/closed. (file: `src/server/task_subscription_service.cpp`) --------- Co-authored-by: Vladimir Pavlov <[email protected]>
MisterVVP
force-pushed
the
dev-optimize-server-side-sse-event-delivery
branch
from
September 1, 2026 06:44
6bb439a to
082e0c9
Compare
MisterVVP
marked this pull request as ready for review
September 1, 2026 07:23
MisterVVP
merged commit Sep 1, 2026
38901c7
into
dev-optimize-streaming-response-latencies
19 checks passed
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.
Motivation
Description
HttpStreamKindenum and addstream_kindfields toRestResponseandHttpServerResponse, and propagate it viaHttpServerResponseBuilder::FromRestResponse.kFiniteorkLiveinrest_transport.cppandjson_rpc_server_transport.cpp, and adjust HTTP connection handling to count finite-stream connections, completed finite streams, and connections reused after finite streams intests/sut/tck_sut.cpp.TaskSubscriptionServiceevent storage tostd::deque<std::shared_ptr<const lf::a2a::v1::StreamResponse>>to avoid expensive copies and return values by dereferencing shared pointers when delivering events.BuildSseEvent/BuildSseJsonRpcPrefix/BuildSseJsonRpcEventhelpers, and use a reusablestd::stringchunk buffer when streaming SSE for both REST and JSON-RPC transports.http_finite_stream_connections,http_completed_finite_streams,http_finite_streams_per_connection,http_connections_reused_after_finite_stream), include them in CSV fieldnames, and document them in the performance README.stream_kindvalues and add a unit test for reading the new finite-stream diagnostics inperformance_runner_test.py.