[Bug]: Client transports reject responses with unrecognized fields (spec 5.7)
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
What happened?
The 1.0 client transports reject any response that carries a field they don't know. A SendMessage result with one extra key fails with ParseError and the caller gets no answer, even though the message in it is valid.
Spec 5.7 says: "Implementations SHOULD ignore unrecognized fields in messages, allowing for forward compatibility as the protocol evolves."
#1273 applied this to the server (jsonrpc_dispatcher.py, rest_dispatcher.py). The client side is still strict:
client/transports/jsonrpc.py: everyjson_format.ParseDict(json_rpc_response.result, ...)(send_message,get_task,list_tasks,cancel_task, the push-notification config methods,get_extended_agent_card) and the streamingParseDict(..., StreamResponse()).client/transports/rest.py: the same set ofParseDict(response_data, ...)calls.
The rest of the client is already lenient: client/card_resolver.py (parse_agent_card) and the v0.3 compat transport (compat/v0_3/rest_transport.py) both pass ignore_unknown_fields=True. So a client talking to a 1.0 agent is stricter than the same client talking to a 0.3 agent.
Expected: unknown fields in a response are ignored and the valid payload is returned, as on the server since #1273.
Why it matters: a server one minor version ahead (or one that adds a vendor field) breaks every client on an older SDK. Gateways built on this client inherit it: LiteLLM's A2A proxy calls client.send_message, so an agent whose SendMessage result has an extra key cannot be called through LiteLLM at all. We hit exactly this with a third-party agent that returns {"message": {...}, "status": "COMPLETED"}.
Reproduction (a2a-sdk 1.2.2, also present on main; no network needed):
import asyncio
import json
import uuid
import httpx
from a2a.client import ClientConfig, ClientFactory
from a2a.client.card_resolver import parse_agent_card
from a2a.types import a2a_pb2
CARD = {
"name": "demo",
"description": "demo",
"version": "1.0.0",
"capabilities": {},
"defaultInputModes": ["text/plain"],
"defaultOutputModes": ["text/plain"],
"skills": [{"id": "s", "name": "s", "description": "s", "tags": []}],
"supportedInterfaces": [
{"url": "https://agent.example", "protocolBinding": "JSONRPC", "protocolVersion": "1.0"}
],
}
def agent(request: httpx.Request) -> httpx.Response:
return httpx.Response(200, json={
"jsonrpc": "2.0",
"id": json.loads(request.content)["id"],
"result": {
"message": {"messageId": "r1", "role": "ROLE_AGENT", "parts": [{"text": "hello"}]},
# A field this SDK version does not know (e.g. added by a newer spec minor version).
"someNewField": "x",
},
})
async def main() -> None:
async with httpx.AsyncClient(transport=httpx.MockTransport(agent)) as http:
client = ClientFactory(ClientConfig(httpx_client=http, streaming=False)).create(parse_agent_card(CARD))
request = a2a_pb2.SendMessageRequest(message=a2a_pb2.Message(
role=a2a_pb2.Role.ROLE_USER, message_id=uuid.uuid4().hex, parts=[a2a_pb2.Part(text="hi")]))
async for event in client.send_message(request):
print(event)
asyncio.run(main())
Removing someNewField makes it print the message.
Suggested fix: pass ignore_unknown_fields=True at the response-parsing call sites in client/transports/jsonrpc.py and client/transports/rest.py, mirroring #1273. The enum caveat discussed there (an unknown enum value becomes 0) applies here too.
Relevant log output
google.protobuf.json_format.ParseError: Message type "lf.a2a.v1.SendMessageResponse" has no field named "someNewField" at "SendMessageResponse".
Available Fields(except extensions): "['task', 'message']"
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 511
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của a2aproject/a2a-python
-
[Bug]: REST task/request id sanitizationCó thể đã có người làm @Linux2010 đã nhận 110 ngày trước. Đang mởmaintainers-only
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
a2aproject/a2a-python#805 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
DefaultRequestHandler (v2) ignores queue_manager, so the per-task event queue bound (1,024) cannot be configuredCó thể đã có người làm @ishymko đã nhận 1 ngày trước. Đang mởcomponent: server status: needs review
a2aproject/a2a-python#1339 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Agent card signature verification raises raw binascii.Error on a malformed protected header instead of SignatureVerificationErrorCó thể đã có người làm @rohityan đã nhận 7 ngày trước. Đang mởcomponent: core status:awaiting response
a2aproject/a2a-python#1332 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Framework-written FAILED status drops status.timestamp, persisting last_updated as NULLCó thể đã có người làm @Linux2010 đã nhận 1 ngày trước. Đang mởcomponent: server status:awaiting response
a2aproject/a2a-python#1331 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: message/send hangs forever when the AgentExecutor returns without producing eventsCó thể đã có người làm @Linux2010 đã nhận 2 ngày trước. Đang mởcomponent: server status:awaiting response
a2aproject/a2a-python#1330 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của a2aproject/a2a-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine-us#10262 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kellyjonbrazil/jc#788 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`/search.json` ignores the documented `editions.sort` parameterCó thể đã có người làm @PranavD2905 đã nhận hôm nay. Đang mởAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
internetarchive/openlibrary#13989 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P2: misleading query
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jeffknupp/association#478 ·