refactor(streaming): adopt shared Praxis SSE codec for Responses framing - #942
Draft
leseb wants to merge 1 commit into
Draft
refactor(streaming): adopt shared Praxis SSE codec for Responses framing#942leseb wants to merge 1 commit into
leseb wants to merge 1 commit into
Conversation
Migrate the OpenAI Responses provider-neutral SSE record framing onto the shared `praxis_filter::sse` codec introduced by praxis-proxy/praxis#1060 (epic praxis#985). `SseFrameParser` now delegates byte-level line/record framing to `SseDecoder` while keeping the OpenAI-facing `SseFrame` / `SseParseError` surface, the `[DONE]` sentinel, the event-count budget, timeouts, and lifecycle rules in the Responses consumers unchanged. Because praxis has no release carrying the codec yet, pin the praxis core crates to main at the #1060 merge commit and move Pingora to the 0.8.4 fork in lockstep with core. Consumers are migrated only where their framing matches the shared contract: - OpenAI Responses (`openai_stream_events`, `responses::parser`) moves onto the codec. `parse_chunk` now takes `&Bytes` and threads it into the decoder without copying (zero-copy `slice`/`from_static` in tests). - The A2A route-capture scanner and the token-usage counter that reuses it are intentionally left in place: they are fail-open and recoverable on an oversized record (drop it, resync at the next boundary), whereas the shared decoder poisons permanently. Adopting the codec there needs a recoverable/resync mode in praxis#986, not another AI-local parser; the gap is documented in the A2A `sse` module and referenced from the token-usage consumer. - Anthropic `anthropic_stream_events` migration is deferred to a follow-up PR. `max_buffer_bytes` maps onto both codec framing bounds (`max_line_bytes` and `max_record_bytes`); for the single-`data:`-line blocks the Responses API emits, the overflow trip point and peak retained bytes match the pre-codec parser. Duplicate pure-codec framing tests are removed in favor of adapter-focused tests plus the codec's own conformance suite. Refs praxis-proxy#842 Signed-off-by: Sébastien Han <seb@redhat.com>
leseb
marked this pull request as draft
September 7, 2026 07:18
Contributor
Author
|
Draft since we need a new core release with the SSE codec code. |
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
Migrate the OpenAI Responses provider-neutral SSE record framing onto the shared
praxis_filter::ssecodec introduced by praxis-proxy/praxis#1060 (epic praxis#985).SseFrameParsernow delegates byte-level line/record framing toSseDecoderwhile keeping the OpenAI-facingSseFrame/SseParseErrorsurface, the[DONE]sentinel, the event-count budget, timeouts, and lifecycle rules in the Responses consumers unchanged.Praxis has no release carrying the codec yet, so the praxis core crates are pinned to
mainat the #1060 merge commit (c4cab79) and Pingora moves to the0.8.4fork in lockstep with core.Scope — migrate only where framing matches the shared contract
openai_stream_events,responses::parser) → migrated onto the codec.parse_chunknow takes&Bytesand threads it into the decoder without copying.ssemodule and referenced from the token-usage consumer.anthropic_stream_events→ deferred to a follow-up PR.Behavior preservation
max_buffer_bytesmaps onto both codec framing bounds (max_line_bytesandmax_record_bytes). For the single-data:-line blocks the Responses API emits, the overflow trip point and peak retained bytes match the pre-codec parser; thenew()doc describes the mapping truthfully (including how a multi-line record — which the Responses API never emits — is accounted differently). No full-body buffering is introduced and backpressure is not weakened for real traffic.Duplicate pure-codec framing tests are removed in favor of adapter-focused tests plus the codec's own conformance suite.
Testing
make lint✓make test✓make doc✓ (verifies the new intra-doc links)Refs #842