feat: Add A2A.V0_3Compat server-side compat (v0.3 client → v1 server)#338
Conversation
…0.3 detection - Add V03ServerProcessor: handles v0.3 JSON-RPC wire format (method names, param types, enum values) and translates to/from v1.0 before calling the IA2ARequestHandler. Supports both non-streaming and SSE streaming paths. - Add V03ServerCompatEndpointExtensions.MapA2AWithV03Compat: drop-in replacement for MapA2A that accepts v0.3 client requests on a v1.0 server. - Add V03JsonRpcResponseResult and V03JsonRpcStreamedResult: IResult implementations that serialize responses in v0.3 wire format. - Extend V03TypeConverter with server-side conversion methods: v0.3 request params → v1.0 request types, and v1.0 responses → v0.3. - Add A2AClientFactory.Create(string agentCardJson, Uri baseUrl, ...): detects protocol version from raw JSON and routes to v1 client or fallback. - Add A2AClientFactory.RegisterFallback/ClearFallback for global v0.3 client factory registration; add per-call FallbackFactory on A2AClientOptions. - Restore agent-preference ordering in A2AClientFactory.Create(AgentCard, ...) (agent's declared interface order wins per spec §8.3). - Add A2A.V0_3Compat.UnitTests covering factory detection and type conversion. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary of ChangesHello, 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 a new compatibility layer ( 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a compatibility layer to enable A2A v0.3 clients to interact with v1.0 servers and vice-versa. Key changes include a new A2A.V0_3Compat project with a V03ClientAdapter for client-side protocol translation, and V03ServerProcessor and V03ServerCompatEndpointExtensions for server-side handling of mixed v0.3/v1.0 requests. The A2AClientFactory has been extended to automatically detect protocol versions from agent cards and use a configurable fallback mechanism for v0.3. A critical issue was identified in the V03ServerProcessor where, despite documentation, it currently only processes v0.3 methods, causing v1.0 requests to fail with a 'Method not found' error. This requires either implementing v1.0 request handling or updating the documentation to reflect v0.3-only support.
| /// Processes an A2A JSON-RPC request, handling both v0.3 and v1.0 wire formats. | ||
| /// v0.3 requests are translated to v1.0, processed, and responses are translated back to v0.3. | ||
| /// v1.0 requests are passed through to the handler unchanged. |
There was a problem hiding this comment.
The documentation for this class and for the MapA2AWithV03Compat extension method states that the endpoint handles both v0.3 and v1.0 requests, with v1.0 requests being "passed through to the handler unchanged". However, the current implementation in ProcessRequestAsync and its helpers (HandleSingleAsync, HandleStreaming) only recognizes and processes v0.3 methods.
Any v1.0 request sent to an endpoint using this processor will fail with a "Method not found" error because the v1.0 method names (e.g., SendMessage) will not match any of the case statements, which are looking for v0.3 method names (e.g., message/send).
This is a critical issue as it contradicts the documented functionality and will break v1.0 clients.
To resolve this, the processor needs to be updated to correctly detect and handle v1.0 requests. Alternatively, if this processor is only intended for v0.3, the documentation in both V03ServerProcessor and V03ServerCompatEndpointExtensions must be updated to remove the claim of v1.0 support.
Summary
A2A.V0_3Compat— server-side compat layer so a v0.3 client (work-iq-cli) can call a v1.0 server (Sydney) without any changes on the client side.MapA2AWithV03Compatendpoint extension — drop-in replacement forMapA2A; accepts v0.3 JSON-RPC wire format, translates to v1.0, callsIA2ARequestHandler, translates responses back to v0.3.A2AClientFactoryenhancements —Create(string agentCardJson, Uri baseUrl, ...)detects protocol version from raw JSON;RegisterFallback/ClearFallbackfor global v0.3 client factory; per-callFallbackFactoryonA2AClientOptions.A2AClientFactory.Create(AgentCard, ...)— spec §8.3 requires agent's declared interface order to win; previous version iterated client preferences instead.What it translates
message/send,tasks/get, etc.SendMessage,GetTask, etc."working")"TASK_STATE_WORKING")kinddiscriminatorJsonRpcResponsewrapperStreamResponseTest plan
A2A.V0_3Compat.UnitTestspass (factory detection, type conversion round-trips)MapA2AWithV03Compatand send v0.3 request fromwork-iq-clito verify end-to-endCloses #331
🤖 Generated with Claude Code