Visitar URL original
.NET: Fix A2A message validation and sample server capabilities by SergeyMenshykh · Pull Request #9465 · microsoft/agent-framework · GitHub
Skip to content

.NET: Fix A2A message validation and sample server capabilities - #9465

Merged
SergeyMenshykh merged 2 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-a2a-compatibility-review
Oct 16, 2026
Merged

SergeyMenshykh merged 2 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-a2a-compatibility-review

Conversation

@SergeyMenshykh

@SergeyMenshykh SergeyMenshykh commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation & Context

A2AAgent could 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

  • Reject outgoing messages with no sendable content in ordinary and streaming calls.
  • Preserve continuation-only polling and reconnection requests.
  • Configure the policy server's streaming setting and accepted input modes from its agent card.
  • Add regression coverage for both A2A bindings and update related documentation.

Related Issue

No matching issue identified. Maintainer agreement has not been confirmed; this PR is a draft.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Copilot assisted with implementation, tests, documentation, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (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.

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 <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c843ad3-23aa-4c42-90bc-287885f09196
Copilot AI balanced review requested due to automatic review settings October 16, 2026 19:03
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 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 <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2c843ad3-23aa-4c42-90bc-287885f09196

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Oct 16, 2026
Merged via the queue into microsoft:main with commit 44fe223 Oct 16, 2026
33 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-a2a-compatibility-review branch October 16, 2026 19:43
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework Oct 16, 2026

This branch was previously deployed

1 inactive deployment
github-app-auth — b971ac72 Deployed Oct 16, 2026 by SergeyMenshykh via add_label #25638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants