Skip to content

fix(grpc): align unsupported operation status - #1059

Open
dangzitou wants to merge 2 commits into
a2aproject:mainfrom
dangzitou:agent/fix-unsupported-operation-grpc-status
Open

fix(grpc): align unsupported operation status#1059
dangzitou wants to merge 2 commits into
a2aproject:mainfrom
dangzitou:agent/fix-unsupported-operation-grpc-status

Conversation

@dangzitou

Copy link
Copy Markdown

Description

Align UnsupportedOperationError with the A2A gRPC specification by mapping it to FAILED_PRECONDITION instead of UNIMPLEMENTED. Update the existing server and client mapping assertions, plus the handler mapping documentation.

  • Follow the CONTRIBUTING Guide.
  • Use a Conventional Commits PR title.
  • Ensure the affected tests pass.
  • Appropriate documentation was updated.

Reproduction

On current main, changing only the eight existing GrpcHandlerTest expectations for paths that emit UnsupportedOperationError produced 8 consistent failures out of 42 tests:

expected: <FAILED_PRECONDITION> but was: <UNIMPLEMENTED>

Verification

Run with OpenJDK 17:

mvn -DskipTests install -pl transport/grpc,client/transport/grpc -am
mvn -pl transport/grpc test
mvn -pl client/transport/grpc test

Results:

  • transport/grpc: 42 tests passed
  • client/transport/grpc: 9 tests passed
  • all 12 prerequisite/affected reactor modules compiled and installed successfully

A root mvn clean install was also attempted, but the unrelated client/transport/jsonrpc tests could not bind/use their hard-coded local endpoint because 127.0.0.1:4001 was already occupied by another local application. The two changed gRPC modules were fully tested separately above.

This fixes #1051

@dangzitou
dangzitou marked this pull request as ready for review August 12, 2026 19:54
@dangzitou
dangzitou force-pushed the agent/fix-unsupported-operation-grpc-status branch from 5353b19 to d87ca59 Compare August 13, 2026 15:08

@kabir kabir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @dangzitou - thank you for the PR!

One small issue:
The fallback switch in GrpcErrorMapper.java (line 77) still maps UNIMPLEMENTED to UnsupportedOperationError. Since the server now sends FAILED_PRECONDITION for this error, this fallback won't match when ErrorInfo details are absent. Consider adding a
FAILED_PRECONDITION case alongside the existing UNIMPLEMENTED one (since UNIMPLEMENTED is still used by other error types like PushNotificationNotSupportedError).

The primary ErrorInfo-based path (lines 62-70) handles this correctly via the reason field, so this only affects the fallback.

https://github.com/a2aproject/a2a-java/blob/2fc099dfbd19b0b82edfb6811eefaee3bff10ebe/client/transport/grpc/src/main/java/org/a2aproject/sdk/client/transport/grpc/GrpcErrorMapper.java#L73-L84

@dangzitou
dangzitou force-pushed the agent/fix-unsupported-operation-grpc-status branch from 4b28625 to 2d1a7cb Compare August 16, 2026 17:27
@dangzitou

Copy link
Copy Markdown
Author

Addressed the requested fallback mapping in 2d1a7cb: FAILED_PRECONDITION now maps to UnsupportedOperationError alongside UNIMPLEMENTED, with a no-ErrorInfo regression test. Rebased onto current main; local GrpcErrorMapperTest passes.

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.

fix: UnsupportedOperationError gRPC status should be FAILED_PRECONDITION per spec

2 participants