Skip to content

Parity tests: Add body-reading spy for extproc vs. proxy body handshake #937

Closed

Description

@evaline-ju

The parity suite doesn't currently exercise body handling. The spy never sets ReadsBody, so NeedsBody() is always false and the body-handling branches in both drivers are unreachable.

Why it matters

Extproc and the HTTP proxies handle bodies through different code paths — extproc uses a two-phase mode-override handshake with Envoy sending explicit RequestBody / ResponseBody messages; the proxies buffer or stream in-process via Go's HTTP stack. Without a fixture that engages this path, whole classes of drift stay invisible:

  • Frame-count divergence (extproc BUFFERED delivers one terminal frame; forwardproxy streams frame-by-frame). This is the exact class of bug behind litellm-budget-track's settled guard.
  • SSE parsing divergence (each listener re-parses the response body independently).
  • WritesRequestBody / WritesResponseBody mutation replay — a plugin that rewrites a body via pctx.SetBody might land on the wire on one listener and not the other.
  • ReadsBody-gated recording (the current PR only exercises header-only response events).

Fix

Add a body-reading knob to spyPlugin.Capabilities and a fixture that:

  • Sets ReadsBody: true.
  • Sends a request body and an upstream response body (streamed SSE or buffered JSON).
  • Asserts both listeners observe the same terminal-frame count and the same body bytes at the plugin layer.

The runExtproc driver already conditionally sends RequestBody/ResponseBody messages when NeedsBody() is true; the wiring on the pipeline side works, only the fixture is missing.

Follow-up from #935.

Activity

  1. changed the title [-]Parity fixture: body-reading spy for extproc vs. proxy body handshake[/-] [+]parity tests: body-reading spy for extproc vs. proxy body handshake[/+] on Sep 10, 2026
  2. changed the title [-]parity tests: body-reading spy for extproc vs. proxy body handshake[/-] [+]Parity tests: body-reading spy for extproc vs. proxy body handshake[/+] on Sep 10, 2026
  3. changed the title [-]Parity tests: body-reading spy for extproc vs. proxy body handshake[/-] [+]Parity tests: Add body-reading spy for extproc vs. proxy body handshake[/+] on Sep 10, 2026
  4. self-assigned this
    on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions