docs(proposals): add What?/Why? for A2A task route capture parse comp…#396
docs(proposals): add What?/Why? for A2A task route capture parse comp…#396mkoushni wants to merge 9 commits 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>
aslakknutsen
left a comment
There was a problem hiding this comment.
Notation fix (What?/Why?): Current cost is Θ(n·k) for body size n and chunk count k, not “O(n²) in the number of chunks.” O(n²) only holds when k = Θ(n) (e.g. 1-byte chunks). Align the What?
The What?/Why? sections and graduation criteria described the current try_capture_from_buffer cost as flatly "O(n²) in the number of chunks," which only holds when chunk count k scales with body size n (e.g. 1-byte chunks). State the general cost as Θ(n·k) for body size n and chunk count k, calling out Θ(n²) as the fine-grained-chunking special case. Also drop the placeholder discussion field: this proposal originates from a bot-flagged issue (praxis-proxy#353) with no prior discussion thread to link. Addresses review from @aslakknutsen on praxis-proxy#396. Signed-off-by: mkoushni <mkoushni@redhat.com>
|
Proposal validation failed:
|
Replace shaneutt/nerdalert with aslakknutsen, who is the actual reviewer engaged on this proposal (praxis-proxy#396). Signed-off-by: mkoushni <mkoushni@redhat.com>
Removing the discussion field per review feedback broke the
proposal-check workflow, which requires a non-empty discussion field
per docs/proposals.md ("CI will close PRs that: Are missing a
discussion or issue link"). This proposal has no separate GitHub
Discussion thread (it originates from a bot-flagged issue), so point
discussion at this PR's own conversation instead, which is where the
What?/Why? discussion is actually happening.
Signed-off-by: mkoushni <mkoushni@redhat.com>
praxis-bot
left a comment
There was a problem hiding this comment.
Proposal Review: A2A Task Route Capture Parse Complexity
Clean, well-structured proposal that correctly follows the template convention (What?/Why? only, How? deferred to a follow-up PR). The technical analysis of the O(n²) complexity in try_capture_from_buffer is sound, the scoping to the non-streaming capture path is appropriate, and the goals/non-goals are clearly delineated.
One formatting nit: several prose lines in the body text exceed the 80-character markdown wrap limit (up to 192 chars on the worst offender). See inline comment.
| Severity | Count |
|---|---|
| Medium | 1 |
🤖 Reviewed by praxis-bot
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