Skip to content

fix(client): preserve rich gRPC error metadata - #1503

Open
Harshil-1603 wants to merge 1 commit into
a2aproject:mainfrom
Harshil-1603:fix/grpc-error-metadata
Open

Harshil-1603 wants to merge 1 commit into
a2aproject:mainfrom
Harshil-1603:fix/grpc-error-metadata

Conversation

@Harshil-1603

Copy link
Copy Markdown
Contributor

Problem

The v1 gRPC client maps an A2A google.rpc.ErrorInfo reason to the correct exception, but discards its metadata. For example, a peer returning TaskNotFoundError with metadata={"taskId": "job-1"} produces an exception with data=None, losing the supplied context.

Change

Preserve metadata from the a2a-protocol.org error domain in A2AError.data. Keep structured BadRequest field violations when metadata contains an errors key, regardless of detail order. Foreign-domain metadata remains excluded, and empty metadata still produces data=None.

Add 16 regression cases using a local gRPC server and the public client transport, covering unary and streaming calls, detail order, field violations, foreign domains, and empty metadata. Before the fix, 12 cases failed and the four empty-metadata controls passed.

Validation

  • Required lint/format/type script passed (four existing redundant-ignore warnings).
  • Focused gRPC tests: 46 passed.
  • Full suite: 2,679 passed, 215 skipped, 4 xfailed, 1 xpassed.
  • Coverage: 94%; coverage run also passed all 2,679 tests.
  • git diff --check passed.

The skipped database profiles require external PostgreSQL/MySQL DSNs. Hosted CI and maintainer review are pending.

@Harshil-1603
Harshil-1603 requested a review from a team as a code owner November 19, 2026 13:43
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/grpc.py 92.75% 93.75% 🟢 +1.00%
Total 93.81% 93.82% 🟢 +0.01%

Generated by coverage-comment.yml

@Iwaniukooo11 Iwaniukooo11 self-assigned this Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants