feat: Add A2A.V0_3Compat server-side compat (v0.3 client → v1 server)#338
feat: Add A2A.V0_3Compat server-side compat (v0.3 client → v1 server)#338xu-shanshan wants to merge 6 commits intoa2aproject:mainfrom
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 <noreply@anthropic.com>
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.
…zation V03.JsonRpcRequestConverter rejects v1.0 method names (e.g. SendMessage, GetTask, SendStreamingMessage) with MethodNotFound during deserialization, making the default passthrough case in HandleSingleAsync unreachable. Fix: parse the request body once via JsonDocument to peek at the method field, then route to a new HandleV1RequestAsync path if the method is not a recognized v0.3 name. HandleV1RequestAsync bypasses the V03 deserializer entirely and delegates directly to A2AJsonRpcProcessor. Also: - Promote A2AJsonRpcProcessor.SingleResponseAsync and StreamResponse to public so V03ServerProcessor can call them - Add MapAgentCardGetWithV03Compat extension: serves AgentCard in v0.3 or v1.0 format based on A2A-Version header negotiation - Add V03TypeConverter.ToV03AgentCard for v1.0→v0.3 AgentCard conversion - Bump version to 1.0.0-preview3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sor.CheckPreflight Extract version header validation from A2AJsonRpcProcessor.ProcessRequestAsync into a new public static CheckPreflight method. V03ServerProcessor now calls CheckPreflight instead of duplicating the logic, making it a true extension of the v1.0 processor rather than a parallel implementation. Any future protocol-level checks added to CheckPreflight automatically apply to both the v1.0 and v0.3 compat paths. Bump version to 1.0.0-preview4. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eckPreflight delegation Tests for commit 49d5f02 (v1.0 method bypass) and 06c0417 (CheckPreflight delegation): - v1.0 method names (SendMessage, GetTask) route via HandleV1RequestAsync, bypass V03 deserializer - unsupported A2A-Version header returns -32009 before body is parsed - v0.3 method names (message/send, tasks/get, tasks/cancel) translate and return v0.3 wire format - v0.3 response uses lowercase state, not TASK_STATE_* - malformed JSON and missing method field return parse error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A2A.V0_3Compat and A2A.V0_3Compat.UnitTests were missing from A2A.slnx, so dotnet test run by CI skipped all 41 compat unit tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CI failure note (commit The This is a pre-existing flaky timing test — Fix in latest commit (
A maintainer re-approval of CI workflows is needed to trigger a new run. |
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, V03ServerProcessor routing)V03ServerProcessor— covers v1.0 method bypass (commit49d5f02),CheckPreflightdelegation (commit06c0417), and all error casesMapA2AWithV03Compatand send v0.3 request fromwork-iq-clito verify end-to-endCloses #331
🤖 Generated with Claude Code