.NET: Add per-tool AgentModeProvider controls - #8458
westey (westey-m) merged 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new overload makes existing positional default-literal calls ambiguous, creating an unintended source-breaking change.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds independent controls for AgentModeProvider tools while retaining mode state, guidance, and notifications.
Changes:
- Adds per-tool disable options and exposure-aware instructions.
- Adds notification suppression for external mode updates.
- Expands tests and public API baselines.
File summaries
| File | Description |
|---|---|
AgentModeProvider.cs |
Implements tool controls, guidance, and notification suppression. |
AgentModeProviderOptions.cs |
Adds tool-disable options. |
AgentModeProviderTests.cs |
Tests exposure combinations and notifications. |
PublicAPI/net10.0/PublicAPI.Unshipped.txt |
Records new net10.0 APIs. |
PublicAPI/net9.0/PublicAPI.Unshipped.txt |
Records new net9.0 APIs. |
PublicAPI/net8.0/PublicAPI.Unshipped.txt |
Records new net8.0 APIs. |
PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt |
Records new netstandard2.0 APIs. |
PublicAPI/net472/PublicAPI.Unshipped.txt |
Records new net472 APIs. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 6589bafa15b7
Model: gpt-5.6-sol-fast
Overview
The .NET implementation independently gates both built-in tools, updates only default guidance, and preserves mode state and notification behavior; the added tests cover all exposure combinations and stale-notification suppression. One source-compatibility gap remains: the new Boolean overload makes an existing positional default cancellation-token call ambiguous at compile time.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: dotnet/src/Microsoft.Agents.AI/Harness/AgentMode/AgentModeProvider.cs
Motivation & Context
Applications can retain
AgentModeProviderstate and workflow guidance while supplying their own mode-change UI or function tool, but the .NET provider currently always exposes bothmode_setandmode_get. This gives the model duplicate mode authorities when an application provides a replacement setter.This change allows each built-in mode tool to be disabled independently without disabling mode state, per-turn instructions, helper APIs, or external mode-change notifications. Replacement function tools can reuse
SetModeAsyncwhile suppressing redundant notifications already conveyed through the tool result.Description & Review Guide
DisableModeSetToolandDisableModeGetTooloptions, both defaulting tofalse; conditionally contribute each built-in tool; use internal templates so default guidance does not advertise disabled tools; add a backward-compatibleSetModeAsyncoverload with requireddisableNotification; clear stale pending notifications when suppression is requested; and add coverage for all exposure combinations, custom guidance, retained state, notifications, and API behavior.SetModeAsyncoverload preserves compatibility, and whether suppressed updates correctly clear stale pending notifications.Related Issue
Related to #7221. This is the .NET counterpart to #8450, which implemented the Python behavior and closed the original issue. No separate open .NET issue or duplicate PR was found.
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.