fix(client): propagate outbound headers through SDK transports - #514
Merged
Conversation
This was referenced Aug 24, 2026
Collaborator
Author
|
补充审计已完成:
|
This was referenced Aug 24, 2026
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.
变更摘要
A2A-Version、trace 与显式 per-call 请求头写入ClientCallContext.service_parameters,使 SDK transport 真正将其发送到对端。ServiceParametersFactory合并A2A-Extensions,保留显式Authorization覆盖默认凭据的既有语义。ClientCallContext.state["headers"]/state["http_kwargs"]双写,避免无效兼容状态误导后续测试和维护。httpx.Request的回归测试,覆盖 Bearer、Basic、SendMessage、GetTask、协议版本、trace、扩展头和显式鉴权覆盖。CONTRIBUTING.md增加 wire-boundary 测试规范,不在用户指南和兼容性指南中重复维护开发说明。设计与风险审查
a2a-sdk 1.1.2的 HTTP transports 仅从service_parameters构造 HTTP headers,gRPC transport 也将其转换为 metadata;SDK 自身的AuthInterceptor使用同一正式通道。因此本实现比在共享httpx.AsyncClient上固化 headers 更完整,能够覆盖 per-call Authorization、trace、extension 以及外部注入 HTTP client 的场景。服务端 credential allowlist 路径未改动:非 allowlisted host 仍会在创建
A2AClient前剥离凭据。请求 metadata 中的普通业务字段仍留在协议 payload,仅允许的 header 字段进入 transport context。独立复审未发现新的功能、安全或兼容性阻断项。复审期间发现新增 wire-level 测试只覆盖 JSON-RPC,而生产默认也支持 HTTP+JSON;现已将同一组请求头断言扩展到两个真实 SDK HTTP transports。
SDK 与 override 审计
a2a-sdk v1.1.3的 GitHub Release 已创建,但 PyPI 发布因 action 不支持 Core Metadata 2.5 而失败;本 PR 保持可安装的1.1.2pin。上游跟踪:https://github.com/a2aproject/a2a-python/issues/1199。v1.1.3release 精确 commit 运行 235 项 client、transport、task-store shape/parity 与 extension contract 测试,全部通过;正式升级继续由 升级 a2a-sdk 至 1.1.3 并审计下游兼容层 #515 跟踪。DatabaseTaskStoreCompat仍是 first-terminal-state-wins 原子写入所必需,上游暂无等价公开 API,因此保留。pyasn1>=0.6.4与click>=8.3.3安全下限仍有必要;本轮依赖审计未发现已知漏洞。验证
./scripts/doctor.sh./scripts/dependency_health.sh:无已知漏洞v1.1.3release commit 的定向兼容测试:235 项通过Closes #513
Relates to #515