.NET: Cover source-type-agnostic toolbox consent parsing (a2a_preview)#7229
Merged
rogerbarreto merged 1 commit intoJul 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds .NET unit-test coverage to lock in that Foundry toolbox OAuth-consent detection is source-type agnostic (i.e., it relies on the nested CONSENT_REQUIRED semantics, not errors[].type). This prevents a future regression that would miss consent requirements for non-mcp toolbox sources such as Work IQ’s a2a_preview (issue #7227).
Changes:
- Added an xUnit
[Theory]coveringtype: "mcp",type: "a2a_preview", and an arbitrary futuretype. - Asserts
ToolboxConsentParser.TryParseConsentRequired(...)returns a single consent entry with the expected toolbox name, tool/source name, and consent URL for all source types.
rogerbarreto
marked this pull request as ready for review
July 20, 2026 21:15
TaoChenOSU
approved these changes
Jul 20, 2026
peibekwe
approved these changes
Jul 20, 2026
westey-m
approved these changes
Jul 21, 2026
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Issue #7227 reports that the Python Foundry hosting consent parser only recognizes a
consent requirement when the toolbox source
typeismcp. Work IQ identifies itssource as
a2a_preview, so the Python parser returnsNoneand the hosted agent neversurfaces the
oauth_consent_requestto the client.The .NET
Microsoft.Agents.AI.Foundry.Hostingpackage already avoids that trap: consentdetection keys off the JSON-RPC error semantics only, never the tool source
type.ToolboxConsentParser.TryParseConsentRequiredwalks the embeddederrors[]array andmatches on the nested
error.code == "CONSENT_REQUIRED", and the per-tool-call path inConsentAwareMcpClientAIFunctionintercepts on JSON-RPC code-32006alone. Both aresource-type agnostic, so the Work IQ
a2a_previewscenario works on .NET today.The existing unit tests all happened to use
type: mcp, so nothing actually pinned thesource-agnostic guarantee. This PR adds coverage so the behavior cannot silently regress.
Description & Review Guide
What are the major changes?
[Theory]toToolboxConsentParserTeststhat asserts consent is surfaced formcp,a2a_preview(the Work IQ case from .NET: Python: [Bug]: ResponsesHostServer does not surface Work IQ CONSENT_REQUIRED from a2a_preview source #7227), and an arbitrary future source type.What is the impact of these changes?
parsing that already exists in .NET so a future edit cannot reintroduce a
type == "mcp"restriction like the one Python hit.
What do you want reviewers to focus on?
Related Issue
Contributes to #7227 (the .NET side; the Python parser fix is tracked separately in the
same issue).
Contribution Checklist