Repository navigation
fix(stream): decode complete SSE events and preserve cancellation - #1257
Merged
Merged
Conversation
Contributor
|
This pull request is merged. |
XuPeng-SH
commented
Nov 10, 2026
XuPeng-SH
left a comment
Collaborator
Author
There was a problem hiding this comment.
Request changes: two reproducible stream read-ahead defects remain. GitHub does not permit the author account to submit a formal request-changes review on its own PR. The Responses CI regression is being fixed separately without changing the MOI gate.
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.
Capability assessment: Unchanged: existing model and agent capabilities are retained; stream decoding, cancellation, and diagnostic accuracy are corrected.
Summary
Decode each SSE event once after its data fields are joined, across provider inference, model checks and Astra clients. Preserve event order and terminal boundaries while local tools are running. Carry the existing incremental framer through Edge read-ahead so split CRLF and UTF-8 boundaries cannot manufacture or lose events.
Keep validated clean-EOF control events usable for cancellation. Process complete provider terminal events at a clean EOF through the same validation as framed events. Correct misleading retry, background-task and destructive-command feedback, and label persisted execution counters that can lag active work.
The affected session recorded malformed SSE JSON but did not retain its upstream bytes. The reproduced decoder defect is a plausible cause, not proof of that session's exact failure.
Related issue
None.
Change type
User and compatibility impact
Legal multiline and no-space SSE data fields are handled consistently. Complete final payloads at a clean EOF still need a validated semantic terminal; truncated or nonterminal provider responses fail. Astra control streams retain their clean-EOF terminal behavior. Messages now describe actual recovery and background-task capabilities.
Architecture and complexity delta
Verification
cargo test -p astra-turn-core --lib sse::stream_host::tests -- --test-threads=1(86 passed),make format-check, andcargo clippy --locked -p astra-turn-core -p astra-cli --lib -- -D warningspassed. Cases cover malformed frames with active tools, terminal ordering across chunks, clean EOF, and a non-fused source.611ebf95a, CI online core-runtime/integration, MOI fresh-Astra compatibility, lint and live harness passed. The new head has triggered CI again.make format-checkandcargo clippy --locked -p astra-core -p astra-services -p astra-runtime -p astra-test-harness --tests -- -D warningspassed for this CI fix.Earlier verification, on commit
7fddf65before the CI fix:cargo test -p astra-turn-core --lib sse -- --test-threads=1(361 passed) andcargo test -p astra-turn-core --test sse_events(3 passed).RUSTFLAGS=-Zsanitizer=thread cargo +nightly test -Zbuild-std --target aarch64-apple-darwin; the runtime Responses test reused the instrumented test binary built from the same source.make format-check;cargo clippy --locked -p astra-core -p astra-thin-client -p astra-turn-core -p astra-runtime -p astra-services -p astra-cli --all-targets -- -D warnings;python3 scripts/ci/validate_repository.py; PR metadata check: passed.Final checklist