[BUG] prompt-type PostToolUse hook stops continuation even when the prompt instructs to approve immediately
Description
A prompt-type PostToolUse hook that conditionally triggers an action (e.g., launch a subagent for cypress test files, otherwise approve immediately) stops continuation even when the prompt's logic determines the file is not relevant and should be approved.
Steps to Reproduce
- Configure a
PostToolUsehook withtype: "prompt"andmatcher: "Edit|Write":
{
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "prompt",
"prompt": "Check the file path. If it's under cypress/e2e/, launch a review agent. Otherwise, approve immediately."
}
]
}
]
}
- Edit a file NOT under
cypress/e2e/(e.g.,src/components/Foo.tsx) - The hook fires and the model correctly determines the file is not under
cypress/e2e/
Expected Behavior
The model approves immediately and continuation proceeds without interruption.
Actual Behavior
The hook output shows:
PostToolUse:Edit hook stopped continuation: The edited file is '...', which is not under the cypress/e2e/ directory. According to the instructions, files outside cypress/e2e/ should be immediately approved without launching the test-convention-reviewer agent.
Despite the model's response being "approve/pass", the continuation is stopped. This forces the user to manually resume, breaking automated workflows.
Analysis
It appears that prompt-type hooks always stop continuation regardless of the model's response content. The "stopped continuation" behavior seems to be the default for prompt hooks, with no mechanism for the prompt's response to signal "pass/continue".
Workaround
Use a command-type hook with a shell script that checks the file path and exits 0 (pass) for non-matching files, only outputting a prompt instruction for matching files.
Environment
- Claude Code version: latest
- OS: Linux (WSL2)
- Platform: linux
---
🤖 Generated with Claude Code
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗