feat: ServerCallContext ports from Python implementation#285
feat: ServerCallContext ports from Python implementation#285fjuma merged 2 commits intoa2aproject:mainfrom
Conversation
Summary of ChangesHello @kabir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive server-side extension support and enriches the gRPC Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully ports server-side extension support from the Python implementation, introducing a gRPC interceptor to enrich the ServerCallContext with metadata, peer information, and method details, thereby achieving feature parity with Python's ServicerContext. The changes are well-implemented across the gRPC, JSON-RPC, and REST transports, including necessary modifications to ServerCallContext and the addition of comprehensive unit tests. My review includes one suggestion to refactor duplicated code in GrpcHandler for improved maintainability.
transport/grpc/src/main/java/io/a2a/transport/grpc/handler/GrpcHandler.java
Show resolved
Hide resolved
client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcTransport.java
Outdated
Show resolved
Hide resolved
| * HTTP header name for A2A extensions. | ||
| * @deprecated Use {@link A2AHeaders#X_A2A_EXTENSIONS} instead | ||
| */ | ||
| @Deprecated |
There was a problem hiding this comment.
This annotation can be removed right?
server-common/src/main/java/io/a2a/server/extensions/A2AExtensions.java
Outdated
Show resolved
Hide resolved
transport/grpc/src/main/java/io/a2a/transport/grpc/handler/GrpcHandler.java
Outdated
Show resolved
Hide resolved
0c0dc02 to
6a4148b
Compare
|
Thanks @fjuma. I've rebased and addressed the comments |
reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java
Outdated
Show resolved
Hide resolved
reference/rest/src/main/java/io/a2a/server/rest/quarkus/A2AServerRoutes.java
Outdated
Show resolved
Hide resolved
| metadata.put(extensionsKey, extensionsHeader); | ||
| } | ||
|
|
||
| // Add other headers as needed in the future |
There was a problem hiding this comment.
Was just thinking some more about this and realized that I can probably modify #292 to add the authorization/api-key headers for gRPC in a similar way.
Currently, we are relying on the user configuring a gRPC ClientInterceptor to specify the token/API key. Instead, I think I can update GrpcTransport to make use of the ClientCallInterceptors so that the AuthInterceptor could be used for gRPC like we use it for the other transports to add the appropriate header. And then, I can update this method to add the appropriate header to the gRPC metadata if present.
Port server-side extension support and implement complete gRPC context access equivalent to Python's ServicerContext. Adds client/server metadata support, rich context information, and interceptor infrastructure while maintaining backward compatibility.
6a4148b to
13399a1
Compare
Port server-side extension support and implement complete gRPC context access equivalent to Python's ServicerContext. Adds client/server metadata support, rich context information, and interceptor infrastructure while maintaining backward compatibility.