Repository navigation
.NET: Fix A2A message validation and sample server capabilities - #9465
SergeyMenshykh merged 2 commits into
Conversation
Reject outgoing requests with no sendable content and configure the policy sample server to enforce its advertised capabilities. Add agent and hosting regression coverage and document server options. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c843ad3-23aa-4c42-90bc-287885f09196
There was a problem hiding this comment.
🔵 Needs a closer look
No blocking technical findings remain, but the draft awaits confirmed maintainer agreement before approval.
0 open findings
What changed in this PR
Strengthens .NET A2A request validation and aligns the policy sample’s enforced capabilities with its published agent card.
Changes:
- Reject outgoing messages with no sendable parts while preserving continuation requests.
- Configure sample streaming and input-media restrictions from the agent card.
- Add regression tests and configuration documentation.
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AServerServiceCollectionExtensionsTests.cs | Tests capability enforcement and registration isolation. |
| dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/A2AEndpointRouteBuilderExtensionsTests.cs | Tests capability checks across both protocol bindings. |
| dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs | Tests message validation and continuation behavior. |
| dotnet/src/Microsoft.Agents.AI.Hosting.A2A/A2AServerRegistrationOptions.cs | Documents explicit capability configuration. |
| dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs | Rejects messages without sendable parts. |
| dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/README.md | Explains capability enforcement and defaults. |
| dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/Program.cs | Derives server options from the policy card. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c843ad3-23aa-4c42-90bc-287885f09196
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): fb4b9a0ae93f
Model: gpt-5.6-sol
Overview
The PR adds a shared post-conversion guard for ordinary and streaming A2A client sends while preserving continuation-only polling, and it configures the sample server from the capabilities published in its agent card. The added tests cover empty and unsupported client content, both server registration forms, both protocol bindings, registration-local defaults, and handler non-invocation for rejected requests. No PR-introduced Critical, High, or Medium defect remains after reconciling the four perspectives.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation & Context
A2AAgentcould pass messages with no sendable content to the A2A client instead of reporting invalid input locally. This can happen when messages are empty or their content cannot be converted to A2A.The policy server sample advertises restricted streaming and input capabilities, but publishing an agent card does not configure server enforcement. Its server settings need to match the published card.
Description
Related Issue
No matching issue identified. Maintainer agreement has not been confirmed; this PR is a draft.
AI Assistance
AI assistance details: Copilot assisted with implementation, tests, documentation, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.Targeted validation from
dotnet(the full repository test suite was not run):dotnet test --project tests\Microsoft.Agents.AI.A2A.UnitTests -f net10.0 --no-restore: passed, 163 tests.dotnet test --project tests\Microsoft.Agents.AI.Hosting.A2A.UnitTests -f net10.0 --no-restore: passed, 167 tests.dotnet build samples\05-end-to-end\A2AClientServer\A2AServer --no-restore --tl:off: passed, no warnings or errors.