fix: auto-allow infrastructure tool hooks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-29 22:01:56 +02:00
co-authored by Copilot
parent 4726e2acea
commit 66b2a94977
2 changed files with 50 additions and 2 deletions
@@ -106,6 +106,27 @@ public sealed class CopilotSessionHooksTests
Assert.Single(runner.Invocations);
}
[Theory]
[InlineData("ask_user")]
[InlineData("report_intent")]
[InlineData("task_complete")]
[InlineData("handoff_to_2")]
[InlineData("handoff_to_specialist")]
public async Task Create_PreToolUseAutoAllowsInfrastructureTools(string toolName)
{
RunTurnCommandDto command = CreateCommandWithToolApproval();
SessionHooks hooks = CopilotSessionHooks.Create(command, command.Pattern.Agents[0], ResolvedHookSet.Empty, new RecordingHookCommandRunner());
PreToolUseHookOutput? decision = await hooks.OnPreToolUse!(
new PreToolUseHookInput
{
ToolName = toolName,
},
null!);
Assert.Equal("allow", decision?.PermissionDecision);
}
[Fact]
public async Task Create_RunsConfiguredNonPreToolHooks()
{