Skip to content

docs(proposals): add What?/Why? for A2A task route capture parse comp…#396

Open
mkoushni wants to merge 1 commit into
praxis-proxy:mainfrom
mkoushni:docs/353-a2a-task-route-capture-parse-complexity
Open

docs(proposals): add What?/Why? for A2A task route capture parse comp…#396
mkoushni wants to merge 1 commit into
praxis-proxy:mainfrom
mkoushni:docs/353-a2a-task-route-capture-parse-complexity

Conversation

@mkoushni

Copy link
Copy Markdown
Contributor

Summary

try_capture_from_buffer in filters/src/agentic/a2a/mod.rs (the
non-streaming A2A task-route capture path) hex-decodes and attempts a
full serde_json::from_slice parse over the entire accumulated
response buffer
on every on_response_body chunk, discarding the
result whenever the JSON is still incomplete. For a body delivered in
k chunks, this repeats full decode+parse work over an ever-growing
buffer 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 the
docs/proposals/template.md convention. Per the template note, the
How? section is intentionally omitted here and will follow in a
separate PR once the proposal direction is agreed.

What's in this PR

  • New proposal: docs/proposals/00353_a2a-task-route-capture-parse-complexity.md
  • Describes bounding the per-chunk capture cost to O(chunk) via an
    incremental, 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.
  • Explicitly scoped to the non-streaming capture path only — the
    SSE capture path (process_sse_response_chunk) already scans
    incrementally and is unaffected.
  • Preserves the existing opportunistic, pre-EOS capture requirement
    (a route must be captured as soon as the JSON body is complete,
    without waiting for end_of_stream, since Pingora may not deliver
    a separate EOS callback after the final data chunk).
  • Non-goals: no change to the hex-encoding scheme used for multibyte
    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 lint passes (clippy, fmt-check, separator/filter-docs lints)
  • No code changes in this PR — documentation only

Relates to #353

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant