Describe the bug
Running chat session from VS Code, I have installed a hook that denies specific commands.
Affected version
- VS Code
1.125.1
- GitHub Copilot Chat Extension
v0.53.1
Steps to reproduce the behavior
.github/hooks/hooks.json
{
"hooks": {
"PreToolUse": [
{
"type": "command",
"cwd": "src",
"windows": "bin/Debug/net10.0/hook --tee requests.txt",
"timeout": 15
}
]
}
}
My hook.exe program parses the event hook and denies commands containing Get-Date from run_in_terminal tool. The --tee request.txt allows to pipe the STDIN request and dump the exit code and STDOUT response from the hook handler.
You can quickly re-create `hook.exe` as thus:
Program.cs
using System.Text.Json;
using System.Text.Json.Serialization;
var json = JsonSerializer.Serialize(new Response
{
Continue = false,
stopReason = "Tool call denied",
hookSpecificOutput = new
{
permissionDecision = "deny",
permissionDecisionReason = "Get-Date is a dangerous command",
}
});
Console.WriteLine(json);
Environment.Exit(2);
class Response
{
[JsonPropertyName("continue")]
public bool Continue { get; set; } = default!;
public string? stopReason { get; set; }
public object hookSpecificOutput { get; set; } = default!;
}
Here is a simple session prompt:
Give me the latest powershell Get-Date
requests.txt
{"timestamp":"2026-06-20T09:02:23.792Z","hook_event_name":"PreToolUse","session_id":"189c9189-f1ea-4656-9b85-b5b31729ce41","transcript_path":"redacted.jsonl","tool_name":"run_in_terminal","tool_input":{"command":"Get-Date","explanation":"Print current date/time","goal":"Show current PowerShell date/time","mode":"sync"},"tool_use_id":"call_SCugVzemRWFMPYhoX6DKCdEE__vscode-1781945312345","cwd":"c:\\Projects\\springcomp\\hooks\\t\\src"}
requests_response.txt
2{"continue":false,"stopReason":"Tool call denied","systemMessage":null,"hookSpecificOutput":{"permissionDecision":"deny","permissionDecisionReason":"Get-Date is a dangerous command","updatedInput":null,"additionalContext":null,"hookEventName":"PreToolUse"}}
I tried everything:
- Exit code
2
- Response’s
continue: false property
- Response’s
hookSpecificOutput.permissionDecision: deny property
Still, the tool is called and never denied.
Expected behavior
The tool call SHOULD be denied.
Additional context
No response
Describe the bug
Running chat session from VS Code, I have installed a hook that denies specific commands.
Affected version
1.125.1v0.53.1Steps to reproduce the behavior
.github/hooks/hooks.json
{ "hooks": { "PreToolUse": [ { "type": "command", "cwd": "src", "windows": "bin/Debug/net10.0/hook --tee requests.txt", "timeout": 15 } ] } }My
hook.exeprogram parses the event hook and denies commands containingGet-Datefromrun_in_terminaltool. The--tee request.txtallows to pipe the STDIN request and dump the exit code and STDOUT response from the hook handler.You can quickly re-create `hook.exe` as thus:
Program.cs
Here is a simple session prompt:
requests.txt
{"timestamp":"2026-06-20T09:02:23.792Z","hook_event_name":"PreToolUse","session_id":"189c9189-f1ea-4656-9b85-b5b31729ce41","transcript_path":"redacted.jsonl","tool_name":"run_in_terminal","tool_input":{"command":"Get-Date","explanation":"Print current date/time","goal":"Show current PowerShell date/time","mode":"sync"},"tool_use_id":"call_SCugVzemRWFMPYhoX6DKCdEE__vscode-1781945312345","cwd":"c:\\Projects\\springcomp\\hooks\\t\\src"}requests_response.txt
2{"continue":false,"stopReason":"Tool call denied","systemMessage":null,"hookSpecificOutput":{"permissionDecision":"deny","permissionDecisionReason":"Get-Date is a dangerous command","updatedInput":null,"additionalContext":null,"hookEventName":"PreToolUse"}}I tried everything:
2continue: falsepropertyhookSpecificOutput.permissionDecision: denypropertyStill, the tool is called and never denied.
Expected behavior
The tool call SHOULD be denied.
Additional context
No response