-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Summary
preToolUse hooks in GitHub Copilot CLI appear to ignore hookSpecificOutput.updatedInput, even though the VS Code hooks documentation describes updatedInput as supported for PreToolUse.
Environment
- Copilot CLI version:
1.0.5-0 - OS: Linux
What I expected
When a preToolUse hook returns:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"updatedInput": {
"command": "printf PROBE_REWRITTEN"
}
}
}I expected the CLI to execute the rewritten tool input.
What happened instead
The hook executed and returned updatedInput, but Copilot CLI still ran the original bash command.
Reproduction
Repository hook config:
{
"version": 1,
"hooks": {
"preToolUse": [
{
"type": "command",
"bash": "./scripts/rewrite-probe.sh",
"cwd": ".github/hooks",
"timeoutSec": 10
}
]
}
}Hook script:
#!/usr/bin/env bash
set -euo pipefail
input=$(cat)
tool_name=$(jq -r '.tool_name // .toolName // empty' <<<"$input")
[[ "$tool_name" != "bash" ]] && exit 0
tool_input=$(jq -c '.tool_input // (.toolArgs | fromjson? ) // {}' <<<"$input")
command=$(jq -r '.command // empty' <<<"$tool_input")
[[ "$command" != *PROBE_ORIGINAL* ]] && exit 0
jq -nc '{
continue: true,
hookSpecificOutput: {
hookEventName: "PreToolUse",
permissionDecision: "allow",
permissionDecisionReason: "Rewrite probe attempted updatedInput",
updatedInput: {
command: "printf PROBE_REWRITTEN",
description: "Run the exact probe command"
},
additionalContext: "Rewrite probe replaced the bash command with printf PROBE_REWRITTEN"
}
}'Prompt used:
Use the bash tool to run exactly this command and nothing else:
printf PROBE_ORIGINAL
After running it, tell me exactly what was printed. Do not simulate the result.
Hook input captured:
{"sessionId":"...","timestamp":1773370259963,"cwd":".../hook-probe","toolName":"bash","toolArgs":"{\"command\":\"printf PROBE_ORIGINAL\",\"description\":\"Run the exact probe command\"}"}Hook output captured:
{"continue":true,"systemMessage":"rewrite-probe fired","permissionDecision":"allow","hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"Rewrite probe attempted updatedInput","updatedInput":{"command":"printf PROBE_REWRITTEN","description":"Run the exact probe command"},"additionalContext":"Rewrite probe replaced the bash command with printf PROBE_REWRITTEN"}}Copilot CLI still executed:
printf PROBE_ORIGINALAnd reported output:
PROBE_ORIGINAL
Question
Is hookSpecificOutput.updatedInput intended to be supported in Copilot CLI as well, or is this field currently VS Code-only / undocumented for CLI? If it is intended to work in CLI, this looks like a bug or a docs mismatch.