docs(proposals): add What?/Why? for A2A task route capture parse comp…#396
Open
mkoushni wants to merge 1 commit into
Open
docs(proposals): add What?/Why? for A2A task route capture parse comp…#396mkoushni wants to merge 1 commit into
mkoushni wants to merge 1 commit into
Conversation
…lexity try_capture_from_buffer in the A2A filter hex-decodes and JSON-parses the entire accumulated response buffer on every on_response_body chunk, producing O(n^2) work in total response body bytes. Add the proposal's What?/Why? sections per the docs/proposals template; the How? section will follow in a separate PR once direction is agreed. Relates to praxis-proxy#353 Signed-off-by: mkoushni <mkoushni@redhat.com>
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.
Summary
try_capture_from_bufferinfilters/src/agentic/a2a/mod.rs(thenon-streaming A2A task-route capture path) hex-decodes and attempts a
full
serde_json::from_sliceparse over the entire accumulatedresponse buffer on every
on_response_bodychunk, discarding theresult whenever the JSON is still incomplete. For a body delivered in
kchunks, this repeats full decode+parse work over an ever-growingbuffer on every chunk, producing O(n²) total work in response body
bytes rather than O(n) — see #353.
This PR adds the proposal's
What?/Why?sections per thedocs/proposals/template.mdconvention. Per the template note, theHow?section is intentionally omitted here and will follow in aseparate PR once the proposal direction is agreed.
What's in this PR
docs/proposals/00353_a2a-task-route-capture-parse-complexity.mdincremental, string-aware brace/bracket depth scan, so the
expensive hex-decode + JSON parse is only attempted once the buffer
plausibly holds a complete, balanced JSON value.
SSE capture path (
process_sse_response_chunk) already scansincrementally and is unaffected.
(a route must be captured as soon as the JSON body is complete,
without waiting for
end_of_stream, since Pingora may not delivera separate EOS callback after the final data chunk).
UTF-8 chunk-boundary safety, no change to the SSE scanner, and no
overlap with fix(a2a): streaming methods with non-SSE response skip task route capture #352 (handled separately).
Test plan
make lintpasses (clippy, fmt-check, separator/filter-docs lints)Relates to #353