Skip to content

.NET: Cover source-type-agnostic toolbox consent parsing (a2a_preview)#7229

Merged
rogerbarreto merged 1 commit into
microsoft:mainfrom
rogerbarreto:issue-7227-consent-type-source-fix
Jul 21, 2026
Merged

.NET: Cover source-type-agnostic toolbox consent parsing (a2a_preview)#7229
rogerbarreto merged 1 commit into
microsoft:mainfrom
rogerbarreto:issue-7227-consent-type-source-fix

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation & Context

Issue #7227 reports that the Python Foundry hosting consent parser only recognizes a
consent requirement when the toolbox source type is mcp. Work IQ identifies its
source as a2a_preview, so the Python parser returns None and the hosted agent never
surfaces the oauth_consent_request to the client.

The .NET Microsoft.Agents.AI.Foundry.Hosting package already avoids that trap: consent
detection keys off the JSON-RPC error semantics only, never the tool source type.
ToolboxConsentParser.TryParseConsentRequired walks the embedded errors[] array and
matches on the nested error.code == "CONSENT_REQUIRED", and the per-tool-call path in
ConsentAwareMcpClientAIFunction intercepts on JSON-RPC code -32006 alone. Both are
source-type agnostic, so the Work IQ a2a_preview scenario works on .NET today.

The existing unit tests all happened to use type: mcp, so nothing actually pinned the
source-agnostic guarantee. This PR adds coverage so the behavior cannot silently regress.

Description & Review Guide

What are the major changes?

What is the impact of these changes?

  • Test-only. No production code changes. Locks in the source-type-agnostic consent
    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

  • I have read the Contributing Guidelines and my code adheres to them
  • The code builds clean without any errors or warnings
  • I didn't break anyone. All existing tests pass
  • This is not a breaking change.

Copilot AI review requested due to automatic review settings July 20, 2026 21:05
@giles17 giles17 added the .NET Usage: [Issues, PRs], Target: .Net label Jul 20, 2026

@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.

Automated Code Review

Reviewers: 5 | Confidence: 95% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by rogerbarreto's agents

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.

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] covering type: "mcp", type: "a2a_preview", and an arbitrary future type.
  • Asserts ToolboxConsentParser.TryParseConsentRequired(...) returns a single consent entry with the expected toolbox name, tool/source name, and consent URL for all source types.

@rogerbarreto
rogerbarreto marked this pull request as ready for review July 20, 2026 21:15
@rogerbarreto rogerbarreto self-assigned this Jul 20, 2026

@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.

Automated Code Review

Reviewers: 5 | Confidence: 95% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by rogerbarreto's agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants