mergedhumanPR #240Transport
fix(a2a): bound streamed responses and version transport policy
Bound external AgentCard and native A2A JSON responses before parsing, and record the effective transport policy in each Path run.
Description
The pitch.
## Summary Bound external AgentCard and native A2A JSON responses before parsing, and record the effective transport policy in each Path run. - Stream with a 1 MiB default byte limit, checking actual bytes even without an honest Content-Length. Request identity encoding and reject unsupported encodings. - Close owned clients and every response; preserve injected-client ownership and the same owned session across a run. - Make no redirects, no ambient proxies/environment settings, and no automatic transport retries explicit for owned clients. The deliberate duplicate logical request remains part of the test. - Use bounded error categories instead of retaining arbitrary remote error bodies or exception strings. - Add `a2a-capability-fulfillment@0.2` as the shared default. Preserve the old `@0.1` profile and its fingerprint; record implementation policy separately for old-profile runs. ## Attribution and scope Carries forward bounded external-invocation requirements from #145 by `abhishekeb211` (reviewed head `ddc5f4c5ee67db7b9784b1198446eee596facf53`) and techniques from James's historical #222 (source commit `77c9ff3a39260e31640360be7ccb23652a13d307`), reimplemented for current `main`. It does not port the legacy middleware/deployment rewrite or alter the legacy branches. This transport change leaves the evaluator and its version unchanged. This caps response bytes, not total runtime. HTTPX phase timeouts are not a cancellable overall deadline. Connection-bound address/DNS policy is a separate follow-up; intentional localhost/LAN agents remain supported. Injected client proxy/retry settings remain caller-controlled and are disclosed as such. Disabling environment settings also affects corporate proxies and custom certificate configuration. The README describes this tradeoff. Explicit profile selection uses `--path-profile`. ## Merge order **Prerequisite landed:** #238 (`f8489d7`) corrects the generated rerun flag so old-profile reruns retain their selected version. This branch has been refreshed with that change and #239 (`7af8084`, scenario coverage). The transport diff against current `main` remains separate from those fixes. ## Verification Behavioral tests cover byte boundaries, length/encoding/JSON errors, cleanup, native success, real loopback redirects/proxy bypass/no POST retry/phase timeout, CLI profile selection, and bundle replay. - Focused RED: 37 failed, 9 passed before production changes. Two additional self-review regressions failed before their compatibility fixes. - Focused GREEN: 48 passed. - Independent full-suite verification on Python 3.12: 221 passed, nine pre-existing warnings. - Final candidate `0d7ed81` including landed #238 and #239: 236 passed, nine pre-existing warnings. Independent integration review confirmed all appended tests were retained unchanged. - Combined with pending #233–#237, coverage and rerun changes: 267 tests passed. - A genuine baseline `@0.1` bundle verifies and replays with this transport branch. The separate evaluator update in #236 explicitly reports its version mismatch rather than silently replaying with changed rules. - Independent task and whole-batch reviews approved the combination; dependency ordering is intentional. ```sh python -m pytest -q tests/test_a2a_transport.py tests/test_path.py python -m pytest -q ```
Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/240/head:pr-240
git checkout pr-240