claude-code - 💡(How to fix) Fix [BUG] PreToolUse hook "ask" permissionDecision is auto-approved in auto mode — no way to force prompt

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

A PreToolUse hook returning permissionDecision: "ask" is silently auto-approved when running in auto mode. The user is never prompted for confirmation. This makes it impossible to gate dangerous operations (git commit, git push) while using auto mode for everything else.

Related: #22338 (closed as not planned), #37420 (bypass mode reset after hook ask).

Steps to reproduce and expected behavior below.

Error Message

Error Messages/Logs

Root Cause

A PreToolUse hook returning permissionDecision: "ask" is silently auto-approved when running in auto mode. The user is never prompted for confirmation. This makes it impossible to gate dangerous operations (git commit, git push) while using auto mode for everything else.

Related: #22338 (closed as not planned), #37420 (bypass mode reset after hook ask).

Steps to reproduce and expected behavior below.

Code Example



---

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "if": "Bash(git:*)",
            "command": "jq -r '.tool_input.command' | grep -qE '\\bcommit\\b' && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"ask\",\"permissionDecisionReason\":\"git commit requires manual confirmation\"}}' || true"
          }
        ]
      }
    ]
  }
}

---

{
  "permissions": {
    "ask": [
      "Bash(git commit:*)",
      "Bash(git -C * commit*)"
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Description

A PreToolUse hook returning permissionDecision: "ask" is silently auto-approved when running in auto mode. The user is never prompted for confirmation. This makes it impossible to gate dangerous operations (git commit, git push) while using auto mode for everything else.

Related: #22338 (closed as not planned), #37420 (bypass mode reset after hook ask).

Steps to reproduce and expected behavior below.

Verified behavior

MechanismNormal modeAuto mode
"ask" in permissionsPrompts userAuto-approved (bug)
"ask" from PreToolUse hookPrompts userAuto-approved (bug)
"deny" from PreToolUse hookBlocksBlocks
  • "deny" works in all modes, but is too restrictive: it permanently blocks the command with no way for the user to approve it inline.
  • There is no permissionDecision value that means "always prompt, regardless of mode".

Requested behavior

One of:

  • "ask" from PreToolUse hooks should always force a prompt, even in auto mode (hooks are an explicit user choice to gate specific operations)
  • Or add a new decision value (e.g. "require_ask" or "force_ask") that forces a prompt in all modes

Use case

Users want auto mode for productivity but need a safety gate on irreversible operations (git commit, git push, deployment commands). The current options are:

  • "ask" — works in normal mode, silently bypassed in auto mode
  • "deny" — blocks permanently, user must exit Claude to run the command manually

Neither achieves "auto mode + selective confirmation".

What Should Happen?

The user is prompted for confirmation before the commit executes. The hook's "ask" decision should force a permission dialog, even in auto mode. This is the only mechanism users have to selectively gate specific dangerous operations while staying in auto mode.

Actual behavior

The commit executes immediately without any prompt. Both the hook's "ask" and the permission rule "ask" are auto-approved by auto mode.

Error Messages/Logs

Steps to Reproduce

  1. Configure a PreToolUse hook in .claude/settings.local.json:
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "if": "Bash(git:*)",
            "command": "jq -r '.tool_input.command' | grep -qE '\\bcommit\\b' && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"ask\",\"permissionDecisionReason\":\"git commit requires manual confirmation\"}}' || true"
          }
        ]
      }
    ]
  }
}
  1. Also add git commit to the ask permission list:
{
  "permissions": {
    "ask": [
      "Bash(git commit:*)",
      "Bash(git -C * commit*)"
    ]
  }
}
  1. Start Claude Code and enter auto mode
  2. Ask Claude to commit staged changes

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.114 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

To fix the issue, consider adding a new permissionDecision value (e.g., "require_ask" or "force_ask") that always prompts the user for confirmation, regardless of the mode.

Guidance

  • Review the PreToolUse hook configuration to ensure it correctly returns "ask" for the desired operations (e.g., git commit).
  • Verify that the permissions list includes the operations that should prompt the user for confirmation (e.g., "Bash(git commit:*)").
  • Consider modifying the hook to return a custom permissionDecision value (if supported) to force a prompt in all modes.
  • Test the changes in both normal and auto modes to ensure the desired behavior.

Example

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "if": "Bash(git:*)",
            "command": "jq -r '.tool_input.command' | grep -qE '\\bcommit\\b' && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"require_ask\",\"permissionDecisionReason\":\"git commit requires manual confirmation\"}}' || true"
          }
        ]
      }
    ]
  }
}

Note: This example assumes a custom permissionDecision value ("require_ask") is supported.

Notes

The issue seems to be related to the auto mode behavior, where the "ask" permission decision is silently auto-approved. Adding a new permissionDecision value or modifying the existing hook configuration might resolve the issue. However, without further information on the supported permissionDecision values, it's difficult to provide a definitive solution.

Recommendation

Apply a workaround by modifying the PreToolUse hook to return a custom permissionDecision value (if supported) or by using a different approach to gate specific operations. This will allow users to selectively confirm dangerous operations while staying in auto mode.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING