Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When a beforeShellExecution hook returns permission: "ask", the command executes immediately without prompting the user for approval.
The allow and deny permissions work correctly - only ask is broken.
| Permission | Expected | Actual | Status |
|---|---|---|---|
"allow" |
Command runs | Command runs | |
"deny" |
Command blocked | Command blocked | |
"ask" |
User prompted | Command runs (no prompt) |
Environment:
- Platform: Linux (Remote SSH)
- Broken Version: 2.4.21
- Working Version: 2.1.50 (regression)
The Hooks panel in Cursor Settings shows the hook correctly returned “ASK” (see attached screenshot), confirming Cursor receives the response but ignores it.
Steps to Reproduce
- Create
.cursor/hooks.json:
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{"command": "python3 .cursor/test_hook.py"}
]
}
}
- Create
.cursor/test_hook.py:
import json
import sys
payload = json.load(sys.stdin)
cmd = payload.get("command", "")
if cmd.startswith("rm"):
print(json.dumps({
"permission": "ask",
"user_message": "Dangerous command needs approval",
"agent_message": "Please approve this rm command"
}))
else:
print(json.dumps({"permission": "allow"}))
- Reload Cursor window
- Have the agent execute:
rm /tmp/testfile.txt
Expected Behavior
When the hook returns permission: "ask", Cursor should display a prompt allowing the user to approve or deny the command before it runs.
Actual behavior: The command runs immediately without any user prompt.
Note: Changing "ask" to "deny" correctly blocks the command, confirming the hook is working - only the "ask" permission is broken.
Screenshots / Screen Recordings
Operating System
MacOS
Version Information
Version: 2.4.21 (Universal)
VSCode Version: 1.105.1
Commit: dc8361355d709f306d5159635a677a571b277bc0
Date: 2026-01-22T16:57:59.675Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Darwin x64 24.6.0
For AI issues: which model did you use?
Claude-4.5-opus-high
Does this stop you from using Cursor
No - Cursor works, but with this issue
