From a1a044e7caf7144e12c7a5af1205d62a9783d9dd Mon Sep 17 00:00:00 2001 From: David Kaya Date: Thu, 26 Mar 2026 19:23:48 +0100 Subject: [PATCH] fix: filter internal runtime tools Exclude internal runtime tools from sidecar capability discovery so they do not surface in the approval tool catalog. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Services/SidecarProtocolHost.cs | 9 ++++++++- .../SidecarProtocolHostTests.cs | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/sidecar/src/Aryx.AgentHost/Services/SidecarProtocolHost.cs b/sidecar/src/Aryx.AgentHost/Services/SidecarProtocolHost.cs index 0475c5e..33ee0f2 100644 --- a/sidecar/src/Aryx.AgentHost/Services/SidecarProtocolHost.cs +++ b/sidecar/src/Aryx.AgentHost/Services/SidecarProtocolHost.cs @@ -16,6 +16,13 @@ public sealed class SidecarProtocolHost private const string ResolveApprovalCommandType = "resolve-approval"; private const string ResolveUserInputCommandType = "resolve-user-input"; private const string AskUserToolName = "ask_user"; + private static readonly HashSet ExcludedRuntimeToolNames = new(StringComparer.OrdinalIgnoreCase) + { + AskUserToolName, + "report_intent", + "task_complete", + "exit_plan_mode", + }; private static readonly string[] AuthenticationErrorIndicators = [ @@ -460,7 +467,7 @@ public sealed class SidecarProtocolHost { string? toolName = string.IsNullOrWhiteSpace(tool.Name) ? null : tool.Name.Trim(); return toolName is not null - && !string.Equals(toolName, AskUserToolName, StringComparison.OrdinalIgnoreCase); + && !ExcludedRuntimeToolNames.Contains(toolName); } private static bool IsReasoningEffort(string? value) diff --git a/sidecar/tests/Aryx.AgentHost.Tests/SidecarProtocolHostTests.cs b/sidecar/tests/Aryx.AgentHost.Tests/SidecarProtocolHostTests.cs index fb4e3fb..e8c192c 100644 --- a/sidecar/tests/Aryx.AgentHost.Tests/SidecarProtocolHostTests.cs +++ b/sidecar/tests/Aryx.AgentHost.Tests/SidecarProtocolHostTests.cs @@ -517,7 +517,7 @@ public sealed class SidecarProtocolHostTests } [Fact] - public void MapRuntimeTools_ExcludesAskUserAndDeduplicatesByName() + public void MapRuntimeTools_ExcludesInternalToolsAndDeduplicatesByName() { IReadOnlyList runtimeTools = SidecarProtocolHost.MapRuntimeTools( [ @@ -527,6 +527,21 @@ public sealed class SidecarProtocolHostTests Description = "Ask the user a question.", }, new Tool + { + Name = "report_intent", + Description = "Report current intent.", + }, + new Tool + { + Name = "task_complete", + Description = "Signal task completion.", + }, + new Tool + { + Name = "exit_plan_mode", + Description = "Exit plan mode.", + }, + new Tool { Name = " web_fetch ", Description = " Fetch content from the web. ",