[Bug]: Client transports reject responses with unrecognized fields (spec 5.7)
Mantenedores costumam responder em até 2 dias
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 2.2k
- Forks
- 518
- Merge médio
- 3d 12h
- PRs com merge (30d)
- 39
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de a2aproject/a2a-python
-
[Bug]: `A2A-Version` validation ignores minor versions and the query parameterTalvez já em andamento @rohityan assumiu há 61 dias. Abertacomponent: server status:awaiting response
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
a2aproject/a2a-python#1204 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
[Bug]: REST task/request id sanitizationTalvez já em andamento @Linux2010 assumiu há 119 dias. Abertamaintainers-only
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
a2aproject/a2a-python#805 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
[Bug]: TaskEventStream methods don't receive ServerCallContextTalvez já em andamento @rohityan assumiu há 2 dias. Aberta
a2aproject/a2a-python#1374 · 2 responsáveis ·
Mantenedores costumam responder em até 2 dias
-
[Bug]: v0.3 JSON-RPC compat adapter returns -32603 for all A2A errors (e.g. TaskNotFound should be -32001)Talvez já em andamento @shwetangsinha0509 assumiu há 3 dias. Abertacomponent: server status:awaiting response
a2aproject/a2a-python#1368 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
[Bug]: VersionedDatabaseTaskStore get() and delete() fail with "no such table" when initialize() was not calledTalvez já em andamento @cchinchilla-dev assumiu há 4 dias. Abertacomponent: server status:awaiting response
a2aproject/a2a-python#1356 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 2 dias
Todas as issues de a2aproject/a2a-python
Issues semelhantes
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog checkTalvez já em andamento @ocelotl assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
open-telemetry/opentelemetry-python#5825 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
cuga-project/cuga-agent#1020 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 70/100
microsoft/playwright#43640 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia