Skip to content

[dotnet-port-api] Add per-tool agent mode controls #1097

Closed

Description

@github-actions

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Summary

Align agent/harness/agentmode with the .NET per-tool AgentModeProvider controls from microsoft/agent-framework#8458. This adds DisableModeSetTool and DisableModeGetTool config flags, keeps the default injected instructions coherent when either built-in tool is disabled, adds SetModeForSessionSilently for custom mode-switch flows that should not queue a follow-up notification, and extends the parity doc and package tests to cover the new behavior.

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • go test ./agent/harness/agentmode
  • go test ./agent/harness/...
  • Added targeted coverage for per-tool disable combinations, default-instruction rewrites, and silent mode changes that clear pending notifications.
  • No example changes.

Notes

  • The local upstream-agent-framework/main fetch was blocked by the firewall in this environment, so upstream inspection used the GitHub read bridge against the merged .NET PR and commit instead of a refreshed local remote-tracking ref.
  • Exact duplicate searches for [dotnet-port-api] plus the mode_set/mode_get AgentMode surface returned no matching workflow tracking issue before this port.

Note

GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893 and are ready to review.

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (41 of 484 lines)
From 11b680cfda8c6a32a6c2c89b74f85ab946ef9bdd Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 15e68364d23450bb00f1c846218038b2c1152ada
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 18 Sep 2026 05:35:06 +0000
Subject: [PATCH] [dotnet-port-api] Add per-tool agent mode controls

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/agentmode/agentmode.go      | 148 ++++++++++++-----
 agent/harness/agentmode/agentmode_test.go | 193 ++++++++++++++++++++++
 docs/dotnet-go-sdk-feature-comparison.md  |   2 +-
 3 files changed, 301 insertions(+), 42 deletions(-)

diff --git a/agent/harness/agentmode/agentmode.go b/agent/harness/agentmode/agentmode.go
index 32e1f69..c107779 100644
--- a/agent/harness/agentmode/agentmode.go
+++ b/agent/harness/agentmode/agentmode.go
@@ -25,14 +25,17 @@ import (
 
 const stateKey = "agentModeState"
 
+const modeGetInstructions = "Use the mode_get tool to check your current operating mode.\n"
+
+const modeSetInstructions = "Use the mode_set tool to switch between modes as your work progresses. Only use mode_set if the user explicitly instructs/allows you to change modes.\n\n"
+
+const planModeTransition = "7. When approval is granted, always switch to execute mode (using the `mode_set` tool), and follow the steps for *Execute mode*."
+
 const defaultInstructions = `## Agent Mode
 
 - You can operate in different modes. Depending on the mode you are in, you will be required to follow different processes.
 
-Use the mode_get tool to check your current operating mode.
-Use the mode_set tool to switch between modes as your work progresses. Only use mode_set if the user explicitly instructs/allows you to change modes.
-
-You are currently operating in the {current_mode} mode.
+{mode_get_instructions}{mode_set_instructions}You are currently operating in the {current_mode} mode.
 
 ### Mandatory Mode based Workflow
 
@@ -64,6 +67,14 @@ type Config struct {
 	// Instructions overrid
... (truncated)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by .NET to Go API Porting Agent · copilot · gpt54 · 124.4 AIC · ⌖ 14.7 AIC · ⊞ 15.7K · ◷

Activity

  1. michelle-clayton-work commented on Sep 19, 2026

    @michelle-clayton-work
    Contributor

    Pull request #1111 is linked to this issue and will close it when merged.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions