Support timeout + auto-deny on permissionDecision: ask from hooks
Feature request
When a PreToolUse hook returns permissionDecision: "ask", the permission prompt waits indefinitely for user input. It would be useful to support a timeout with a configurable fallback action (default: deny).
Use case
I use damage-control hooks to gate sensitive operations (git push, editing security config files) behind user confirmation. If I'm away from my device and an agent hits one of these prompts, it just hangs forever. I'd prefer it auto-deny after a configurable timeout so the agent can fail gracefully or try an alternative approach.
Proposed API
Allow hooks to return a timeout alongside the ask decision:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "ask",
"permissionDecisionReason": "Pushing to remote repository",
"permissionTimeout": 300,
"permissionTimeoutAction": "deny"
}
}
Or as a global setting in settings.json:
{
"hooks": {
"askTimeout": 300,
"askTimeoutAction": "deny"
}
}
Either approach would work — per-hook granularity is ideal but a global default would cover most cases.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗