Repository navigation
refactor!: consolidate context-aware request handler contract - #553
Conversation
Replace the preview compatibility interface and adapter with a single IA2ARequestHandler contract. Forward request context explicitly through all transports and update implementations, tests, and migration guidance. BREAKING CHANGE: IA2ARequestHandler operations now require an A2ARequestContext? argument. IA2ARequestHandlerWithContext, WithRequestContext, and legacy A2AServer overloads have been removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74647e09-d2a4-46d0-ab81-17ad7dade7c5
There was a problem hiding this comment.
🟢 Approval recommended
The intentional contract migration is consistent across transports, callers, tests, and documentation, with no blocking issues identified.
0 open findings
What changed in this PR
Consolidates the SDK’s standard request handling into one context-aware IA2ARequestHandler contract, removing the preview compatibility layer.
Changes:
- Requires explicit request context across all 11 operations and three transports.
- Removes the opt-in interface, adapter, and legacy server overloads.
- Migrates callers, regression tests, and documentation while preserving null context for v0.3 compatibility.
| File | Description |
|---|---|
| tests/PushNotificationReceiver.Tests/PushNotificationIntegrationTests.cs | Migrates custom handler override. |
| tests/A2A.V0_3Compat.UnitTests/V03ServerProcessorTests.cs | Updates compatibility test handlers. |
| tests/A2A.UnitTests/Server/PushNotificationServerTests.cs | Updates push-operation calls. |
| tests/A2A.UnitTests/Server/PushAuthorizationBoundaryTests.cs | Migrates authorization test calls. |
| tests/A2A.UnitTests/Server/IndependentPushSemanticsTests.cs | Migrates push semantics tests. |
| tests/A2A.UnitTests/Server/A2AStandardRequestContextTests.cs | Tests explicit context propagation and isolation. |
| tests/A2A.UnitTests/Server/A2AServerTests.cs | Migrates server calls and cancellation arguments. |
| tests/A2A.UnitTests/GitHubIssues/Issue495.cs | Updates streaming regression call. |
| tests/A2A.UnitTests/GitHubIssues/Issue401.cs | Updates concurrency regression calls. |
| tests/A2A.Itk.UnitTests/ItkAgentTests.cs | Updates push configuration call. |
| tests/A2A.Grpc.UnitTests/GrpcExtensionHostingTests.cs | Adds context and cancellation assertions. |
| tests/A2A.Grpc.UnitTests/FakeRequestHandler.cs | Records explicit context and cancellation. |
| tests/A2A.AspNetCore.UnitTests/PushNotificationRegistrationTests.cs | Updates registered-handler call. |
| tests/A2A.AspNetCore.UnitTests/PushNotificationLifecycleTests.cs | Migrates lifecycle test calls. |
| tests/A2A.AspNetCore.UnitTests/A2AServiceCollectionExtensionsTests.cs | Updates extended-card call. |
| tests/A2A.AspNetCore.UnitTests/A2AJsonRpcProcessorTests.cs | Migrates JSON-RPC mocks. |
| tests/A2A.AspNetCore.UnitTests/A2AHttpProcessorTests.cs | Migrates HTTP processor mocks. |
| tests/A2A.AspNetCore.UnitTests/A2AExtensionHostingTests.cs | Verifies explicit snapshots and cancellation forwarding. |
| tests/A2A.AspNetCore.UnitTests/A2AExtensionAgentCardHostingTests.cs | Migrates extension-hosting mocks. |
| tests/A2A.AspNetCore.UnitTests/A2AEndpointRouteBuilderExtensionsTests.cs | Updates endpoint test mocks. |
| tests/A2A.AotTests/Program.cs | Migrates context propagation smoke checks. |
| src/A2A/Server/IA2ARequestHandlerWithContext.cs | Removes opt-in interface. |
| src/A2A/Server/IA2ARequestHandler.cs | Defines unified context-aware contract. |
| src/A2A/Server/A2AServer.cs | Implements contract without legacy overloads. |
| src/A2A/Server/A2ARequestHandlerExtensions.cs | Removes context-binding adapter. |
| src/A2A.V0_3Compat/V03ServerProcessor.cs | Passes explicit null context. |
| src/A2A.Grpc.AspNetCore/A2AGrpcService.cs | Forwards context directly through gRPC. |
| src/A2A.AspNetCore/A2AJsonRpcProcessor.cs | Forwards negotiated context through JSON-RPC. |
| src/A2A.AspNetCore/A2AHttpProcessor.cs | Accepts and forwards HTTP request context. |
| src/A2A.AspNetCore/A2AEndpointRouteBuilderExtensions.cs | Supplies context to HTTP processors. |
| itk/ActsServer.cs | Migrates extended-card override. |
| docs/migration-guide-v1.md | Documents breaking signatures and migration. |
| docs/extensions.md | Explains explicit context usage and lifetime. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks, Tracy — I understand the direction in #553. A single context-aware One boundary worth making explicit for custom delegating handlers: a proxy can receive a non-null negotiated context but still discard it by forwarding A short forwarding example, with a focused example/proxy regression test, could clarify that both the original Separately, I've opened #558 and #559 for the original items 2 and 6, with references to #23 and #548 so their context and scope remain clear. |
Updated [A2A](https://github.com/a2aproject/a2a-dotnet) from 1.0.0-preview2 to 1.0.0-preview4. <details> <summary>Release notes</summary> _Sourced from [A2A's releases](https://github.com/a2aproject/a2a-dotnet/releases)._ ## 1.0.0-preview4 ## What's Changed * fix: harden JSON-RPC requests and document blocking migration by @xu-shanshan in a2aproject/a2a-dotnet#546 * fix(http): ignore request tenant fields by @tracyboehrer in a2aproject/a2a-dotnet#539 * fix(itk): enable push notifications by @tracyboehrer in a2aproject/a2a-dotnet#549 * feat: add registry-backed extension negotiation by @MertBasar0 in a2aproject/a2a-dotnet#548 * fix: raise an error when a streaming call is not answered with an event stream by @Anuja-jayasinghe in a2aproject/a2a-dotnet#552 * chore: chore(deps):Bump xunit.runner.visualstudio from 4.0.0 to 4.0.1 by @dependabot[bot] in a2aproject/a2a-dotnet#561 * docs: explain extension negotiation error mappings by @MertBasar0 in a2aproject/a2a-dotnet#562 * feat: add registry-aware extension activation helpers by @MertBasar0 in a2aproject/a2a-dotnet#563 * refactor!: consolidate context-aware request handler contract by @tracyboehrer in a2aproject/a2a-dotnet#553 * fix: align Copilot setup with .NET 8 and 10 by @tracyboehrer in a2aproject/a2a-dotnet#557 * chore: Bump version to preview4 by @tracyboehrer in a2aproject/a2a-dotnet#565 * feat: add a conditional extension declaration helper by @MertBasar0 in a2aproject/a2a-dotnet#564 * feat: expose extension activation on custom operation context by @MertBasar0 in a2aproject/a2a-dotnet#567 * feat: add proactive task continuation and push-enabled sample by @tracyboehrer in a2aproject/a2a-dotnet#554 * chore(deps): Bump the opentelemetry group with 5 updates by @dependabot[bot] in a2aproject/a2a-dotnet#577 * chore(deps): Bump JsonSchema.Net from 9.4.0 to 9.4.1 by @dependabot[bot] in a2aproject/a2a-dotnet#578 * fix: translate v0.3 client exceptions at adapter boundary by @chopmob-cloud in a2aproject/a2a-dotnet#575 * chore(deps): Bump Microsoft.Extensions.AI.Abstractions from 10.10.1 to 10.11.0 by @dependabot[bot] in a2aproject/a2a-dotnet#579 * chore: Bump Microsoft.NET.Test.Sdk from 18.10.1 to 18.11.0 by @dependabot[bot] in a2aproject/a2a-dotnet#581 * chore(deps): Bump Microsoft.VisualStudio.Threading.Analyzers from 18.7.23 to 18.12.1 by @dependabot[bot] in a2aproject/a2a-dotnet#582 * docs: guide durable push notification sender implementations by @tracyboehrer in a2aproject/a2a-dotnet#571 * chore: chore(deps): Bump System.CommandLine from 2.0.12 to 2.0.13 by @dependabot[bot] in a2aproject/a2a-dotnet#583 * chore(deps): update shared .NET dependencies to 10.0.13 by @dependabot[bot] in a2aproject/a2a-dotnet#580 * test: synchronize cleanup cancellation with initial task admission by @tracyboehrer in a2aproject/a2a-dotnet#587 * chore: Bump the opentelemetry group with 5 updates by @dependabot[bot] in a2aproject/a2a-dotnet#589 * feat: auto-delete terminal push notification configs by @tracyboehrer in a2aproject/a2a-dotnet#588 * docs: guide secure persistent push notification stores by @tracyboehrer in a2aproject/a2a-dotnet#570 * ci: update ITK and ACTS to latest upstream by @tracyboehrer in a2aproject/a2a-dotnet#576 * ci: report ACTS advisory failures on pull requests by @tracyboehrer in a2aproject/a2a-dotnet#573 **Full Changelog**: a2aproject/a2a-dotnet@v1.0.0-preview3...v1.0.0-preview4 ## 1.0.0-preview3 ## What's Changed * fix: Return pre-stream errors as JSON-RPC responses by @tracyboehrer in a2aproject/a2a-dotnet#476 * chore: Bump System.Net.ServerSentEvents from 10.0.10 to 10.0.11 by @dependabot[bot] in a2aproject/a2a-dotnet#467 * chore: build(deps): bump actions/checkout from 4 to 7 by @dependabot[bot] in a2aproject/a2a-dotnet#481 * chore: build(deps): bump actions/setup-dotnet from 4 to 6 by @dependabot[bot] in a2aproject/a2a-dotnet#482 * chore: build(deps): bump actions/cache from 4 to 6 by @dependabot[bot] in a2aproject/a2a-dotnet#483 * chore: build(deps): bump docker/setup-buildx-action from 3 to 4 by @dependabot[bot] in a2aproject/a2a-dotnet#484 * fix: return REST pre-stream errors before SSE headers by @tracyboehrer in a2aproject/a2a-dotnet#486 * chore: build(deps): bump softprops/action-gh-release from 2 to 3 by @dependabot[bot] in a2aproject/a2a-dotnet#479 * chore: Bump System.Text.Json from 10.0.11 to 10.0.12 by @dependabot[bot] in a2aproject/a2a-dotnet#491 * chore: build(deps): Bump Microsoft.Extensions.Logging.Abstractions from 10.0.11 to 10.0.12 by @dependabot[bot] in a2aproject/a2a-dotnet#487 * chore: build(deps): Bump System.Net.ServerSentEvents from 10.0.11 to 10.0.12 by @dependabot[bot] in a2aproject/a2a-dotnet#490 * chore: build(deps): Bump System.CommandLine from 2.0.11 to 2.0.12 by @dependabot[bot] in a2aproject/a2a-dotnet#488 * chore: Bump System.Linq.AsyncEnumerable from 10.0.8 to 10.0.12 by @dependabot[bot] in a2aproject/a2a-dotnet#489 * chore: build(deps): bump docker/build-push-action from 6 to 7 by @dependabot[bot] in a2aproject/a2a-dotnet#480 * chore: build(deps): Bump Microsoft.SemanticKernel.Agents.Core from 1.79.0 to 1.80.1 by @dependabot[bot] in a2aproject/a2a-dotnet#477 * chore: Bump Roslynator.Analyzers from 4.16.1 to 5.0.0 by @dependabot[bot] in a2aproject/a2a-dotnet#470 * chore: build(deps): Bump Roslynator.CodeAnalysis.Analyzers from 4.16.1 to 5.0.0 by @dependabot[bot] in a2aproject/a2a-dotnet#471 * chore: build(deps): Bump xunit.runner.visualstudio from 3.1.5 to 4.0.0 by @dependabot[bot] in a2aproject/a2a-dotnet#468 * chore: build(deps): Bump Microsoft.VisualStudio.Threading.Analyzers from 17.14.15 to 18.7.23 by @dependabot[bot] in a2aproject/a2a-dotnet#430 * feat: Map JSON DataContent to Part.Data by @SergeyMenshykh in a2aproject/a2a-dotnet#448 * fix: flatten TaskPushNotificationConfig to match v1 spec by @darrelmiller in a2aproject/a2a-dotnet#418 * chore: build(deps): Bump Microsoft.NET.Test.Sdk from 18.9.0 to 18.10.0 by @dependabot[bot] in a2aproject/a2a-dotnet#494 * chore: Bump Microsoft.Extensions.AI.Abstractions from 10.9.0 to 10.10.0 by @dependabot[bot] in a2aproject/a2a-dotnet#493 * docs: Add docs about handling cookies and HttpClient by @cincuranet in a2aproject/a2a-dotnet#496 * chore: build(deps): Bump Polly from 8.7.0 to 8.8.0 by @dependabot[bot] in a2aproject/a2a-dotnet#497 * fix: enforce first-persisted terminal state under the task lock (#401) by @chopmob-cloud in a2aproject/a2a-dotnet#449 * fix: Return capability-aware extended card errors by @tracyboehrer in a2aproject/a2a-dotnet#475 * fix: Add AgentCard HTTP caching metadata by @tracyboehrer in a2aproject/a2a-dotnet#492 * chore: build(deps): Bump Microsoft.NET.Test.Sdk from 18.10.0 to 18.10.1 by @dependabot[bot] in a2aproject/a2a-dotnet#498 * fix: relax A2A.V0_3.AgentMessage kind/messageId requirements by @chopmob-cloud in a2aproject/a2a-dotnet#435 * chore: Bump the opentelemetry group with 5 updates by @dependabot[bot] in a2aproject/a2a-dotnet#501 * chore: build(deps): Bump Moq from 4.20.72 to 4.21.0 by @dependabot[bot] in a2aproject/a2a-dotnet#503 * fix(server): surface streaming persistence failures instead of ending the stream (#495) by @chopmob-cloud in a2aproject/a2a-dotnet#505 * feat: switch ITK to a2a-itk shared scenarios and onboard ACTS by @JakubWorek in a2aproject/a2a-dotnet#499 * chore: Bump coverlet.collector from 10.0.1 to 10.1.0 by @dependabot[bot] in a2aproject/a2a-dotnet#506 * chore: Bump Microsoft.Extensions.AI.Abstractions from 10.10.0 to 10.10.1 by @dependabot[bot] in a2aproject/a2a-dotnet#507 * feat: Add gRPC binding: client, ASP.NET Core server, and tests by @janosSarusiKis in a2aproject/a2a-dotnet#432 * fix: preserve HTTP JSON task responses and filters by @Anuja-jayasinghe in a2aproject/a2a-dotnet#509 * chore: build(deps): Bump Google.Protobuf from 3.35.1 to 3.36.2 by @dependabot[bot] in a2aproject/a2a-dotnet#517 * chore: build(deps): Bump Roslynator.CodeAnalysis.Analyzers from 5.0.0 to 5.0.1 by @dependabot[bot] in a2aproject/a2a-dotnet#522 * chore: build(deps): Bump Roslynator.Analyzers from 5.0.0 to 5.0.1 by @dependabot[bot] in a2aproject/a2a-dotnet#521 * ci: pin GitHub Actions to commit SHAs by @chopmob-cloud in a2aproject/a2a-dotnet#523 * chore: Bump Grpc.Tools from 2.80.0 to 2.84.0 by @dependabot[bot] in a2aproject/a2a-dotnet#520 * chore: Bump Grpc.Net.Client from 2.80.0 to 2.84.0 by @dependabot[bot] in a2aproject/a2a-dotnet#519 * fix: map capabilities.extensions in v0.3 compat agent card by @hwanders in a2aproject/a2a-dotnet#515 * chore: Bump Grpc.AspNetCore from 2.80.0 to 2.84.0 by @dependabot[bot] in a2aproject/a2a-dotnet#518 * fix: restrict task status filters to wire values by @Anuja-jayasinghe in a2aproject/a2a-dotnet#526 * ci: run every test project on net8.0 and net10.0 by @janosSarusiKis in a2aproject/a2a-dotnet#528 * fix: enforce ACTS conformance and make checks blocking by @tracyboehrer in a2aproject/a2a-dotnet#530 ... (truncated) Commits viewable in [compare view](a2aproject/a2a-dotnet@v1.0.0-preview2...v1.0.0-preview4). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eelco Los <5102501+EelcoLos@users.noreply.github.com>
Summary
Consolidate standard request handling into a single context-aware
IA2ARequestHandlercontract.A2AServerimplements this interface directly, and JSON-RPC, HTTP+JSON, and gRPC now pass request context explicitly. Update implementations, callers, tests, and migration documentation; v0.3 compatibility continues to pass a null context.Breaking-change rationale
IA2ARequestHandlerWithContextwas introduced as an additional, non-breaking interface so existingIA2ARequestHandlerimplementations would continue to compile. However, application developers typically implementIAgentHandlerand use the SDK'sA2AServer, which implementsIA2ARequestHandler; implementing the request-handler interface directly is an advanced customization scenario rather than the typical development path.While the SDK is still preview software, retaining two interfaces, legacy overloads, and a compatibility adapter for this less-common extension point creates an undesirable long-term maintenance burden. Taking the breaking change now gives the stable API one clear request-handler contract instead of carrying the preview compatibility layer indefinitely. Custom request-handler implementations remain supported, but must migrate to the new signatures.
Migration
IA2ARequestHandleroperations now require anA2ARequestContext?argument before the optional cancellation token. Passnullwhen no negotiation context exists.IA2ARequestHandlerWithContext, theWithRequestContextadapter, and legacyA2AServeroverloads.IAgentHandlerandIA2AClientare unchanged.Validation
tests\A2ATests.slnxsuite passes on .NET 8 and .NET 10.