[BUG] Hooks execution deferred until terminal tab regains focus (Windows Terminal)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- OS: Windows 11 Pro (10.0.26200)
- Terminal: Windows Terminal (Store version)
- Shell: PowerShell 5.1
- Claude Code: VSCode extension + terminal CLI
Behavior
Hook commands (Stop, Notification, PermissionRequest) do not execute until the
Windows Terminal tab running Claude Code regains focus. The hook is queued but
not fired while the tab is in the background.
Reproduction
- Configure a hook that writes to a log file:
```json
"hooks": {
"Stop": [{ "matcher": "", "hooks": [{ "type": "command", "command": "bash -c \"echo $(date) >> /tmp/hook-debug.log\"" }] }]
}
What Should Happen?
Hook command should be executed immediately
Error Messages/Logs
Steps to Reproduce
Reproduction
- Configure a hook that writes to a log file:
```json
"hooks": {
"Stop": [{ "matcher": "", "hooks": [{ "type": "command", "command": "bash -c \"echo $(date) >> /tmp/hook-debug.log\"" }] }]
}
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.70
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Reproducible both with powershell and vscode extension
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗