Skip to content

feat: Enriched Error Model#427

Merged
bartek-gralewicz merged 13 commits into
epic/1.0_breaking_changesfrom
bgralewicz/enrich_error_model
Apr 30, 2026
Merged

feat: Enriched Error Model#427
bartek-gralewicz merged 13 commits into
epic/1.0_breaking_changesfrom
bgralewicz/enrich_error_model

Conversation

@bartek-gralewicz
Copy link
Copy Markdown
Contributor

@bartek-gralewicz bartek-gralewicz commented Apr 27, 2026

Description

Update error handling to the new enriched model. These changes are compliant with https://a2a-protocol.org/latest/specification/#332-error-handling and https://a2a-protocol.org/latest/specification/#116-error-handling.

Bug fix

Error code for TaskNotCancelableError was previously set to 409 when it should be 400. This PR fixes this issue.

Notes

There are a few new proto-generated files which are auto-generated based on updated bug.gen.yaml and were not modified manually. Each one starts with a note // Code generated by protoc-gen-ts_proto. DO NOT EDIT..

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/client/transports/grpc/grpc_transport.ts 91.28% 93.45% 🟢 +2.17%
src/client/transports/json_rpc_transport.ts 59.07% 69.1% 🟢 +10.03%
src/client/transports/rest_transport.ts 85.33% 91.44% 🟢 +6.11%
src/errors.ts 100% 98.21% 🔴 -1.79%
src/server/express/rest_handler.ts 85.5% 84.58% 🔴 -0.92%
src/server/grpc/grpc_service.ts 75.4% 81.12% 🟢 +5.72%
src/server/request_handler/default_request_handler.ts 80.78% 81.09% 🟢 +0.31%
src/server/transports/jsonrpc/jsonrpc_transport_handler.ts 76.22% 80% 🟢 +3.78%
src/server/transports/rest/rest_transport_handler.ts 98.91% 98.98% 🟢 +0.07%
src/server/grpc/error_details.ts (new) 100%
Total 85.51% 87.69% 🟢 +2.18%

Generated by coverage-comment.yml

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements an enriched error model across all transport protocols (gRPC, REST, and JSON-RPC) based on the google.rpc.ErrorInfo structure. It introduces standardized error reason codes, domains, and metadata, allowing clients to precisely identify A2A error types. Key changes include the addition of protobuf-generated error detail types, updated error mapping logic in both client and server transports, and enhanced test coverage for the new error formats. Feedback was provided regarding a redundant check in the gRPC error mapping logic that can be simplified.

Comment thread src/client/transports/grpc/grpc_transport.ts Outdated
@bartek-gralewicz
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements an enriched error model across gRPC, REST, and JSON-RPC transports by introducing structured error details via google.rpc.ErrorInfo. Key changes include centralized error mapping in src/errors.ts, updated transport handlers, and the addition of generated protobuf types. Feedback focuses on restoring method-level context in gRPC error messages for better debugging, eliminating redundant buffer allocations in metadata construction, and resolving ambiguity in REST error inference when multiple errors map to the same HTTP status code.

Comment thread src/client/transports/grpc/grpc_transport.ts Outdated
Comment thread src/client/transports/grpc/grpc_transport.ts Outdated
Comment thread src/client/transports/grpc/grpc_transport.ts Outdated
Comment thread src/server/grpc/error_details.ts Outdated
Comment thread src/client/transports/rest_transport.ts Outdated
@bartek-gralewicz bartek-gralewicz marked this pull request as ready for review April 27, 2026 11:22
@bartek-gralewicz bartek-gralewicz requested a review from a team as a code owner April 27, 2026 11:22
Comment thread src/client/transports/rest_transport.ts Outdated
Comment thread test/client/transports/grpc_transport.spec.ts
Comment thread src/client/transports/rest_transport.ts Outdated
Comment thread test/client/transports/grpc_transport.spec.ts
@bartek-gralewicz bartek-gralewicz merged commit c130778 into epic/1.0_breaking_changes Apr 30, 2026
9 checks passed
@bartek-gralewicz bartek-gralewicz deleted the bgralewicz/enrich_error_model branch April 30, 2026 10:06
ishymko added a commit that referenced this pull request May 11, 2026
🤖 I have created a release *beep* *boop*
---

## 1.0.0-alpha.0 (2026-05-11)

See the [v0.3 -> v1.0-alpha.0 migration
guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0-alpha.0/docs/migration-guide.md).

**Note**: Enabling backward compatibility with v0.3 is tracked in
[#452](#452).


### ⚠ BREAKING CHANGES

* Drop support for node 18
([#368](#368))
* Make ServerCallContext parameter mandatory across all places
([#405](#405))
* Remove JSON-RPC client
([#353](#353))
* Remove transport-specific exports
([#404](#404))
* Update codebase to use A2A 1.0.0 data model
([#375](#375))
* Remove A2AExpressApp
([#363](#363))

### Features

* Add A2A Version Header
([#422](#422))
([b5f3db7](b5f3db7))
* Add cache-headers logic to the agent card handler
([#435](#435))
([955b52b](955b52b))
* Add resource scoping
([#450](#450))
([c527086](c527086))
* Add support for custom authentication scheme and credentials in
auth-headers ([#430](#430))
([5a4389b](5a4389b))
* AgentCardSignature support
([#448](#448))
([4a41a8c](4a41a8c))
* Enforce events ordering
([#437](#437))
([157cf48](157cf48))
* Enriched Error Model
([#427](#427))
([c130778](c130778))
* Implement listTasks method
([#383](#383))
([7d4c472](7d4c472))
* Send current task as the first event after subscribing to it
([#418](#418))
([4bfcf5f](4bfcf5f))
* Support multi-tenancy
([#419](#419))
([1877877](1877877))

### Code Refactoring

* remove A2AExpressApp
([#363](#363))
([0b84728](0b84728))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: bartek-gralewicz <bgralewicz@google.com>
Co-authored-by: Ivan Shymko <ishymko@google.com>
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